    public void handleEvent(Event e) {
        Player p;
        if (e.getStringValue().equals(getPlayerName())) {
            p = currentPlayer;
        } else {
            p = players.get(e.getSender());
        }
        if (p != null) {
            System.out.printf("Handling event from %s %n", p.getName());
        }
        switch (e.getType()) {
            case RUN_RIGHT: {
                p.accelerateX(Physics.RUN_SPEED);
            } break;
            case RUN_LEFT: {
                p.accelerateX(-Physics.RUN_SPEED);
            } break;
            case JUMP: {
                if (p.isCanJump()) {
                    p.accelerateY(Physics.JUMP_SPEED);
                    p.setCanJump(false);
                }
            } break;
            case SHOOT: {
                String[] pos = e.getStringValue().split(" ");
                int sx = Integer.parseInt(pos[0]);
                int sy = Integer.parseInt(pos[1]);
                countShoot(currentPlayer.getPosition(), new Point(sx, sy));
                if (hitedPlayer != null) {
                    Event event = new GameEvent(EventType.INCREMENT_HP, e.getSender(),
                            hitedPlayer.getName() + " -" + HIT_DECREMENT_HP_VALUE);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    hitedPlayer = null;
                    handleEvent(event);
                }
            } break;
            case INCREMENT_HP: {
                String[] values = e.getStringValue().split(" ");
                int leftHP = players.get(values[0]).changeHP(Integer.parseInt(values[1]));
                if (leftHP <= 0) {
                    GameEvent event = new GameEvent(EventType.KILLED, e.getSender(), values[0]);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    handleEvent(event);
                }
            } break;
            case KILLED: {
                System.out.printf("%s: %s killed %s%n", playerName, e.getSender(), e.getStringValue());
                rate.incScore(players.get(e.getSender()), 1);
                rate.incScore(players.get(e.getStringValue()), -1);
                GameEvent event = new GameEvent(EventType.REBORN,
                        e.getSender(), e.getStringValue());
                for (EventHandler h : handlers) {
                    h.handleEvent(event);
                }
                handleEvent(event);
            } break;
            case REBORN: {
                spawn(players.get(e.getStringValue()));
            } break;
            case JOIN_NEW_PLAYER: {
                String[] playerInfo = e.getStringValue().split(" ");
                int x = Integer.parseInt(playerInfo[0]);
                int y = Integer.parseInt(playerInfo[1]);
                Player newPlayer = new Player(x, y);
                newPlayer.setName(e.getSender());
                players.put(newPlayer.getName(), newPlayer);
                rate.addPlayer(newPlayer);
            } break;
            case MOVE_PLAYER: {
                if (p != currentPlayer && p != null) {
                    String[] pos = e.getStringValue().split(" ");
                    int x = Integer.parseInt(pos[0]);
                    int y = Integer.parseInt(pos[1]);
                    p.setX(x);
                    p.setY(y);
                }
            } break;
        }
    }

    public void handleEvent(Event e) {
        Player p;
        if (e.getStringValue().equals(getPlayerName())) {
            p = currentPlayer;
        } else {
            p = players.get(e.getSender());
        }
        if (p != null) {
            System.out.printf("Handling event from %s %n", p.getName());
        }
        switch (e.getType()) {
            case RUN_RIGHT: {
                if (p != null) {
                    p.accelerateX(Physics.RUN_SPEED);
                }
            } break;
            case RUN_LEFT: {
                if (p != null) {
                    p.accelerateX(-Physics.RUN_SPEED);
                }
            } break;
            case JUMP: {
                if (p != null) {
                    if (p.isCanJump()) {
                        p.accelerateY(Physics.JUMP_SPEED);
                        p.setCanJump(false);
                    }
                }
            } break;
            case SHOOT: {
                String[] pos = e.getStringValue().split(" ");
                int sx = Integer.parseInt(pos[0]);
                int sy = Integer.parseInt(pos[1]);
                countShoot(currentPlayer.getPosition(), new Point(sx, sy));
                if (hitedPlayer != null) {
                    Event event = new GameEvent(EventType.INCREMENT_HP, e.getSender(),
                            hitedPlayer.getName() + " -" + HIT_DECREMENT_HP_VALUE);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    hitedPlayer = null;
                    handleEvent(event);
                }
            } break;
            case INCREMENT_HP: {
                String[] values = e.getStringValue().split(" ");
                int leftHP = players.get(values[0]).changeHP(Integer.parseInt(values[1]));
                if (leftHP <= 0) {
                    GameEvent event = new GameEvent(EventType.KILLED, e.getSender(), values[0]);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    handleEvent(event);
                }
            } break;
            case KILLED: {
                System.out.printf("%s: %s killed %s%n", playerName, e.getSender(), e.getStringValue());
                rate.incScore(players.get(e.getSender()), 1);
                rate.incScore(players.get(e.getStringValue()), -1);
                GameEvent event = new GameEvent(EventType.REBORN,
                        e.getSender(), e.getStringValue());
                for (EventHandler h : handlers) {
                    h.handleEvent(event);
                }
                handleEvent(event);
            } break;
            case REBORN: {
                spawn(players.get(e.getStringValue()));
            } break;
            case JOIN_NEW_PLAYER: {
                String[] playerInfo = e.getStringValue().split(" ");
                int x = Integer.parseInt(playerInfo[0]);
                int y = Integer.parseInt(playerInfo[1]);
                Player newPlayer = new Player(x, y);
                newPlayer.setName(e.getSender());
                players.put(newPlayer.getName(), newPlayer);
                rate.addPlayer(newPlayer);
            } break;
            case MOVE_PLAYER: {
                if (p != currentPlayer && p != null) {
                    String[] pos = e.getStringValue().split(" ");
                    int x = Integer.parseInt(pos[0]);
                    int y = Integer.parseInt(pos[1]);
                    p.setX(x);
                    p.setY(y);
                }
            } break;
        }
    }
