aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-06-04 20:26:36 +0100
committerLuck <git@lucko.me>2022-06-04 20:26:44 +0100
commitb0a22e85414e1ba7b115cf374c98f76c9f21e932 (patch)
tree8d0637974164c1c6cd88c24ede63f998284db5a0
parentd3e6d73b6be762558a3c7ff991ba52d4d6cfb74d (diff)
downloadspark-b0a22e85414e1ba7b115cf374c98f76c9f21e932.tar.gz
spark-b0a22e85414e1ba7b115cf374c98f76c9f21e932.tar.bz2
spark-b0a22e85414e1ba7b115cf374c98f76c9f21e932.zip
Filter more level seed properties from configs
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java1
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java8
2 files changed, 8 insertions, 1 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java
index 831150f..953e171 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java
@@ -112,6 +112,7 @@ public class BukkitServerConfigProvider extends AbstractServerConfigProvider<Buk
.add("rcon<dot>password")
.add("level-seed")
.add("world-settings.*.feature-seeds")
+ .add("world-settings.*.seed-*")
.addAll(getTimingsHiddenConfigs())
.addAll(getSystemPropertyList("spark.serverconfigs.hiddenpaths"));
diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java
index 56b3731..ead2131 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java
@@ -108,6 +108,12 @@ public abstract class AbstractServerConfigProvider<T extends Enum<T>> implements
keys = jsonObject.entrySet().stream()
.map(Map.Entry::getKey)
.collect(Collectors.toList());
+ } else if (expected.endsWith("*")) {
+ String pattern = expected.substring(0, expected.length() - 1);
+ keys = jsonObject.entrySet().stream()
+ .map(Map.Entry::getKey)
+ .filter(key -> key.startsWith(pattern))
+ .collect(Collectors.toList());
} else if (jsonObject.has(expected)) {
keys = Collections.singletonList(expected);
} else {
@@ -118,7 +124,7 @@ public abstract class AbstractServerConfigProvider<T extends Enum<T>> implements
if (path.isEmpty()) {
jsonObject.remove(key);
} else {
- Deque<String> pathCopy = expected.equals("*")
+ Deque<String> pathCopy = keys.size() > 1
? new LinkedList<>(path)
: path;