Add -e flag to /rg flag to set a flag to an empty value.

Closes WORLDGUARD-3161.
This commit is contained in:
sk89q 2014-08-31 19:34:55 -07:00
parent cdab004505
commit f858c175f9

View File

@ -455,7 +455,7 @@ public void list(CommandContext args, CommandSender sender) throws CommandExcept
*/
@Command(aliases = {"flag", "f"},
usage = "<id> <flag> [-w world] [-g group] [value]",
flags = "g:w:",
flags = "g:w:e",
desc = "Set flags",
min = 2)
public void flag(CommandContext args, CommandSender sender) throws CommandException {
@ -467,6 +467,14 @@ public void flag(CommandContext args, CommandSender sender) throws CommandExcept
RegionGroup groupValue = null;
RegionPermissionModel permModel = getPermissionModel(sender);
if (args.hasFlag('e')) {
if (value != null) {
throw new CommandException("You cannot use -e(mpty) with a flag value.");
}
value = "";
}
// Add color codes
if (value != null) {
value = CommandUtils.replaceColorMacros(value);