From 2746ac923bf6e68b4b8129990449b1551773c016 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Wed, 13 Apr 2022 14:50:04 -0400 Subject: [PATCH] 1.4.0 hotfix --- .../hideAndSeek/configuration/Config.java | 1 - .../hideAndSeek/configuration/ConfigManager.java | 14 ++++++++++++-- .../hideAndSeek/game/EventListener.java | 6 +++--- src/main/resources/config.yml | 8 +------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index 5213f5d..f18ec5f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -110,7 +110,6 @@ public class Config { config = new ConfigManager("config.yml"); config.saveConfig(); leaderboard = new ConfigManager("leaderboard.yml"); - leaderboard.saveConfig(); //Spawn spawnPosition = new Vector( diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java index 66073cd..8b85ae6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java @@ -212,7 +212,7 @@ public class ConfigManager { String yamlString = textBuilder.toString(); Map temp = config.getValues(true); for(Map.Entry entry: temp.entrySet()){ - if(entry.getValue() instanceof Integer || entry.getValue() instanceof Double || entry.getValue() instanceof String || entry.getValue() instanceof Boolean){ + if(entry.getValue() instanceof Integer || entry.getValue() instanceof Double || entry.getValue() instanceof String || entry.getValue() instanceof Boolean || entry.getValue() instanceof List){ String[] parts = entry.getKey().split("\\."); int index = 0; int i = 0; @@ -230,7 +230,17 @@ public class ConfigManager { int start = yamlString.indexOf(' ', index); int end = yamlString.indexOf('\n', index); if(end == -1) end = yamlString.length(); - String replace = entry.getValue().toString(); + String replace; + if(entry.getValue() instanceof List){ + replace = "["; + for(Object o : (List)entry.getValue()){ + replace = replace + o.toString() + ", "; + } + replace = replace.substring(0, replace.length()-2); + replace = replace + "]"; + } else { + replace = entry.getValue().toString(); + } if(entry.getValue() instanceof String){ replace = "\"" + replace + "\""; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java index ffe452b..0c84058 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java @@ -259,10 +259,10 @@ public class EventListener implements Listener { String[] temp = array[0].split(":"); for(String handle : blockedCommands){ if( - array[0].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) && - temp[temp.length-1].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) && - Game.status != Status.STANDBY + array[0].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) || + temp[temp.length-1].equalsIgnoreCase(handle) && Board.isPlayer(player) ) { + if(Game.status == Status.STANDBY) return; player.sendMessage(errorPrefix + message("BLOCKED_COMMAND")); event.setCancelled(true); break; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6c239fb..8482cf8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -120,13 +120,7 @@ locale: "en-US" # Not really usefully if using permission plugins. # You can add /kill for any use, but it's already blocked on those # playing the game. -blockedCommands: - - msg - - tp - - gamemode - - kill - - give - - effect +blockedCommands: [msg, tp, gamemode, kill, give, effect] # ---------------------------------------------------------- # # ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #