13
0

Autostop
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-22 09:50:57 +01:00
Ursprung d3e937ec78
Commit 4f7ca74a43

Datei anzeigen

@ -19,8 +19,10 @@
package de.steamwar.tutorial.listener; package de.steamwar.tutorial.listener;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class Joining extends BasicListener { public class Joining extends BasicListener {
@ -28,4 +30,11 @@ public class Joining extends BasicListener {
public void onJoin(PlayerJoinEvent event) { public void onJoin(PlayerJoinEvent event) {
event.getPlayer().setOp(true); event.getPlayer().setOp(true);
} }
@EventHandler
public void onQuit(PlayerQuitEvent event) {
if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) {
Bukkit.shutdown();
}
}
} }