From 2ba9590238ffc7a49e5d8eeb3d7d28925cdcb094 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 4 Feb 2015 00:17:51 +1100 Subject: [PATCH] Resolves #118 --- .../plot/commands/FlagCmd.java | 14 +++++++++++++- .../com/intellectualcrafters/plot/config/C.java | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index 9ca0721ec..4c60884f6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -81,6 +81,18 @@ public class FlagCmd extends SubCommand { PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); return false; } + AbstractFlag af = FlagManager.getFlag(args[1]); + if (af == null) { + PlayerFunctions.sendMessage(player, C.NOT_VALID_FLAG); + PlayerFunctions.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag info "); + return false; + } + // flag key + PlayerFunctions.sendMessage(player, C.FLAG_KEY, af.getKey()); + // flag type + PlayerFunctions.sendMessage(player, C.FLAG_TYPE, af.value.getClass().getSimpleName()); + // Flag type description + PlayerFunctions.sendMessage(player, C.FLAG_DESC, af.getValueDesc()); PlayerFunctions.sendMessage(player, "&cNot implemented."); } case "set": { @@ -208,7 +220,7 @@ public class FlagCmd extends SubCommand { } HashMap> flags = new HashMap<>(); for (AbstractFlag af : FlagManager.getFlags()) { - String type = af.value.getClass().toString().replaceAll("Value", ""); + String type = af.value.getClass().getSimpleName().replaceAll("Value", ""); if (!flags.containsKey(type)) { flags.put(type, new ArrayList()); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index 7b6f25097..233134e82 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -385,6 +385,10 @@ public enum C { /* * Flag */ + FLAG_KEY("&cKey: %s"), + FLAG_TYPE("&cType: %s"), + FLAG_DESC("&cDesc: %s"), + NEED_KEY("&cPossible values: &6%values%"), NOT_VALID_FLAG("&cThat is not a valid flag"), NOT_VALID_VALUE("&cFlag values must be alphanumerical"),