summaryrefslogtreecommitdiff
path: root/backend/src/main/java
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-05-11 19:47:49 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-05-12 00:13:57 +0200
commitb494d2d141a942b0905ac46a551ff42878f0f081 (patch)
tree18d94a3e86d0749f013075a110d6c43efaa782de /backend/src/main/java
parentAdd time limit setting (diff)
downloadseven-wonders-b494d2d141a942b0905ac46a551ff42878f0f081.tar.gz
seven-wonders-b494d2d141a942b0905ac46a551ff42878f0f081.tar.bz2
seven-wonders-b494d2d141a942b0905ac46a551ff42878f0f081.zip
First attempt at lobby joining
Diffstat (limited to 'backend/src/main/java')
-rw-r--r--backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java
index 8680b00e..4c8891cb 100644
--- a/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java
+++ b/backend/src/main/java/org/luxons/sevenwonders/controllers/GameController.java
@@ -15,7 +15,6 @@ import org.luxons.sevenwonders.repositories.PlayerRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;
@@ -38,15 +37,16 @@ public class GameController {
@ApiMethod(description = "Prepares the user's next move. When all players have prepared their moves, all moves "
+ "are executed.")
- @MessageMapping("/game/{gameId}/prepare")
- public void prepareMove(@DestinationVariable long gameId, PrepareMoveAction action, Principal principal) {
+ @MessageMapping("/game/prepareMove")
+ public void prepareMove(PrepareMoveAction action, Principal principal) {
Player player = playerRepository.find(principal.getName());
Game game = player.getGame();
CardBack preparedCardBack = game.prepareMove(player.getIndex(), action.getMove());
PreparedCard preparedCard = new PreparedCard(player, preparedCardBack);
- logger.info("Game '{}': player {} prepared move {}", gameId, principal.getName(), action.getMove());
+ logger.info("Game '{}': player {} prepared move {}", game.getId(), principal.getName(), action.getMove());
if (game.areAllPlayersReady()) {
+ logger.info("Game '{}': all players have prepared their move, executing turn...", game.getId());
game.playTurn();
sendTurnInfo(player.getLobby(), game);
} else {
bgstack15