Archiviert
1
0

Merge pull request 'Prevent starting multiple baus at once' (#295) from multiBauStart into master

Reviewed-on: SteamWar/BungeeCore#295
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2022-01-19 20:41:29 +01:00
Commit bf97d889a5

Datei anzeigen

@ -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()) { for (Subserver subserver : Subserver.getServerList()) {
if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId()) && !subserver.hasStarted()) { if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId()) && !subserver.hasStarted()) {
Message.send("BAU_START_ALREADY", p); 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()) { 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(); subserver.stop();
try { try {
Thread.sleep(200); // Wait until possible testarena-World has been deleted Thread.sleep(200); // Wait until possible testarena-World has been deleted
@ -278,7 +284,8 @@ public class BauCommand extends BasicCommand {
break; break;
} }
} }
return true;
return !startingBau(p);
} }
private static void testarena(ProxiedPlayer p, String[] args){ private static void testarena(ProxiedPlayer p, String[] args){