From 864c51c3d9c27c4fd02873ada8fab5b81b1a11b2 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 19 Dec 2021 16:50:29 +0100 Subject: [PATCH] Prevent arena start dos Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/BauCommand.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 27d8d215..37955184 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -247,7 +247,6 @@ public class BauCommand extends BasicCommand { } private static void deleteWorld(ProxiedPlayer player, String world) { - Message.send("BAU_DELETE_DELETED", player); ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { for (Subserver subserver : Subserver.getServerList()) { if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(player.getUniqueId())) { @@ -256,16 +255,20 @@ public class BauCommand extends BasicCommand { } } SubserverSystem.deleteFolder(Node.local, world); + Message.send("BAU_DELETE_DELETED", player); }); } public static boolean stopBauserver(ProxiedPlayer p){ + for (Subserver subserver : Subserver.getServerList()) { + if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId()) && !subserver.hasStarted()) { + Message.send("BAU_START_ALREADY", p); + return false; + } + } + for (Subserver subserver : Subserver.getServerList()) { if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { - if(!subserver.hasStarted()){ - Message.send("BAU_START_ALREADY", p); - return false; - } subserver.stop(); try { Thread.sleep(200); // Wait until possible testarena-World has been deleted