diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ConfigCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ConfigCommand.java index 67b159fa..ec22485c 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ConfigCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ConfigCommand.java @@ -45,7 +45,17 @@ public class ConfigCommand extends MultiverseCommand { return; } } else { - if (ConfigProperty.valueOf(args.get(0).toLowerCase()) != null) { + ConfigProperty property = null; + try { + property = ConfigProperty.valueOf(args.get(0).toLowerCase()); + } catch (IllegalArgumentException e) { + sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE + " you can't set " + ChatColor.AQUA + args.get(0)); + sender.sendMessage(ChatColor.GREEN + "Valid values are:"); + sender.sendMessage(ConfigProperty.getAllValues()); + return; + } + + if (property != null) { try { this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), Boolean.parseBoolean(args.get(0))); } catch (Exception e) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java b/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java index 4b96a25b..45d7d785 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java +++ b/src/main/java/com/onarandombox/MultiverseCore/enums/ConfigProperty.java @@ -9,6 +9,15 @@ package com.onarandombox.MultiverseCore.enums; /** Multiverse 2 */ public enum ConfigProperty { - messagecooldown, teleportcooldown, worldnameprefix, - disableautoheal, fakepvp, bedrespawn, enforcegamemodes, enforceaccess, debug + messagecooldown, teleportcooldown, worldnameprefix, bedrespawn, enforcegamemodes, enforceaccess, debug; + + + public static String getAllValues() { + String buffer = ""; + for (ConfigProperty c : ConfigProperty.values()) { + // All values will NOT Contain spaces. + buffer += c.toString() + " "; + } + return buffer; + } }