diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml
index 63c13d197..1bd90faa6 100644
--- a/Bukkit/pom.xml
+++ b/Bukkit/pom.xml
@@ -6,6 +6,12 @@
PlotSquared-Bukkit
latest
+
+ org.json
+ json
+ 20190722
+ compile
+
com.github.intellectualsites.plotsquared
Core
diff --git a/Core/build.gradle b/Core/build.gradle
index 6a8443aab..20f09c935 100644
--- a/Core/build.gradle
+++ b/Core/build.gradle
@@ -4,7 +4,6 @@ repositories {
def textVersion = "3.0.2"
dependencies {
- compile group: 'org.json', name: 'json', version: '20190722'
implementation("org.yaml:snakeyaml:1.25")
implementation("com.google.code.gson:gson:2.8.6") {
because("Minecraft uses GSON 2.8.0")
diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java
index d8992dc11..f072bd077 100644
--- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java
+++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java
@@ -1675,13 +1675,26 @@ import java.util.concurrent.atomic.AtomicInteger;
//
try (final PreparedStatement preparedStatement =
this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) {
+
+ long timeStarted = System.currentTimeMillis();
+ int flagsProcessed = 0;
+ int plotsProcessed = 0;
+
+ int totalFlags = 0;
+ for (final Map flags : flagMap.values()) {
+ totalFlags += flags.size();
+ }
+
for (final Map.Entry> plotFlagEntry : flagMap.entrySet()) {
for (final Map.Entry flagEntry : plotFlagEntry.getValue().entrySet()) {
preparedStatement.setInt(1, plotFlagEntry.getKey());
preparedStatement.setString(2, flagEntry.getKey());
preparedStatement.setString(3, flagEntry.getValue());
preparedStatement.addBatch();
+ flagsProcessed += 1;
}
+ plotsProcessed += 1;
+
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
@@ -1689,6 +1702,12 @@ import java.util.concurrent.atomic.AtomicInteger;
e.printStackTrace();
continue;
}
+
+ if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap.size()) {
+ timeStarted = System.currentTimeMillis();
+ PlotSquared.log(Captions.PREFIX.getTranslated() + "... Flag conversion in progress. " + String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100) + "% Done");
+ }
+
PlotSquared.debug(Captions.PREFIX.getTranslated() + "- Finished converting flags for plot with entry ID: " + plotFlagEntry.getKey());
}
} catch (final Exception e) {
diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/types/BlockTypeListFlag.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/types/BlockTypeListFlag.java
index c8d765691..673b336ed 100644
--- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/types/BlockTypeListFlag.java
+++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flags/types/BlockTypeListFlag.java
@@ -48,7 +48,7 @@ public abstract class BlockTypeListFlag>
@Override public F parse(@NotNull String input) throws FlagParseException {
final List parsedBlocks = new ArrayList<>();
- final String[] split = input.split(",(?![^\\(\\[]*[\\]\\)])");
+ final String[] split = input.replaceAll("\\s+", "").split(",(?![^\\(\\[]*[\\]\\)])");
if (split.length == 0) {
return this.flagOf(parsedBlocks);
}
diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java
index 4f07eb279..fa2a388a5 100644
--- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java
+++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java
@@ -27,6 +27,7 @@ package com.github.intellectualsites.plotsquared.plot.object;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
+import com.github.intellectualsites.plotsquared.plot.config.CaptionUtility;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
@@ -337,6 +338,22 @@ public abstract class PlotArea {
}
}
this.getFlagContainer().addAll(parseFlags(flags));
+
+ StringBuilder flagBuilder = new StringBuilder();
+ Collection> flagCollection = this.getFlagContainer().getFlagMap().values();
+ if (flagCollection.isEmpty()) {
+ flagBuilder.append(Captions.NONE.getTranslated());
+ } else {
+ String prefix = " ";
+ for (final PlotFlag, ?> flag : flagCollection) {
+ Object value = flag.toString();
+ flagBuilder.append(prefix).append(CaptionUtility.format(null, Captions.PLOT_FLAG_LIST.getTranslated(),
+ flag.getName(), CaptionUtility.formatRaw(null, value.toString(), "")));
+ prefix = ", ";
+ }
+ }
+
+ PlotSquared.log(Captions.PREFIX + "&3 - default flags: &7" + flagBuilder.toString());
this.spawnEggs = config.getBoolean("event.spawn.egg");
this.spawnCustom = config.getBoolean("event.spawn.custom");
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
@@ -1027,7 +1044,7 @@ public abstract class PlotArea {
flags.add(flagInstance.parse(split[1]));
} catch (final FlagParseException e) {
PlotSquared.log(Captions.PREFIX.getTranslated() +
- String.format("§2Failed to parse default flag with key §6'%s'§c and value: §6'%s'§c."
+ String.format("§cFailed to parse default flag with key §6'%s'§c and value: §6'%s'§c."
+ " Reason: %s. This flag will not be added as a default flag.",
e.getFlag().getName(), e.getValue(), e.getErrorMessage()));
}
diff --git a/build.gradle b/build.gradle
index baffd4cab..90784c3d4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -78,6 +78,8 @@ subprojects {
}
dependencies {
+ compile group: 'org.json', name: 'json', version: '20190722'
+
implementation("com.sk89q.worldedit:worldedit-core:7.0.0") {
exclude(module: "bukkit-classloader-check")
exclude(module: "mockito-core")
@@ -117,6 +119,7 @@ subprojects {
shadowJar {
dependencies {
+ include(dependency("org.json:json:20190722"))
include(dependency("net.kyori:text-api:3.0.2"))
}
relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib")