Archiviert
13
0

Shutdown Server when Empty
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2023-08-31 13:43:50 +02:00
Ursprung 0306500466
Commit 09f315f8b5
Signiert von: Chaoscaot
GPG-Schlüssel-ID: BDF8FADD7D5EDB7A

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.towerrun.game.TowerRunGame;
import de.steamwar.towerrun.game.TowerRunPlayer; import de.steamwar.towerrun.game.TowerRunPlayer;
import de.steamwar.towerrun.state.GameStateBukkitListener; import de.steamwar.towerrun.state.GameStateBukkitListener;
import de.steamwar.towerrun.state.GameStates; import de.steamwar.towerrun.state.GameStates;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -48,6 +49,10 @@ public class GlobalListener extends GameStateBukkitListener {
TowerRunGame.remove(TowerRunPlayer.get(event.getPlayer())); TowerRunGame.remove(TowerRunPlayer.get(event.getPlayer()));
} }
TowerRunPlayer.remove(event.getPlayer()); TowerRunPlayer.remove(event.getPlayer());
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().stream().allMatch(player -> player == event.getPlayer()))) {
Bukkit.shutdown();
}
} }
@EventHandler @EventHandler