synchronized void sendPacket(Packet packet) throws IOException {
            if (open) {
                out.writeInt(packet.id);
                packetTypes.get(packet.id).write(packet, out);
            }
        }