From 56227a6d7dbaf267008ec328c98b35a67d3132dc Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 14 Sep 2016 10:21:14 +1000 Subject: [PATCH] Fixes #1351 --- .../intellectualcrafters/plot/flag/Flags.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java b/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java index e528b01be..beb9b65f9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java @@ -162,10 +162,15 @@ public final class Flags { Object remove; if (value.DEFAULT_FLAGS.containsKey(duplicate)) { remove = value.DEFAULT_FLAGS.remove(duplicate); - if (remove instanceof Collection) - value.DEFAULT_FLAGS.put(flag, flag.parseValue(StringMan.join((Collection) remove, ','))); - else - value.DEFAULT_FLAGS.put(flag,flag.parseValue("" + remove)); + try { + if (remove instanceof Collection && remove.getClass().getMethod("toString").getDeclaringClass() == Object.class) { + value.DEFAULT_FLAGS.put(flag, flag.parseValue(StringMan.join((Collection) remove, ','))); + } else { + value.DEFAULT_FLAGS.put(flag, flag.parseValue("" + remove)); + } + } catch (NoSuchMethodException neverHappens) { + neverHappens.printStackTrace(); + } } } }); @@ -173,10 +178,15 @@ public final class Flags { @Override public void run(Plot value) { if (value.getFlags().containsKey(duplicate)) { Object remove = value.getFlags().remove(duplicate); - if (remove instanceof Collection) - value.getFlags().put(flag, flag.parseValue(StringMan.join((Collection) remove, ','))); - else - value.getFlags().put(flag,flag.parseValue("" + remove)); + try { + if (remove instanceof Collection && remove.getClass().getMethod("toString").getDeclaringClass() == Object.class) { + value.getFlags().put(flag, flag.parseValue(StringMan.join((Collection) remove, ','))); + } else { + value.getFlags().put(flag, flag.parseValue("" + remove)); + } + } catch (NoSuchMethodException neverHappens) { + neverHappens.printStackTrace(); + } } } });