make sure hider leaving doesnt create win condition
This commit is contained in:
parent
7eb687a26c
commit
7979185753
3 changed files with 17 additions and 6 deletions
|
@ -342,6 +342,9 @@ public class Game {
|
||||||
}
|
}
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
|
||||||
else Game.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
|
else Game.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
|
||||||
|
if(Board.isHider(player) && status != Status.ENDING && status != Status.STANDBY){
|
||||||
|
checkWinConditions(true);
|
||||||
|
}
|
||||||
Board.removeBoard(player);
|
Board.removeBoard(player);
|
||||||
Board.remove(player);
|
Board.remove(player);
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
|
@ -394,7 +397,7 @@ public class Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void whileStarting(){
|
private static void whileStarting(){
|
||||||
checkWinConditions();
|
checkWinConditions(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void whilePlaying() {
|
private static void whilePlaying() {
|
||||||
|
@ -436,14 +439,20 @@ public class Game {
|
||||||
if(tauntEnabled) taunt.update();
|
if(tauntEnabled) taunt.update();
|
||||||
if (glowEnabled) glow.update();
|
if (glowEnabled) glow.update();
|
||||||
}
|
}
|
||||||
checkWinConditions();
|
checkWinConditions(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkWinConditions(){
|
private static void checkWinConditions(boolean hiderLeave){
|
||||||
if(Board.sizeHider() < 1) {
|
if(Board.sizeHider() < 1) {
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
if(hiderLeave){
|
||||||
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
||||||
|
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
|
||||||
|
end(WinType.NONE);
|
||||||
|
} else {
|
||||||
|
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
||||||
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND"));
|
||||||
end(WinType.SEEKER_WIN);
|
end(WinType.SEEKER_WIN);
|
||||||
|
}
|
||||||
} else if(Board.sizeSeeker() < 1) {
|
} else if(Board.sizeSeeker() < 1) {
|
||||||
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT"));
|
||||||
|
|
|
@ -15,6 +15,7 @@ Localization:
|
||||||
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden und ist nun ein Seeker."
|
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden und ist nun ein Seeker."
|
||||||
GAME_GAMEOVER_HIDERS_FOUND: "Alle Hider wurden gefunden."
|
GAME_GAMEOVER_HIDERS_FOUND: "Alle Hider wurden gefunden."
|
||||||
GAME_GAMEOVER_SEEKERS_QUIT: "All Seeker haben das Spiel verlassen."
|
GAME_GAMEOVER_SEEKERS_QUIT: "All Seeker haben das Spiel verlassen."
|
||||||
|
GAME_GAMEOVER_HIDERS_QUIT: "All Hider haben das Spiel verlassen."
|
||||||
GAME_GAMEOVER_TIME: "Seekers haben keine Spielzeit mehr. Die Hiders haben gewonnen!"
|
GAME_GAMEOVER_TIME: "Seekers haben keine Spielzeit mehr. Die Hiders haben gewonnen!"
|
||||||
GAME_SETUP: "Spiel wurde noch nicht eingerichtet. Führe &c/hs setup&f aus, um die Einrichtungsschritte zu sehen."
|
GAME_SETUP: "Spiel wurde noch nicht eingerichtet. Führe &c/hs setup&f aus, um die Einrichtungsschritte zu sehen."
|
||||||
GAME_INGAME: "Du bist bereits in der Lobby oder im Spiel."
|
GAME_INGAME: "Du bist bereits in der Lobby oder im Spiel."
|
||||||
|
|
|
@ -15,6 +15,7 @@ Localization:
|
||||||
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker."
|
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker."
|
||||||
GAME_GAMEOVER_HIDERS_FOUND: "All hiders have been found."
|
GAME_GAMEOVER_HIDERS_FOUND: "All hiders have been found."
|
||||||
GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit."
|
GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit."
|
||||||
|
GAME_GAMEOVER_HIDERS_QUIT: "All hiders have quit."
|
||||||
GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!"
|
GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!"
|
||||||
GAME_SETUP: "Game is not setup. Run /hs setup to see what you need to do."
|
GAME_SETUP: "Game is not setup. Run /hs setup to see what you need to do."
|
||||||
GAME_INGAME: "You are already in the lobby/game."
|
GAME_INGAME: "You are already in the lobby/game."
|
||||||
|
|
Loading…
Reference in a new issue