1.4.0 hotfix

This commit is contained in:
Tyler Murphy 2022-04-13 14:50:04 -04:00
parent 44040cc87b
commit 2746ac923b
4 changed files with 16 additions and 13 deletions

View file

@ -110,7 +110,6 @@ public class Config {
config = new ConfigManager("config.yml"); config = new ConfigManager("config.yml");
config.saveConfig(); config.saveConfig();
leaderboard = new ConfigManager("leaderboard.yml"); leaderboard = new ConfigManager("leaderboard.yml");
leaderboard.saveConfig();
//Spawn //Spawn
spawnPosition = new Vector( spawnPosition = new Vector(

View file

@ -212,7 +212,7 @@ public class ConfigManager {
String yamlString = textBuilder.toString(); String yamlString = textBuilder.toString();
Map<String, Object> temp = config.getValues(true); Map<String, Object> temp = config.getValues(true);
for(Map.Entry<String, Object> entry: temp.entrySet()){ for(Map.Entry<String, Object> 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("\\."); String[] parts = entry.getKey().split("\\.");
int index = 0; int index = 0;
int i = 0; int i = 0;
@ -230,7 +230,17 @@ public class ConfigManager {
int start = yamlString.indexOf(' ', index); int start = yamlString.indexOf(' ', index);
int end = yamlString.indexOf('\n', index); int end = yamlString.indexOf('\n', index);
if(end == -1) end = yamlString.length(); if(end == -1) end = yamlString.length();
String replace = entry.getValue().toString(); String replace;
if(entry.getValue() instanceof List){
replace = "[";
for(Object o : (List<Object>)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){ if(entry.getValue() instanceof String){
replace = "\"" + replace + "\""; replace = "\"" + replace + "\"";
} }

View file

@ -259,10 +259,10 @@ public class EventListener implements Listener {
String[] temp = array[0].split(":"); String[] temp = array[0].split(":");
for(String handle : blockedCommands){ for(String handle : blockedCommands){
if( if(
array[0].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) && array[0].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) ||
temp[temp.length-1].substring(1).equalsIgnoreCase(handle) && Board.isPlayer(player) && temp[temp.length-1].equalsIgnoreCase(handle) && Board.isPlayer(player)
Game.status != Status.STANDBY
) { ) {
if(Game.status == Status.STANDBY) return;
player.sendMessage(errorPrefix + message("BLOCKED_COMMAND")); player.sendMessage(errorPrefix + message("BLOCKED_COMMAND"));
event.setCancelled(true); event.setCancelled(true);
break; break;

View file

@ -120,13 +120,7 @@ locale: "en-US"
# Not really usefully if using permission plugins. # Not really usefully if using permission plugins.
# You can add /kill for any use, but it's already blocked on those # You can add /kill for any use, but it's already blocked on those
# playing the game. # playing the game.
blockedCommands: blockedCommands: [msg, tp, gamemode, kill, give, effect]
- msg
- tp
- gamemode
- kill
- give
- effect
# ---------------------------------------------------------- # # ---------------------------------------------------------- #
# ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING # # ONLY EDIT BEYOND THIS POINT IF YOU KNOW WHAT YOU ARE DOING #