Some fixes (Concurrent List GUI)
This commit is contained in:
@@ -120,33 +120,17 @@ public class ServerLauncher {
|
||||
Game game=gameController.getModel();
|
||||
if(!event.getIsError())
|
||||
{
|
||||
if(game.getCurrentState().getGameStage().equals(GameStages.ENDED))
|
||||
if(event.getEventType().equals(EventType.DISCONNECTED_PLAYER)&& game.getCurrentState().getGameStage().equals(GameStages.WAITING))
|
||||
{
|
||||
actionQueue.offer(new EndedGame(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(),game.getPlayerStanding()));
|
||||
}
|
||||
else {
|
||||
if(event.getEventType().equals(EventType.DISCONNECTED_PLAYER)&& game.getCurrentState().getGameStage().equals(GameStages.WAITING))
|
||||
{
|
||||
playerList.remove(event.getUsername());
|
||||
}else {
|
||||
event.setData(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(), game.getPlayerByUsername(event.getUsername()));
|
||||
if (event.getEventType().equals(EventType.TOTEM_CHOICE)) {
|
||||
((TotemChoice) event).setAvailableTotems(gameController.getModel().getAvailableTotems());
|
||||
} else if (event.getEventType().equals(EventType.DISCONNECTED_PLAYER) && game.getCurrentState().equals(GameStages.WAITING)) {
|
||||
playerList.remove(event.getUsername());
|
||||
}else {
|
||||
event.setData(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(), game.getPlayerByUsername(event.getUsername()));
|
||||
if (event.getEventType().equals(EventType.TOTEM_CHOICE)) {
|
||||
((TotemChoice) event).setAvailableTotems(gameController.getModel().getAvailableTotems());
|
||||
} else if (event.getEventType().equals(EventType.DISCONNECTED_PLAYER) && game.getCurrentState().equals(GameStages.WAITING)) {
|
||||
playerList.remove(event.getUsername());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
serverRMI.notifyAll(event);
|
||||
serverTCP.notifyAll(event);
|
||||
if(game.getCurrentState().getRound()!=roundPrev)
|
||||
{
|
||||
ApplyNextRound nextRound=new ApplyNextRound(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(),game.getPlayers());
|
||||
serverRMI.notifyAll(nextRound);
|
||||
serverTCP.notifyAll(nextRound);
|
||||
}
|
||||
if(!event.getIsError()){
|
||||
if(game.getCurrentState().getGameStage() == GameStages.ENDED){
|
||||
if(!this.deleteSave()){
|
||||
System.out.println("\n!!! Couldn't delete save !!!\n");
|
||||
@@ -162,6 +146,19 @@ public class ServerLauncher {
|
||||
System.out.println("\n!!! Save failed !!!\n");
|
||||
}
|
||||
}
|
||||
serverRMI.notifyAll(event);
|
||||
serverTCP.notifyAll(event);
|
||||
if(game.getCurrentState().getRound()!=roundPrev)
|
||||
{
|
||||
ApplyNextRound nextRound=new ApplyNextRound(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(),game.getPlayers());
|
||||
serverRMI.notifyAll(nextRound);
|
||||
serverTCP.notifyAll(nextRound);
|
||||
}
|
||||
else if(game.getCurrentState().getGameStage().equals(GameStages.ENDED))
|
||||
{
|
||||
serverRMI.notifyAll(new EndedGame(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(),game.getPlayerStanding()));
|
||||
serverTCP.notifyAll(new EndedGame(game.getSlotMap(), game.orderLogicCard, game.getCurrentState(),game.getPlayerStanding()));
|
||||
}
|
||||
if (event.getEventType().equals(EventType.DISCONNECTED_PLAYER) && playerList.values().stream().filter(x -> x).count() == 1&& game.getCurrentState().getGameStage() != GameStages.ENDED) {
|
||||
if (disconnectionTimer != null && !disconnectionTimer.isDone()) {
|
||||
disconnectionTimer.cancel(false);
|
||||
@@ -246,7 +243,8 @@ public class ServerLauncher {
|
||||
launcher.run();
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("Generic exception occurred"+e.getMessage());
|
||||
System.out.println("Generic exception occurred");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user