From bf3402306f81cb3596ced26c9afa81daa3482b3e Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Sat, 25 Oct 2014 16:15:13 +0200 Subject: [PATCH] Support for colour codes --- PlotSquared/src/com/intellectualcrafters/plot/Flag.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/Flag.java b/PlotSquared/src/com/intellectualcrafters/plot/Flag.java index 310f1f720..1abbd6d7d 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/Flag.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/Flag.java @@ -21,8 +21,9 @@ public class Flag { * if you provide inadequate inputs */ public Flag(AbstractFlag key, String value) { - if (!StringUtils.isAlphanumericSpace(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', value)))) { - throw new IllegalArgumentException("Flag must be alphanumerical"); + String tempValue = ChatColor.stripColor(value.replaceAll("&", "").replaceAll("ยง", "").replaceAll("-", "").replaceAll("_", "")); + if (!StringUtils.isAlphanumericSpace(tempValue)) { + throw new IllegalArgumentException("Flag must be alphanumerical (colours, - and _ are allowed)"); } if (value.length() > 48) { throw new IllegalArgumentException("Value must be <= 48 characters");