protected void handlePacketReceived(PacketReceivedMessage msg) {
                if (msg.source != connection) {
                        return;
                }
                if (msg.packet instanceof KeepAlivePacket) {
                        connection.sendPacket(new KeepAlivePacket(((KeepAlivePacket)msg.packet).hash));
                } else {
                        if (!shookHand.get()) {
                                if (!(msg.packet instanceof HandshakePacket)) {
                                        connection.shutdown();
                                        setStatus("Unexpected packet: " + msg.packet.getClass().getName());
                                        return;
                                }
                                HandshakePacket packet = (HandshakePacket)msg.packet;
                                if (packet.protocolVersion > WinLinkPlugin.PROTOCOL_VERSION) {
                                        connection.shutdown();
                                        setStatus("Client outdated");
                                        return;
                                }
                                if (packet.protocolVersion < WinLinkPlugin.PROTOCOL_VERSION) {
                                        connection.shutdown();
                                        setStatus("Server outdated");
                                        return;
                                }
                                if (!name.equals(packet.name)) {
                                        connection.shutdown();
                                        setStatus("Name mismatch: " + packet.name);
                                        return;
                                }
                                plugin.getLogger().info("Client " + name + ": Connection established");
                                setStatus("Connected");
                                shookHand.set(true);
                                plugin.getServer().getPluginManager().callEvent(new ClientConnectEvent(this));
                        } else {
                                plugin.getServer().getPluginManager().callEvent(new ClientReceivePacketEvent(this, msg.packet));
                        }
                }
        }