the game will now create a new clg when entering the main view
This commit is contained in:
		@@ -76,6 +76,15 @@ private Piece getPiece(UUID pieceId) {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void clear(){
 | 
			
		||||
        game = new Game();
 | 
			
		||||
        notifications.clear();
 | 
			
		||||
        setState(dialogsState);
 | 
			
		||||
        isHost = false;
 | 
			
		||||
        ownPlayerID = 0;
 | 
			
		||||
        ownPlayerName = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method returns the clientSender
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -175,4 +175,16 @@ public void received(StartGameMessage msg, int from) {
 | 
			
		||||
            this.logic.getServerSender().send(from, new IncorrectRequestMessage(5));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Removed the player after receiving a LeaveGameMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg  as the message which was sent by the player as a LeaveGameMessage object.
 | 
			
		||||
     * @param from as the client id of the player as an Integer.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LeaveGameMessage msg, int from) {
 | 
			
		||||
        this.logic.getGame().removePlayer(from);
 | 
			
		||||
        this.logic.getServerSender().broadcast(new LobbyPlayerLeaveMessage(from));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -61,13 +61,13 @@ public void received(AnimationEndMessage msg, int from) {
 | 
			
		||||
        if (finishedAnimations.size() == logic.getGame().getPlayers().size()) {
 | 
			
		||||
            if (logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).isFinished()) {
 | 
			
		||||
                logic.getGame().getPlayerRanking().put(logic.getGame().getPlayerRanking().size(), logic.getGame().getActivePlayer());
 | 
			
		||||
                logic.getServerSender().send(logic.getGame().getPlayerIdByColor(logic.getGame().getActiveColor()), new SpectatorMessage());
 | 
			
		||||
                setActivePlayer(logic.getGame().getActiveColor());
 | 
			
		||||
                if (logic.getGame().getPlayerRanking().size() == logic.getGame().getPlayers().size() - 1) {
 | 
			
		||||
                    logic.getGame().getPlayerRanking().put(logic.getGame().getPlayerRanking().size(), logic.getGame().getActivePlayer());
 | 
			
		||||
                    logic.getGame().getPlayerRanking().put(logic.getGame().getPlayerRanking().size(), logic.getGame().getPlayerByColor(logic.getGame().getActiveColor().next(logic.getGame())));
 | 
			
		||||
                    logic.setCurrentState(logic.getCeremonyState());
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                logic.getServerSender().send(logic.getGame().getPlayerIdByColor(logic.getGame().getActiveColor()), new SpectatorMessage());
 | 
			
		||||
                setActivePlayer(logic.getGame().getActiveColor());
 | 
			
		||||
                this.turnAutomaton.getGameAutomaton().setCurrentState(this.turnAutomaton.getGameAutomaton().getTurnState());
 | 
			
		||||
            }
 | 
			
		||||
            else if (logic.getGame().getDiceEyes() == 6) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user