From 77b066b3876244fe6d0c8f085997f723ebee3143 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 17 Aug 2023 15:51:23 +0200 Subject: [PATCH] Fixes... --- src/TowerRun.properties | 1 + src/TowerRun_de.properties | 1 + src/de/steamwar/towerrun/TowerRun.java | 2 +- src/de/steamwar/towerrun/game/TowerRunGame.java | 7 +++++++ .../towerrun/winconditions/LastOutsideWincondition.java | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/TowerRun.properties b/src/TowerRun.properties index d441ca5..1598692 100644 --- a/src/TowerRun.properties +++ b/src/TowerRun.properties @@ -27,5 +27,6 @@ GAME_WAITING= SERVER_STOPPING=§cThe server stops in §e{0}s§8! KEY_NAME=§eKey KEY_FOUND=§a{0} §7found a key§8! +GAME_TIE=§aThe game ended in a tie§8! COMMAND_START=§aThe game will start soon§8! \ No newline at end of file diff --git a/src/TowerRun_de.properties b/src/TowerRun_de.properties index 24dc10f..613a86d 100644 --- a/src/TowerRun_de.properties +++ b/src/TowerRun_de.properties @@ -23,6 +23,7 @@ GAME_WIN= GAME_STARTING=§7Das Spiel startet in §e{0}s§8! GAME_WAITING=§7Warte auf weitere Spieler§8... SERVER_STOPPING=§cDer Server stoppt in §e{0}s§8! +GAME_TIE=§7Keiner hat gewonnen§8! KEY_NAME=§eSchlüssel KEY_FOUND=§a{0} §7hat einen Schlüssel gefunden§8! diff --git a/src/de/steamwar/towerrun/TowerRun.java b/src/de/steamwar/towerrun/TowerRun.java index e92e4a3..d126d31 100644 --- a/src/de/steamwar/towerrun/TowerRun.java +++ b/src/de/steamwar/towerrun/TowerRun.java @@ -34,7 +34,7 @@ import org.bukkit.plugin.java.annotation.plugin.Description; import org.bukkit.plugin.java.annotation.plugin.Plugin; import org.bukkit.plugin.java.annotation.plugin.author.Author; -@Plugin(name = "TowerRun", version = "0.0.1") +@Plugin(name = "TowerRun", version = "1.0.0") @Dependency(value = "SpigotCore") @Dependency(value = "WorldEdit") @Author(value = "YoyoNow") diff --git a/src/de/steamwar/towerrun/game/TowerRunGame.java b/src/de/steamwar/towerrun/game/TowerRunGame.java index a75df1d..de56c26 100644 --- a/src/de/steamwar/towerrun/game/TowerRunGame.java +++ b/src/de/steamwar/towerrun/game/TowerRunGame.java @@ -74,6 +74,13 @@ public class TowerRunGame { PLAYERS_ESCAPED.remove(towerRunPlayer); } + public static void tie() { + Bukkit.getOnlinePlayers().forEach(player -> player.setGameMode(GameMode.SPECTATOR)); + PLAYERS_ALIVE.clear(); + Bukkit.getOnlinePlayers().forEach(player -> player.sendTitle(TowerRun.getMessage().parse("GAME_TIE", player), "", 10, 70, 20)); + GameState.nextState(); + } + public static void win(TowerRunPlayer tPlayer) { Bukkit.getOnlinePlayers().forEach(player -> player.setGameMode(GameMode.SPECTATOR)); PLAYERS_ALIVE.clear(); diff --git a/src/de/steamwar/towerrun/winconditions/LastOutsideWincondition.java b/src/de/steamwar/towerrun/winconditions/LastOutsideWincondition.java index 71e7a4d..580f5b4 100644 --- a/src/de/steamwar/towerrun/winconditions/LastOutsideWincondition.java +++ b/src/de/steamwar/towerrun/winconditions/LastOutsideWincondition.java @@ -42,6 +42,10 @@ public class LastOutsideWincondition extends OutsideWincondition{ @EventHandler public void onPlayerDeath(PlayerDeathEvent event) { if(TowerRunGame.PLAYERS_ALIVE.isEmpty()) { + if(TowerRunGame.PLAYERS_ESCAPED.isEmpty()) { + TowerRunGame.tie(); + return; + } TowerRunGame.win(TowerRunGame.PLAYERS_ESCAPED.get(TowerRunGame.PLAYERS_ESCAPED.size() - 1)); } }