diff --git a/changelog.md b/changelog.md index 6bddabc..999ea81 100644 --- a/changelog.md +++ b/changelog.md @@ -18,6 +18,7 @@ These changes will (most likely) be included in the next version. - The Root Target ability now uses potion effects (slowness, slow falling, and negative jump boost) instead of repeated teleports. This should make for a smoother root experience. - Config-files with missing `pet-items` nodes no longer errors. A missing `pet-items` node in `global-settings` is treated as empty, i.e. no pet items will be registered. - The `player-time-in-arena` setting has been fixed. +- Config-file errors imposed by incorrect usage of `/ma setting` no longer cause "internal errors". Instead, the errors are properly communicated in the command output similar to how the `/ma reload` command works. ## [0.104.2] - 2020-01-03 - The region overlap check now works across both arena and lobby regions, i.e. all four combinations of intersections between two regions (arena-arena, arena-lobby, lobby-arena, and lobby-lobby) are evaluated. diff --git a/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java b/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java index 37104e5..84d81b3 100644 --- a/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java +++ b/src/main/java/com/garbagemule/MobArena/commands/setup/SettingCommand.java @@ -1,5 +1,6 @@ package com.garbagemule.MobArena.commands.setup; +import com.garbagemule.MobArena.ConfigError; import com.garbagemule.MobArena.commands.Command; import com.garbagemule.MobArena.commands.CommandInfo; import com.garbagemule.MobArena.framework.Arena; @@ -89,7 +90,13 @@ public class SettingCommand implements Command { // Save config-file and reload arena am.saveConfig(); - am.reloadArena(args[0]); + try { + am.reloadArena(args[0]); + } catch (ConfigError e) { + am.getGlobalMessenger().tell(sender, "Failed to reload arena after changing setting, reason:\n" + ChatColor.RED + e.getMessage()); + am.getGlobalMessenger().tell(sender, "Fix the error in your config-file, then run " + ChatColor.YELLOW + "/ma reload"); + return true; + } // Notify the sender StringBuilder buffy = new StringBuilder();