コード例 #1
0
        public void HandlePlayerListItem(MinecraftClient client, IPacket packet) {
            var myPacket = (CBPlayerListItem)packet;

            if (myPacket.Online) {
                if (client.Players.ContainsKey(myPacket.Playername)) {
                    client.Players[myPacket.Playername] = myPacket.Ping;
                    client.RaisePlayerlistUpdate(myPacket.Playername, myPacket.Ping);
                } else {
                    client.Players.Add(myPacket.Playername, myPacket.Ping);
                    client.RaisePlayerlistAdd(myPacket.Playername, myPacket.Ping);
                }
            } else {
                if (client.Players.ContainsKey(myPacket.Playername)) {
                    client.Players.Remove(myPacket.Playername);
                    client.RaisePlayerlistRemove(myPacket.Playername);
                }
            }
        }