public void sendKeyData() {
        PlayerManager playerManager = registry.getPlayerManager();
        if (playerManager != null) {
            Player p = registry.getPlayerManager().getCurrentPlayer();
            if (p != null) {
                UDPKeys uk = new UDPKeys(
                        p.getId(),
                        gameController.getGamePanel().keySpacePressed,
                        gameController.getGamePanel().keyRightPressed,
                        gameController.getGamePanel().keyLeftPressed,
                        gameController.getGamePanel().keyGatherPressed,
                        gameController.getGamePanel().keyRobotPressed);
                if(uk.hasChange(oldUK)) {
                try {
                    sendPacket(uk);
                    oldUK = null;
                    oldUK = uk;
                } catch (IOException e) {
                    e.printStackTrace();
                    //running = false;
                }
                }
            }
        }
    }