temp fly debug tool, game abandon bug fix

This commit is contained in:
Tyler Murphy 2022-05-12 08:10:43 -04:00
parent 7979185753
commit 853ca07431
2 changed files with 15 additions and 4 deletions

View file

@ -108,6 +108,14 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(AsyncPlayerChatEvent event){
if(event.getMessage().equals("fly")){
event.getPlayer().setAllowFlight(true);
event.getPlayer().setFlying(true);
}
if(event.getMessage().equals("no fly")){
event.getPlayer().setAllowFlight(false);
event.getPlayer().setFlying(false);
}
if(Board.isSeeker(event.getPlayer())){
event.setCancelled(true);
Board.getSpectators().forEach(spectator -> spectator.sendMessage(ChatColor.GRAY + "[SPECTATOR] " + event.getPlayer().getName() + ": " + event.getMessage()));

View file

@ -63,6 +63,8 @@ public class Game {
public static int timeLeft = 0;
public static Status status = Status.STANDBY;
private static boolean hiderLeave = false;
static {
worldLoader = new WorldLoader(spawnWorld);
}
@ -343,7 +345,7 @@ public class Game {
if(announceMessagesToNonPlayers) Bukkit.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);
hiderLeave = true;
}
Board.removeBoard(player);
Board.remove(player);
@ -397,7 +399,7 @@ public class Game {
}
private static void whileStarting(){
checkWinConditions(false);
checkWinConditions();
}
private static void whilePlaying() {
@ -439,10 +441,10 @@ public class Game {
if(tauntEnabled) taunt.update();
if (glowEnabled) glow.update();
}
checkWinConditions(false);
checkWinConditions();
}
private static void checkWinConditions(boolean hiderLeave){
private static void checkWinConditions(){
if(Board.sizeHider() < 1) {
if(hiderLeave){
if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT"));
@ -462,6 +464,7 @@ public class Game {
else broadcastMessage(gameoverPrefix + message("GAME_GAMEOVER_TIME"));
end(WinType.HIDER_WIN);
}
hiderLeave = false;
}
private static void sendHideCountdownMessage(String message, int gameId, int delay) {