MCPcopy Create free account
hub / github.com/catabriga/graphwar / removePlayerMessage

Method removePlayerMessage

src/Graphwar/GameData.java:563–603  ·  view source on GitHub ↗
(String[] info)

Source from the content-addressed store, hash-verified

561 }
562
563 private void removePlayerMessage(String[] info) throws Exception
564 {
565 int playerID = Integer.parseInt(info[1]);
566
567 Player player = this.getPlayer(playerID);
568
569 ((PreGameScreen)graphwar.getUI().getScreen(Constants.PRE_GAME_SCREEN)).removePlayer(player);
570 ((PreGameScreen)graphwar.getUI().getScreen(Constants.PRE_GAME_SCREEN)).addChat(null,player.getName()+" has left the game.");
571
572 if(gameState == Constants.GAME)
573 {
574 if(players.get(currentTurn).getID() == player.getID() && this.drawingFunction==false)
575 {
576 nextTurn();
577 }
578
579 for(int i=0; i<player.getNumSoldiers(); i++)
580 {
581 if(player.getSoldiers()[i].isAlive())
582 {
583 player.getSoldiers()[i].setAlive(false);
584 player.getSoldiers()[i].setExploding(true);
585 }
586 }
587
588 player.markDisconnected();
589
590 ((GameScreen)graphwar.getUI().getScreen(Constants.GAME_SCREEN)).addChat(null,player.getName()+" has left the game.");
591
592 }
593 else
594 {
595 players.remove(player);
596 graphwar.getGlobalClient().sendRoomStatus();
597
598 if(checkHaveLocals() == false)
599 {
600 disconnectKick();
601 }
602 }
603 }
604
605 private boolean checkHaveLocals()
606 {

Callers 1

handleMessageMethod · 0.95

Calls 15

getPlayerMethod · 0.95
getNameMethod · 0.95
getIDMethod · 0.95
nextTurnMethod · 0.95
getNumSoldiersMethod · 0.95
getSoldiersMethod · 0.95
markDisconnectedMethod · 0.95
checkHaveLocalsMethod · 0.95
disconnectKickMethod · 0.95
getScreenMethod · 0.80
getUIMethod · 0.80
isAliveMethod · 0.80

Tested by

no test coverage detected