From a079b25c14813a39fa330dbd34762827f0b2681d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 19:08:09 +0200 Subject: [PATCH] Adjust config for new fight system Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ArenaMode.java | 21 ++++++++++++++----- .../steamwar/bungeecore/SubserverSystem.java | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index c007a86..19652ab 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -73,22 +73,29 @@ public class ArenaMode { private final String internalName; private final String displayName; + private final String folder; private final List chatNames; private final String serverJar; private final List maps; private final boolean historic; + private final boolean ranked; private final String schemType; private ArenaMode(String internalName, Configuration config){ this.internalName = internalName; - this.displayName = config.getString("displayName"); + this.folder = config.getString("folder"); this.serverJar = config.getString("serverJar"); - this.chatNames = config.getStringList("chatNames"); this.maps = config.getStringList("maps"); + this.displayName = config.getString("displayName", internalName); + if(config.contains("chatNames")) + this.chatNames = config.getStringList("chatNames"); + else + this.chatNames = Collections.emptyList(); this.historic = config.getBoolean("historic", false); + this.schemType = config.getString("schemType", "").toLowerCase(); + this.ranked = config.getBoolean("ranked", false); - this.schemType = config.getString("schemType", null); allModes.add(this); byInternal.put(internalName, this); @@ -96,8 +103,8 @@ public class ArenaMode { byChat.put(name.toLowerCase(), this); } - if(config.contains("checkSchemType")) - byCheckSchemType.put(config.getString("checkSchemType").toLowerCase(), this); + if(!this.schemType.equals("")) + byCheckSchemType.put(this.schemType, this); } public String getInternalName() { @@ -120,6 +127,10 @@ public class ArenaMode { return null; } + public String getFolder() { + return folder; + } + public String getRandomMap(){ return maps.get(random.nextInt(maps.size())); } diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index 50d5552..3613feb 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -108,7 +108,7 @@ public class SubserverSystem { //Copy world try { - new ProcessBuilder("cp", "-r", SERVER_PATH + modus.getInternalName() + "/" + map, worldDir + mapName).start().waitFor(); + new ProcessBuilder("cp", "-r", SERVER_PATH + modus.getFolder() + "/" + map, worldDir + mapName).start().waitFor(); } catch (IOException | InterruptedException e) { throw new SecurityException("Could not copy folder", e); }