Ejemplo n.º 1
0
 private void OnServerListPing(ServerListPingPacket p)
 {
     if (ServerListPing != null) ServerListPing.Invoke(this, new PacketEventArgs<ServerListPingPacket>(p));
 }
Ejemplo n.º 2
0
        public static void ReadServerListPing(Client client, PacketReader reader)
        {
            ServerListPingPacket sl = new ServerListPingPacket();
            sl.Read(reader);

            if (!reader.Failed)
                Client.HandlePacketServerListPing(client, sl);
        }
Ejemplo n.º 3
0
 public static void HandlePacketServerListPing(Client client, ServerListPingPacket packet)
 {
     // Received a ServerListPing, so send back Disconnect with the Reason string containing data (server description, number of users, number of slots), delimited by a §
     var clientCount = client.Owner.Server.GetAuthenticatedClients().Count();
     //client.SendPacket(new DisconnectPacket() { Reason = String.Format("{0}§{1}§{2}", client.Owner.Server.ToString(), clientCount, Chraft.Properties.Settings.Default.MaxPlayers) });
     client.Kick(String.Format("{0}§{1}§{2}", client.Owner.Server.ToString(), clientCount, Chraft.Properties.Settings.Default.MaxPlayers));
 }
Ejemplo n.º 4
0
 public static void HandlePacketServerListPing(Client client, ServerListPingPacket packet)
 {
     // Received a ServerListPing, so send back Disconnect with the Reason string containing data (server description, number of users, number of slots), delimited by a §
     var clientCount = client.Server.GetAuthenticatedClients().Count();
     client.Kick(String.Format("§1\0{0}\0{1}\0{2}\0{3}\0{4}", ProtocolVersion, MinecraftServerVersion, ChraftConfig.MOTD, clientCount, ChraftConfig.MaxPlayers));
 }