mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Recover from invalid flag value
This commit is contained in:
parent
a43430b722
commit
ba568a3f60
@ -9,11 +9,7 @@ public class BooleanFlag extends Flag<Boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public String valueToString(Object value) {
|
@Override public String valueToString(Object value) {
|
||||||
if (((boolean) value)) {
|
return value + "";
|
||||||
return "true";
|
|
||||||
} else {
|
|
||||||
return "false";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Boolean parseValue(String value) {
|
@Override public Boolean parseValue(String value) {
|
||||||
|
@ -112,12 +112,17 @@ public class FlagManager {
|
|||||||
StringBuilder flag_string = new StringBuilder();
|
StringBuilder flag_string = new StringBuilder();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Map.Entry<Flag<?>, Object> entry : flags.entrySet()) {
|
for (Map.Entry<Flag<?>, Object> entry : flags.entrySet()) {
|
||||||
|
try {
|
||||||
Flag flag = entry.getKey();
|
Flag flag = entry.getKey();
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
flag_string.append(',');
|
flag_string.append(',');
|
||||||
}
|
}
|
||||||
flag_string.append(flag.getName() + ':' + flag.valueToString(entry.getValue()).replaceAll(":", "¯").replaceAll(",", "´"));
|
flag_string.append(flag.getName() + ':' + flag.valueToString(entry.getValue()).replaceAll(":", "¯").replaceAll(",", "´"));
|
||||||
i++;
|
i++;
|
||||||
|
} catch (Exception e) {
|
||||||
|
PS.debug("Failed to parse flag: " + entry.getKey() + "->" + entry.getValue());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return flag_string.toString();
|
return flag_string.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user