private bool processPacket(byte id)
        {
            int nbr = 0;

            switch (id)
            {
            case 0x00: byte[] keepalive = new byte[5] {
                    0, 0, 0, 0, 0
            };
                Receive(keepalive, 1, 4, SocketFlags.None);
                handler.OnServerKeepAlive();
                Send(keepalive); break;

            case 0x01: readData(4); readNextString(); readData(5); break;

            case 0x02: readData(1); readNextString(); readNextString(); readData(4); break;

            case 0x03:
                string message = readNextString();
                handler.OnTextReceived(message, protocolversion >= 72); break;

            case 0x04: readData(16); break;

            case 0x05: readData(6); readNextItemSlot(); break;

            case 0x06: readData(12); break;

            case 0x07: readData(9); break;

            case 0x08: if (protocolversion >= 72)
                {
                    readData(10);
                }
                else
                {
                    readData(8);
                } break;

            case 0x09: readData(8); readNextString(); break;

            case 0x0A: readData(1); break;

            case 0x0B: readData(33); break;

            case 0x0C: readData(9); break;

            case 0x0D: readData(41); break;

            case 0x0E: readData(11); break;

            case 0x0F: readData(10); readNextItemSlot(); readData(3); break;

            case 0x10: readData(2); break;

            case 0x11: readData(14); break;

            case 0x12: readData(5); break;

            case 0x13: if (protocolversion >= 72)
                {
                    readData(9);
                }
                else
                {
                    readData(5);
                } break;

            case 0x14: readData(4); readNextString(); readData(16); readNextEntityMetaData(); break;

            case 0x16: readData(8); break;

            case 0x17: readData(19); readNextObjectData(); break;

            case 0x18: readData(26); readNextEntityMetaData(); break;

            case 0x19: readData(4); readNextString(); readData(16); break;

            case 0x1A: readData(18); break;

            case 0x1B: if (protocolversion >= 72)
                {
                    readData(10);
                }
                break;

            case 0x1C: readData(10); break;

            case 0x1D: nbr = (int)readNextByte(); readData(nbr * 4); break;

            case 0x1E: readData(4); break;

            case 0x1F: readData(7); break;

            case 0x20: readData(6); break;

            case 0x21: readData(9); break;

            case 0x22: readData(18); break;

            case 0x23: readData(5); break;

            case 0x26: readData(5); break;

            case 0x27: if (protocolversion >= 72)
                {
                    readData(9);
                }
                else
                {
                    readData(8);
                } break;

            case 0x28: readData(4); readNextEntityMetaData(); break;

            case 0x29: readData(8); break;

            case 0x2A: readData(5); break;

            case 0x2B: readData(8); break;

            case 0x2C: if (protocolversion >= 72)
                {
                    readNextEntityProperties(protocolversion);
                }
                break;

            case 0x33: readData(13); nbr = readNextInt(); readData(nbr); break;

            case 0x34: readData(10); nbr = readNextInt(); readData(nbr); break;

            case 0x35: readData(12); break;

            case 0x36: readData(14); break;

            case 0x37: readData(17); break;

            case 0x38: readNextChunkBulkData(); break;

            case 0x3C: readData(28); nbr = readNextInt(); readData(3 * nbr); readData(12); break;

            case 0x3D: readData(18); break;

            case 0x3E: readNextString(); readData(17); break;

            case 0x3F: if (protocolversion > 51)
                {
                    readNextString(); readData(32);
                }
                break;

            case 0x46: readData(2); break;

            case 0x47: readData(17); break;

            case 0x64: readNextWindowData(protocolversion); break;

            case 0x65: readData(1); break;

            case 0x66: readData(7); readNextItemSlot(); break;

            case 0x67: readData(3); readNextItemSlot(); break;

            case 0x68: readData(1); for (nbr = readNextShort(); nbr > 0; nbr--)
                {
                    readNextItemSlot();
                }
                break;

            case 0x69: readData(5); break;

            case 0x6A: readData(4); break;

            case 0x6B: readData(2); readNextItemSlot(); break;

            case 0x6C: readData(2); break;

            case 0x82: readData(10); readNextString(); readNextString(); readNextString(); readNextString(); break;

            case 0x83: readData(4); nbr = readNextShort(); readData(nbr); break;

            case 0x84: readData(11); nbr = readNextShort(); if (nbr > 0)
                {
                    readData(nbr);
                }
                break;

            case 0x85: if (protocolversion >= 74)
                {
                    readData(13);
                }
                break;

            case 0xC8:
                if (readNextInt() == 2022)
                {
                    ConsoleIO.WriteLogLine("You are dead. Type /respawn to respawn.");
                }
                if (protocolversion >= 72)
                {
                    readData(4);
                }
                else
                {
                    readData(1);
                }
                break;

            case 0xC9:
                string name = readNextString(); bool online = readNextByte() != 0x00; readData(2);
                Guid   FakeUUID = new Guid(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16).ToArray());
                if (online)
                {
                    handler.OnPlayerJoin(FakeUUID, name);
                }
                else
                {
                    handler.OnPlayerLeave(FakeUUID);
                }
                break;

            case 0xCA: if (protocolversion >= 72)
                {
                    readData(9);
                }
                else
                {
                    readData(3);
                } break;

            case 0xCB: autocomplete_result = readNextString(); autocomplete_received = true; break;

            case 0xCC: readNextString(); readData(4); break;

            case 0xCD: readData(1); break;

            case 0xCE: if (protocolversion > 51)
                {
                    readNextString(); readNextString(); readData(1);
                }
                break;

            case 0xCF: if (protocolversion > 51)
                {
                    readNextString(); readData(1); readNextString();
                }
                readData(4); break;

            case 0xD0: if (protocolversion > 51)
                {
                    readData(1); readNextString();
                }
                break;

            case 0xD1: if (protocolversion > 51)
                {
                    readNextTeamData();
                }
                break;

            case 0xFA: string channel = readNextString();
                byte[]        payload = readNextByteArray();
                handler.OnPluginChannelMessage(channel, payload);
                break;

            case 0xFF: string reason = readNextString();
                handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick, reason); break;

            default: return(false); //unknown packet!
            }
            return(true);           //packet has been successfully skipped
        }