@Override
    public void keyPressed(KeyEvent e) {
        if (isAlive) {
            if (e.getKeyChar() == 'w') {
                player.setDy(-4);
                keyDown[2] = true;
            } else if (e.getKeyChar() == 's') {
                player.setDy(4);
                keyDown[3] = true;
            } else if (e.getKeyChar() == 'a') {
                player.setDx(-4);
                keyDown[0] = true;
            } else if (e.getKeyChar() == 'd') {
                keyDown[1] = true;
                player.setDx(4);
            } else if (e.getKeyChar() == ' ') {
                server.sendMessage("GIVEMOB");
            }
        } else {
            player = new Player();
            player.setUsername(username);
            players.add(player);
            isAlive = true;
            time = 0;
            timer.start();
        }

    }