From 9e579ee3d69107ccdd0010d17ff5c3c68c27e84d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 9 Sep 2022 16:11:34 +0200 Subject: [PATCH] Hotfix case sensitive maps --- src/de/steamwar/bungeecore/ArenaMode.java | 6 ++++++ src/de/steamwar/bungeecore/commands/TypeMappers.java | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index 9057691..abb6b77 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -94,6 +94,7 @@ public class ArenaMode { private final String serverJar; private final String config; private final List maps; + private final Map lowerToRealMapNames = new HashMap<>(); private final boolean historic; private final String internalName; @@ -106,6 +107,7 @@ public class ArenaMode { this.serverJar = config.getString("Server.ServerJar"); this.config = internalName + ".yml"; this.maps = config.getStringList("Server.Maps"); + maps.forEach(map -> lowerToRealMapNames.put(map.toLowerCase(), map)); this.displayName = config.getString("GameName", internalName); this.chatNames = config.getStringList("Server.ChatNames"); this.schemType = config.getString("Schematic.Type", "").toLowerCase(); @@ -155,6 +157,10 @@ public class ArenaMode { return maps; } + public String convertToRealMapName(String map){ + return lowerToRealMapNames.get(map.toLowerCase()); + } + public String getChatName(){ return chatNames.get(0); } diff --git a/src/de/steamwar/bungeecore/commands/TypeMappers.java b/src/de/steamwar/bungeecore/commands/TypeMappers.java index 94b27e4..97c510b 100644 --- a/src/de/steamwar/bungeecore/commands/TypeMappers.java +++ b/src/de/steamwar/bungeecore/commands/TypeMappers.java @@ -80,8 +80,7 @@ public class TypeMappers { if (previousArguments.length == 0) return null; if (s.equalsIgnoreCase("random")) return "random"; ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]); - if (arenaMode.getMaps().contains(s)) return s; - return null; + return arenaMode.convertToRealMapName(s); } @Override