@Override
 public void afterReceive(JsonObject json, CommunicationChannel communicationChannel) {
   if (Game.hasFreeSlots()) {
     String response =
         MessageFactory.createJoinGameMessage(
             Game.getPlayers(),
             MultiplayerManager.getCurrentHostedGame().getName(),
             Game.getNextFreeSlot());
     communicationChannel.sendMessage(response);
   } else {
     String response = MessageFactory.createJoinRefuseGameMessage();
     communicationChannel.sendMessage(response);
   }
 }
예제 #2
0
 @Override
 public void execute() {
   if (!Game.checkCollision(getCharacter(), getCharacter().getX(), getCharacter().getY() + 1)) {
     getCharacter().startMovingToDown();
   }
 }