Fix /plot flag set allowing for invalid flag values. (Fixes #2519)

This commit is contained in:
Alexander Söderberg 2019-10-27 12:01:04 +01:00
parent cb52ee8cfb
commit 2e15934666

View File

@ -163,6 +163,11 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, "&c" + flag.getValueDescription()); MainUtil.sendMessage(player, "&c" + flag.getValueDescription());
return false; return false;
} }
if (flag instanceof ListFlag) {
if (!(parsed instanceof Collection) || ((Collection) parsed).isEmpty()) {
return !MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
}
}
boolean result = plot.setFlag(flag, parsed); boolean result = plot.setFlag(flag, parsed);
if (!result) { if (!result) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);