mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fix #1098
This commit is contained in:
parent
e63b436edd
commit
3be0f74498
@ -733,17 +733,13 @@ public class SQLManager implements AbstractDB {
|
||||
e.printStackTrace();
|
||||
PS.debug("&cERROR 2: | " + objList.get(0).getClass().getCanonicalName());
|
||||
PS.debug("&6[WARN] Could not bulk save!");
|
||||
try {
|
||||
String nonBulk = mod.getCreateSQL();
|
||||
try (PreparedStatement preparedStmt = this.connection.prepareStatement(nonBulk)) {
|
||||
for (T obj : objList) {
|
||||
mod.setSQL(preparedStmt, obj);
|
||||
preparedStmt.addBatch();
|
||||
}
|
||||
PS.debug("&aBatch 3");
|
||||
preparedStmt.executeBatch();
|
||||
preparedStmt.close();
|
||||
try (PreparedStatement preparedStmt = this.connection.prepareStatement(mod.getCreateSQL())) {
|
||||
for (T obj : objList) {
|
||||
mod.setSQL(preparedStmt, obj);
|
||||
preparedStmt.addBatch();
|
||||
}
|
||||
PS.debug("&aBatch 3");
|
||||
preparedStmt.executeBatch();
|
||||
} catch (SQLException e3) {
|
||||
e3.printStackTrace();
|
||||
PS.debug("&c[ERROR] Failed to save all!");
|
||||
@ -1819,9 +1815,13 @@ public class SQLManager implements AbstractDB {
|
||||
if (element.contains(":")) {
|
||||
String[] split = element.split(":");
|
||||
try {
|
||||
String flag_str = split[1].replaceAll("\u00AF", ":").replaceAll("\u00B4", ",");
|
||||
Flag<?> flag = FlagManager.getFlag(split[0]);
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
String flag_str = split[1].replaceAll("¯", ":").replaceAll("\u00B4", ",");
|
||||
Flag<?> flag = FlagManager.getFlag(split[0],false);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", split[0]));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
exception = true;
|
||||
@ -1829,8 +1829,12 @@ public class SQLManager implements AbstractDB {
|
||||
} else {
|
||||
element = element.replaceAll("\u00AF", ":").replaceAll("\u00B4", ",");
|
||||
if (StringMan.isAlpha(element.replaceAll("_", "").replaceAll("-", ""))) {
|
||||
Flag flag = FlagManager.getFlag(element);
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
Flag flag = FlagManager.getFlag(element,false);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", element));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
}
|
||||
} else {
|
||||
PS.debug("INVALID FLAG: " + element);
|
||||
}
|
||||
@ -2624,27 +2628,25 @@ public class SQLManager implements AbstractDB {
|
||||
flags_string = myflags.split(",");
|
||||
}
|
||||
HashMap<Flag<?>, Object> flags = new HashMap<>();
|
||||
boolean exception = false;
|
||||
for (String element : flags_string) {
|
||||
if (element.contains(":")) {
|
||||
String[] split = element.split(":");
|
||||
try {
|
||||
String flag_str = split[1].replaceAll("\u00AF", ":").replaceAll("<EFBFBD>", ",");
|
||||
Flag flag = FlagManager.getFlag(split[0]);
|
||||
String flag_str = split[1].replaceAll("\u00AF", ":").replaceAll("<EFBFBD>", ",");
|
||||
Flag flag = FlagManager.getFlag(split[0],false);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", split[0]));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
exception = true;
|
||||
}
|
||||
} else {
|
||||
Flag flag = FlagManager.getFlag(element);
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
Flag flag = FlagManager.getFlag(element,false);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", element));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exception) {
|
||||
PS.debug("&cCluster " + id + " had an invalid flag. A fix has been attempted.");
|
||||
PS.debug("&c" + myflags);
|
||||
}
|
||||
cluster.settings.flags = flags;
|
||||
} else {
|
||||
PS.debug("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
|
||||
|
@ -257,6 +257,21 @@ public class FlagManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Flag<?> getFlag(String string, boolean ignoreReserved) {
|
||||
for (Flag flag : Flags.getFlags()) {
|
||||
if (flag.getName().equalsIgnoreCase(string)) {
|
||||
if (!ignoreReserved) {
|
||||
if (isReserved(flag)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static Map<Flag<?>, Object> parseFlags(List<String> flagstrings) {
|
||||
HashMap<Flag<?>, Object> map = new HashMap<>();
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
try {
|
||||
setupSchematics();
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c - road schematics are disabled for this world.");
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class BlockLoc {
|
||||
if (this.x == 0 && this.y == 0 && this.z == 0) {
|
||||
return "";
|
||||
}
|
||||
return this.x + "," + this.y + "," + this.z + "," + this.yaw + "," + this.pitch;
|
||||
return this.x + "," + this.y + ',' + this.z + ',' + this.yaw + ',' + this.pitch;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user