public PlayerHandler(Server server, PacketPipe pipe, Player player) { this.server = server; this.pipe = pipe; this.player = player; pipe.SetHandler(this); //server.World.ChunkPool.AddPlayer(player); //pipe.SendPacket(new PositionPacket(0, 4, 0)); SetPosition(player.X, player.Y, player.Z, 0, 0); var mainInv = new InventoryItem[36]; mainInv[0] = new InventoryItem((int)BlockType.Stone, -1); mainInv[1] = new InventoryItem((int)BlockType.Dirt, -1); mainInv[2] = new InventoryItem((int)BlockType.Cobblestone, -1); mainInv[3] = new InventoryItem((int)BlockType.Wood, -1); mainInv[4] = new InventoryItem((int)BlockType.Sand, -1); mainInv[5] = new InventoryItem((int)BlockType.StillLava, -1); mainInv[6] = new InventoryItem((int)BlockType.StillWater, -1); mainInv[7] = new InventoryItem((int)BlockType.Sponge, -1); mainInv[8] = new InventoryItem(277, 1); pipe.SendPacket(new SendInventoryPacket(InventoryType.Main, mainInv)); pipe.SendPacket(new SendInventoryPacket(InventoryType.Crafting, new InventoryItem[4])); pipe.SendPacket(new SendInventoryPacket(InventoryType.Armor, new InventoryItem[4])); pipe.SendPacket(new UpdateTimePacket((int)server.World.Time)); Broadcast(new ChatPacket("Player connected: " + player.Name)); }
public ConnectionHandler(Server server, int port) { this.server = server; this.port = port; listenThread = new Thread(new ThreadStart(StartListen)); listenThread.Start(); }
static void Main(string[] args) { Server server = new Server(); server.Start(); }
public LoginHandler(Server server, TcpClient client) { this.server = server; pipe = new PacketPipe(client, this); }