From 7f196f0801afc2bae984f986b812ddc66f05e31d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 14 Jan 2022 14:35:21 +0100 Subject: [PATCH] Prevent starting multiple baus at once Signed-off-by: Lixfel --- .../steamwar/bungeecore/commands/BauCommand.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 37955184..11da6847 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -259,16 +259,22 @@ public class BauCommand extends BasicCommand { }); } - public static boolean stopBauserver(ProxiedPlayer p){ + private static boolean startingBau(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; + return true; } } + return false; + } + + public static boolean stopBauserver(ProxiedPlayer p){ + if(startingBau(p)) + return false; for (Subserver subserver : Subserver.getServerList()) { - if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { + if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId()) && subserver.hasStarted()) { subserver.stop(); try { Thread.sleep(200); // Wait until possible testarena-World has been deleted @@ -278,7 +284,8 @@ public class BauCommand extends BasicCommand { break; } } - return true; + + return !startingBau(p); } private static void testarena(ProxiedPlayer p, String[] args){