mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +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>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.8.3</version>
|
<version>2.8.4</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -339,8 +339,15 @@ public class FlagManager {
|
|||||||
public static Flag[] parseFlags(final List<String> flagstrings) {
|
public static Flag[] parseFlags(final List<String> flagstrings) {
|
||||||
final Flag[] flags = new Flag[flagstrings.size()];
|
final Flag[] flags = new Flag[flagstrings.size()];
|
||||||
for (int i = 0; i < flagstrings.size(); i++) {
|
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) {
|
if (split.length == 1) {
|
||||||
|
System.out.print(split[0]);
|
||||||
flags[i] = new Flag(getFlag(split[0], true), "");
|
flags[i] = new Flag(getFlag(split[0], true), "");
|
||||||
} else {
|
} else {
|
||||||
flags[i] = new Flag(getFlag(split[0], true), split[1]);
|
flags[i] = new Flag(getFlag(split[0], true), split[1]);
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -116,17 +118,25 @@ public abstract class PlotWorld {
|
|||||||
this.SELL_PRICE = config.getDouble("economy.prices.sell");
|
this.SELL_PRICE = config.getDouble("economy.prices.sell");
|
||||||
this.PLOT_CHAT = config.getBoolean("chat.enabled");
|
this.PLOT_CHAT = config.getBoolean("chat.enabled");
|
||||||
this.WORLD_BORDER = config.getBoolean("world.border");
|
this.WORLD_BORDER = config.getBoolean("world.border");
|
||||||
final List<String> flags = config.getStringList("flags.default");
|
List<String> flags = config.getStringList("flags.default");
|
||||||
if (flags == null) {
|
if (flags == null || flags.size() == 0) {
|
||||||
this.DEFAULT_FLAGS = new Flag[] {};
|
flags = config.getStringList("flags");
|
||||||
} else {
|
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 {
|
try {
|
||||||
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
|
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
PlotSquared.log("&cInvalid default flags for " + this.worldname + ": " + StringUtils.join(flags, ","));
|
PlotSquared.log("&cInvalid default flags for " + this.worldname + ": " + StringUtils.join(flags, ","));
|
||||||
this.DEFAULT_FLAGS = new Flag[] {};
|
this.DEFAULT_FLAGS = new Flag[] {};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
this.PVP = config.getBoolean("event.pvp");
|
this.PVP = config.getBoolean("event.pvp");
|
||||||
this.PVE = config.getBoolean("event.pve");
|
this.PVE = config.getBoolean("event.pve");
|
||||||
this.SPAWN_EGGS = config.getBoolean("event.spawn.egg");
|
this.SPAWN_EGGS = config.getBoolean("event.spawn.egg");
|
||||||
|
Loading…
Reference in New Issue
Block a user