From 2e15934666faa7e765e281cb5de83e2bdbbd123b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 27 Oct 2019 12:01:04 +0100 Subject: [PATCH] Fix `/plot flag set` allowing for invalid flag values. (Fixes #2519) --- .../intellectualsites/plotsquared/plot/commands/FlagCmd.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index 18976edac..af0389dec 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -163,6 +163,11 @@ public class FlagCmd extends SubCommand { MainUtil.sendMessage(player, "&c" + flag.getValueDescription()); 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); if (!result) { MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);