diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index 1234a06fc..23648cfb2 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.8.3 + 2.8.4 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java index 355a7390e..3f31b270b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java @@ -339,8 +339,15 @@ public class FlagManager { public static Flag[] parseFlags(final List flagstrings) { final Flag[] flags = new Flag[flagstrings.size()]; for (int i = 0; i < flagstrings.size(); i++) { - final String[] split = flagstrings.get(i).split(";"); + final String[] split; + if (flagstrings.get(i).contains(";")) { + split = flagstrings.get(i).split(";"); + } + else { + split = flagstrings.get(i).split(":"); + } if (split.length == 1) { + System.out.print(split[0]); flags[i] = new Flag(getFlag(split[0], true), ""); } else { flags[i] = new Flag(getFlag(split[0], true), split[1]); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java index 8b29c521b..2dd16a0e2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java @@ -20,8 +20,10 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.object; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.bukkit.configuration.ConfigurationSection; @@ -116,17 +118,25 @@ public abstract class PlotWorld { this.SELL_PRICE = config.getDouble("economy.prices.sell"); this.PLOT_CHAT = config.getBoolean("chat.enabled"); this.WORLD_BORDER = config.getBoolean("world.border"); - final List flags = config.getStringList("flags.default"); - if (flags == null) { - this.DEFAULT_FLAGS = new Flag[] {}; - } else { - try { - this.DEFAULT_FLAGS = FlagManager.parseFlags(flags); - } catch (final Exception e) { - PlotSquared.log("&cInvalid default flags for " + this.worldname + ": " + StringUtils.join(flags, ",")); - this.DEFAULT_FLAGS = new Flag[] {}; + List flags = config.getStringList("flags.default"); + if (flags == null || flags.size() == 0) { + flags = config.getStringList("flags"); + if (flags == null || flags.size() == 0) { + flags = new ArrayList(); + ConfigurationSection section = config.getConfigurationSection("flags"); + Set keys = section.getKeys(false); + for (String key : keys) { + flags.add(key + ";" + section.get(key)); + } } } + try { + this.DEFAULT_FLAGS = FlagManager.parseFlags(flags); + } catch (final Exception e) { + e.printStackTrace(); + PlotSquared.log("&cInvalid default flags for " + this.worldname + ": " + StringUtils.join(flags, ",")); + this.DEFAULT_FLAGS = new Flag[] {}; + } this.PVP = config.getBoolean("event.pvp"); this.PVE = config.getBoolean("event.pve"); this.SPAWN_EGGS = config.getBoolean("event.spawn.egg");