diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 3fcf78c..72b387b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -18,6 +18,7 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitTask; import java.io.File; import java.io.IOException; @@ -32,6 +33,8 @@ public class BauSystem extends JavaPlugin implements Listener { public static final String PREFIX = "§eBauSystem§8» §7"; public static final String SECTION_PATH = "/home/minecraft/backbone/server/UserBau/"; + private BukkitTask autoShutdown; + @Override public void onEnable() { plugin = this; @@ -87,6 +90,8 @@ public class BauSystem extends JavaPlugin implements Listener { Bukkit.getPluginManager().registerEvents(new RegionListener(), this); Bukkit.getPluginManager().registerEvents(new TNTListener(), this); Bukkit.getPluginManager().registerEvents(new BauScoreboard(), this); + + autoShutdown = Bukkit.getScheduler().runTaskLater(this, Bukkit::shutdown, 1200); } public static BauSystem getPlugin(){ @@ -109,6 +114,11 @@ public class BauSystem extends JavaPlugin implements Listener { @EventHandler public void onJoin(PlayerLoginEvent e) { + if(autoShutdown != null){ + autoShutdown.cancel(); + autoShutdown = null; + } + Player p = e.getPlayer(); PermissionAttachment attachment = p.addAttachment(this); attachment.setPermission("F3NPerm.use", true);