From c0665b1868f7de77e53ab4f85f950f0d55682fc8 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 1 Dec 2023 18:03:09 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20non=20lower=20case=20SchematicType=20from?= =?UTF-8?q?DB=20lookup=20Fix=20RankedEvent=20not=20being=20considered=20f?= =?UTF-8?q?=C3=BCr=20ignore=20publics=20only=20Fix=20using=20index=200=20i?= =?UTF-8?q?nstead=20of=20i=20for=20creating=20of=20gui=20Fix=20config.yml?= =?UTF-8?q?=20missing=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FightSystem_Core/src/config.yml | 1 + FightSystem_Core/src/de/steamwar/fightsystem/Config.java | 4 ++-- .../src/de/steamwar/fightsystem/commands/GUI.java | 2 +- FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/FightSystem_Core/src/config.yml b/FightSystem_Core/src/config.yml index 6b0c977..408c546 100644 --- a/FightSystem_Core/src/config.yml +++ b/FightSystem_Core/src/config.yml @@ -61,6 +61,7 @@ Schematic: z: 0 # The schematic type that can be chosen in this arena Type: Normal # defaults to Normal if missing + # The schematic types that are also allowed to be chosen in this arena SubTypes: [] # defaults to empty List # Shortcut of the schematic type Shortcut: "" # defaults to "" if missing diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java index 816fefb..b48186e 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java @@ -178,8 +178,8 @@ public class Config { int schemsizeY = config.getInt("Schematic.Size.y"); int schemsizeZ = config.getInt("Schematic.Size.z"); RanksEnabled = !config.getStringList("Ranks").isEmpty(); - SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.Type", "normal"))); - SubTypes = config.getStringList("Schematic.SubTypes").stream().map(de.steamwar.sql.SchematicType::fromDB).collect(Collectors.toList()); + SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.Type", "normal").toLowerCase())); + SubTypes = config.getStringList("Schematic.SubTypes").stream().map(String::toLowerCase).map(de.steamwar.sql.SchematicType::fromDB).collect(Collectors.toList()); IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly", false); boolean rotate = config.getBoolean("Schematic.Rotate", true); PasteAligned = config.getBoolean("Schematic.PasteAligned", false); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java index 612bdab..b405872 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java @@ -172,7 +172,7 @@ public class GUI { SWInventory inv = new SWInventory(p, invSize, msg.parse("SCHEM_TITLE", p, Config.GameName)); setupSchemTypeRow(p, inv, Config.SchematicType, 0); for (int i = 0; i < Config.SubTypes.size(); i++) { - setupSchemTypeRow(p, inv, Config.SubTypes.get(0), i + 1); + setupSchemTypeRow(p, inv, Config.SubTypes.get(i), i + 1); } inv.setCallback(-999, (ClickType click) -> p.closeInventory()); inv.open(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java index defed4c..9f7f649 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java @@ -143,7 +143,7 @@ public class Fight { if (Config.OnlyPublicSchematics) { return true; } - if (Config.IgnorePublicOnly) { + if (Config.IgnorePublicOnly || ArenaMode.RankedEvent.contains(Config.mode)) { return false; } return redTeam.isPublicsOnly() || blueTeam.isPublicsOnly();