geforkt von SteamWar/BungeeCore
Deny launching multiple bauservers
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
7bd15ec63f
Commit
b604222450
@ -261,12 +261,12 @@ public class BauCommand extends BasicCommand {
|
||||
});
|
||||
}
|
||||
|
||||
public static void stopBauserver(ProxiedPlayer p){
|
||||
public static boolean stopBauserver(ProxiedPlayer p){
|
||||
for (Subserver subserver : Subserver.getServerList()) {
|
||||
if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) {
|
||||
if(subserver.getServer().getPlayers().isEmpty()){
|
||||
if(!subserver.hasStarted()){
|
||||
Message.send("BAU_START_ALREADY", p);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
subserver.stop();
|
||||
try {
|
||||
@ -277,11 +277,12 @@ public class BauCommand extends BasicCommand {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void testarena(ProxiedPlayer p, String[] args){
|
||||
FightCommand.createArena(p, "/bau testarena ", args, 1, false, (player, mode, map) -> ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
|
||||
stopBauserver(p);
|
||||
if(stopBauserver(p))
|
||||
SubserverSystem.startTestServer(p, mode, map, 0, 0);
|
||||
}));
|
||||
}
|
||||
|
@ -234,7 +234,10 @@ public class CheckCommand extends BasicCommand {
|
||||
this.checkList = checkQuestions.get(schematic.getSchemType()).listIterator();
|
||||
|
||||
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
|
||||
BauCommand.stopBauserver(checker);
|
||||
if(!BauCommand.stopBauserver(checker)){
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
ArenaMode mode = ArenaMode.getBySchemType(schematic.getSchemType().fightType());
|
||||
SubserverSystem.startTestServer(checker, mode, FightCommand.getMap(checker, mode, "Random"), schematic.getSchemID(), 0);
|
||||
@ -323,8 +326,7 @@ public class CheckCommand extends BasicCommand {
|
||||
}
|
||||
|
||||
private void stop(){
|
||||
currentCheckers.remove(checker.getUniqueId());
|
||||
currentSchems.remove(schematic.getSchemID());
|
||||
remove();
|
||||
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
|
||||
for (Subserver subserver : Subserver.getServerList()) {
|
||||
if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(checker.getUniqueId())) {
|
||||
@ -334,5 +336,10 @@ public class CheckCommand extends BasicCommand {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void remove() {
|
||||
currentCheckers.remove(checker.getUniqueId());
|
||||
currentSchems.remove(schematic.getSchemID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren