mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
More lenient default flags
This commit is contained in:
parent
073b0b612c
commit
e6fc6e070e
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>2.8.3</version>
|
||||
<version>2.8.4</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
|
@ -339,8 +339,15 @@ public class FlagManager {
|
||||
public static Flag[] parseFlags(final List<String> 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]);
|
||||
|
@ -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<String> 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<String> flags = config.getStringList("flags.default");
|
||||
if (flags == null || flags.size() == 0) {
|
||||
flags = config.getStringList("flags");
|
||||
if (flags == null || flags.size() == 0) {
|
||||
flags = new ArrayList<String>();
|
||||
ConfigurationSection section = config.getConfigurationSection("flags");
|
||||
Set<String> 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");
|
||||
|
Loading…
Reference in New Issue
Block a user