diff options
author | Luck <git@lucko.me> | 2022-02-22 20:46:51 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-02-22 21:10:50 +0000 |
commit | f8ae6c5e41d72e7e695c65fe77281c6dd87e1ec3 (patch) | |
tree | 9433f58aac8863055da020e3694027f6c1277b5e /spark-bukkit/src/main/java | |
parent | e613641c3332e09cd598a1f44ff4a4a9c405d9a6 (diff) | |
download | spark-f8ae6c5e41d72e7e695c65fe77281c6dd87e1ec3.tar.gz spark-f8ae6c5e41d72e7e695c65fe77281c6dd87e1ec3.tar.bz2 spark-f8ae6c5e41d72e7e695c65fe77281c6dd87e1ec3.zip |
Exclude level seed from server.properties config (#178)
Diffstat (limited to 'spark-bukkit/src/main/java')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitServerConfigProvider.java | 26 |
1 files changed, 4 insertions, 22 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 492e610..0ef662c 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 @@ -28,6 +28,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonSerializer; import me.lucko.spark.common.platform.serverconfig.AbstractServerConfigProvider; +import me.lucko.spark.common.platform.serverconfig.PropertiesFileReader; import org.bukkit.configuration.MemorySection; import org.bukkit.configuration.file.YamlConfiguration; @@ -43,10 +44,8 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; public class BukkitServerConfigProvider extends AbstractServerConfigProvider<BukkitServerConfigProvider.FileType> { private static final Gson GSON = new GsonBuilder() @@ -73,26 +72,8 @@ public class BukkitServerConfigProvider extends AbstractServerConfigProvider<Buk Map<String, Object> values; if (type == FileType.PROPERTIES) { - Properties properties = new Properties(); - properties.load(reader); - - values = new HashMap<>(); - properties.forEach((k, v) -> { - String key = k.toString(); - String value = v.toString(); - - if ("true".equals(value) || "false".equals(value)) { - values.put(key, Boolean.parseBoolean(value)); - } else if (value.matches("\\d+")) { - try { - values.put(key, Long.parseLong(value)); - } catch (NumberFormatException e) { - values.put(key, value); - } - } else { - values.put(key, value); - } - }); + PropertiesFileReader propertiesReader = new PropertiesFileReader(reader); + values = propertiesReader.readProperties(); } else if (type == FileType.YAML) { YamlConfiguration config = YamlConfiguration.loadConfiguration(reader); values = config.getValues(false); @@ -129,6 +110,7 @@ public class BukkitServerConfigProvider extends AbstractServerConfigProvider<Buk .add("motd") .add("resource-pack") .add("rcon<dot>password") + .add("level-seed") .addAll(getTimingsHiddenConfigs()) .addAll(getSystemPropertyList("spark.serverconfigs.hiddenpaths")); |