mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@cc56332 Final 1.20.6 Paper Upstream \o/ PurpurMC/Purpur@f1c87e4 add missing armadillo & bogged options, closes #1527
453 lines
20 KiB
Diff
453 lines
20 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Mon, 27 Mar 2023 13:16:41 +0300
|
|
Subject: [PATCH] Divine Configuration
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 956df6b435bf04f67f321715cceafd7c1e0165e5..be6b3add037e9c95e6c93a3ee6b413e5a79a2846 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -56,6 +56,7 @@ import net.minecraft.world.level.GameType;
|
|
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
|
import net.minecraft.world.level.storage.LevelStorageSource;
|
|
import org.slf4j.Logger;
|
|
+import space.bxteam.divinemc.configuration.DivineConfig; // DivineMC
|
|
|
|
// CraftBukkit start
|
|
import net.minecraft.server.WorldLoader;
|
|
@@ -244,6 +245,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
// Purpur end
|
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
|
|
|
+ // DivineMC start
|
|
+ try {
|
|
+ DivineConfig.init((java.io.File) options.valueOf("divinemc-settings"));
|
|
+ } catch (Exception e) {
|
|
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
|
+ return false;
|
|
+ }
|
|
+ DivineConfig.registerCommands();
|
|
+ // DivineMC end
|
|
+
|
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
|
this.setMotd(dedicatedserverproperties.motd);
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 4beada452d014ec7dc7c167466ec2af3c5bfcd33..63629a36572cd83977886c016084fd5ebefab65c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.WritableLevelData;
|
|
import net.minecraft.world.phys.AABB;
|
|
import net.minecraft.world.phys.Vec3;
|
|
import net.minecraft.world.scores.Scoreboard;
|
|
+import space.bxteam.divinemc.configuration.DivineWorldConfig; // DivineMC
|
|
|
|
// CraftBukkit start
|
|
import java.util.HashMap;
|
|
@@ -172,6 +173,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
|
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
|
+ public final DivineWorldConfig divinemcConfig; // DivineMC
|
|
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
|
public static BlockPos lastPhysicsProblem; // Spigot
|
|
private org.spigotmc.TickLimiter entityLimiter;
|
|
@@ -253,6 +255,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
|
this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
|
|
+ this.divinemcConfig = new DivineWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // DivineMC
|
|
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
|
|
this.generator = gen;
|
|
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 07a04dcbd48430102268f8f44e9bce437214a00f..53fe8501a477a2cb436792cc02601de4de7f3f54 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -264,6 +264,8 @@ import net.md_5.bungee.api.chat.BaseComponent; // Spigot
|
|
import javax.annotation.Nullable; // Paper
|
|
import javax.annotation.Nonnull; // Paper
|
|
|
|
+import space.bxteam.divinemc.configuration.DivineConfig; // DivineMC
|
|
+
|
|
public final class CraftServer implements Server {
|
|
private final String serverName = io.papermc.paper.ServerBuildInfo.buildInfo().brandName(); // Paper
|
|
private final String serverVersion;
|
|
@@ -1071,6 +1073,7 @@ public final class CraftServer implements Server {
|
|
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
|
this.console.paperConfigurations.reloadConfigs(this.console);
|
|
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
|
+ DivineConfig.init((File) console.options.valueOf("divinemc-settings")); // DivineMC
|
|
for (ServerLevel world : this.console.getAllLevels()) {
|
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
|
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
|
@@ -1087,6 +1090,7 @@ public final class CraftServer implements Server {
|
|
}
|
|
world.spigotConfig.init(); // Spigot
|
|
world.purpurConfig.init(); // Purpur
|
|
+ world.divinemcConfig.init(); // DivineMC
|
|
}
|
|
|
|
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
|
@@ -1104,6 +1108,7 @@ public final class CraftServer implements Server {
|
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
|
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
|
org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur
|
|
+ DivineConfig.registerCommands(); // DivineMC
|
|
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
|
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
|
|
|
@@ -3131,6 +3136,13 @@ public final class CraftServer implements Server {
|
|
}
|
|
// Purpur end
|
|
|
|
+ // DivineMC start
|
|
+ @Override
|
|
+ public YamlConfiguration getDivineConfig() {
|
|
+ return DivineConfig.config;
|
|
+ }
|
|
+ // DivineMC end
|
|
+
|
|
@Override
|
|
public void restart() {
|
|
org.spigotmc.RestartCommand.restart();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index e2b79f8eacd34d2d20f8be34b402820723e37ae3..6aff380ee0224a438b36fa83cfbede4b57996d06 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -184,6 +184,14 @@ public class Main {
|
|
.describedAs("Yml file");
|
|
// Purpur end
|
|
|
|
+ // DivineMC start
|
|
+ acceptsAll(asList("divinemc", "divinemc-settings"), "File for divinemc settings")
|
|
+ .withRequiredArg()
|
|
+ .ofType(File.class)
|
|
+ .defaultsTo(new File("divinemc.yml"))
|
|
+ .describedAs("Yml file");
|
|
+ // DivineMC end
|
|
+
|
|
// Paper start
|
|
acceptsAll(asList("server-name"), "Name of the server")
|
|
.withRequiredArg()
|
|
diff --git a/src/main/java/space/bxteam/divinemc/commands/DivineCommand.java b/src/main/java/space/bxteam/divinemc/commands/DivineCommand.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..06af4af987859081bcf23e91da02b295ec31eba4
|
|
--- /dev/null
|
|
+++ b/src/main/java/space/bxteam/divinemc/commands/DivineCommand.java
|
|
@@ -0,0 +1,66 @@
|
|
+package space.bxteam.divinemc.commands;
|
|
+
|
|
+import net.minecraft.server.MinecraftServer;
|
|
+import net.minecraft.server.level.ServerLevel;
|
|
+import space.bxteam.divinemc.configuration.DivineConfig;
|
|
+import org.bukkit.ChatColor;
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.command.Command;
|
|
+import org.bukkit.command.CommandSender;
|
|
+
|
|
+import java.io.File;
|
|
+import java.util.Collections;
|
|
+import java.util.List;
|
|
+import java.util.stream.Collectors;
|
|
+import java.util.stream.Stream;
|
|
+
|
|
+public class DivineCommand extends Command {
|
|
+ public DivineCommand(String name) {
|
|
+ super(name);
|
|
+ this.description = "DivineMC related commands";
|
|
+ this.usageMessage = "/divinemc [reload | version]";
|
|
+ this.setPermission("bukkit.command.divinemc");
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
|
|
+ if (args.length == 1) {
|
|
+ return Stream.of("reload", "version")
|
|
+ .filter(arg -> arg.startsWith(args[0].toLowerCase()))
|
|
+ .collect(Collectors.toList());
|
|
+ }
|
|
+ return Collections.emptyList();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
|
+ if (!testPermission(sender)) return true;
|
|
+
|
|
+ if (args.length != 1) {
|
|
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ if (args[0].equalsIgnoreCase("reload")) {
|
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
|
+
|
|
+ MinecraftServer console = MinecraftServer.getServer();
|
|
+ DivineConfig.init((File) console.options.valueOf("divinemc-settings"));
|
|
+ for (ServerLevel level : console.getAllLevels()) {
|
|
+ level.divinemcConfig.init();
|
|
+ level.resetBreedingCooldowns();
|
|
+ }
|
|
+ console.server.reloadCount++;
|
|
+
|
|
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "DivineMC config reload complete.");
|
|
+ } else if (args[0].equalsIgnoreCase("version")) {
|
|
+ Command verCmd = org.bukkit.Bukkit.getServer().getCommandMap().getCommand("version");
|
|
+ if (verCmd != null) {
|
|
+ return verCmd.execute(sender, commandLabel, new String[0]);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return true;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..8380fd40b19ea1b4bff6ba78648408fbd3c662d0
|
|
--- /dev/null
|
|
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
@@ -0,0 +1,155 @@
|
|
+package space.bxteam.divinemc.configuration;
|
|
+
|
|
+import com.google.common.base.Throwables;
|
|
+import com.google.common.collect.ImmutableMap;
|
|
+import space.bxteam.divinemc.commands.*;
|
|
+import net.minecraft.server.MinecraftServer;
|
|
+import net.minecraft.world.level.block.Blocks;
|
|
+import org.bukkit.Bukkit;
|
|
+import org.bukkit.command.Command;
|
|
+import org.bukkit.configuration.ConfigurationSection;
|
|
+import org.bukkit.configuration.InvalidConfigurationException;
|
|
+import org.bukkit.configuration.file.YamlConfiguration;
|
|
+
|
|
+import java.io.File;
|
|
+import java.io.IOException;
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
+import java.lang.reflect.Method;
|
|
+import java.lang.reflect.Modifier;
|
|
+import java.util.HashMap;
|
|
+import java.util.List;
|
|
+import java.util.Map;
|
|
+import java.util.logging.Level;
|
|
+
|
|
+@SuppressWarnings("unused")
|
|
+public class DivineConfig {
|
|
+ private static final String HEADER = "This is the main configuration file for DivineMC.\n"
|
|
+ + "If you need help with the configuration or have any questions related to DivineMC,\n"
|
|
+ + "join us in our Discord server.\n"
|
|
+ + "\n"
|
|
+ + "Discord: https://discord.gg/p7cxhw7E2M \n"
|
|
+ + "Docs: https://divinemc.bx-team.space/docs \n"
|
|
+ + "New builds: https://github.com/DivineMC/DivineMC/releases/latest";
|
|
+ private static File CONFIG_FILE;
|
|
+ public static YamlConfiguration config;
|
|
+
|
|
+ private static Map<String, Command> commands;
|
|
+
|
|
+ public static int version;
|
|
+ static boolean verbose;
|
|
+
|
|
+ public static void init(File configFile) {
|
|
+ CONFIG_FILE = configFile;
|
|
+ config = new YamlConfiguration();
|
|
+ try {
|
|
+ config.load(CONFIG_FILE);
|
|
+ } catch (IOException ignore) {
|
|
+ } catch (InvalidConfigurationException ex) {
|
|
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load divinemc.yml, please correct your syntax errors", ex);
|
|
+ throw Throwables.propagate(ex);
|
|
+ }
|
|
+ config.options().header(HEADER);
|
|
+ config.options().copyDefaults(true);
|
|
+ verbose = getBoolean("verbose", false);
|
|
+
|
|
+ commands = new HashMap<>();
|
|
+ commands.put("divinemc", new DivineCommand("divinemc"));
|
|
+
|
|
+ version = getInt("config-version", 3);
|
|
+ set("config-version", 3);
|
|
+
|
|
+ readConfig(DivineConfig.class, null);
|
|
+
|
|
+ Blocks.rebuildCache();
|
|
+ }
|
|
+
|
|
+ protected static void log(String s) {
|
|
+ if (verbose) {
|
|
+ log(Level.INFO, s);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected static void log(Level level, String s) {
|
|
+ Bukkit.getLogger().log(level, s);
|
|
+ }
|
|
+
|
|
+ public static void registerCommands() {
|
|
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
|
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "DivineMC", entry.getValue());
|
|
+ }
|
|
+ }
|
|
+
|
|
+ static void readConfig(Class<?> clazz, Object instance) {
|
|
+ for (Method method : clazz.getDeclaredMethods()) {
|
|
+ if (Modifier.isPrivate(method.getModifiers())) {
|
|
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
|
+ try {
|
|
+ method.setAccessible(true);
|
|
+ method.invoke(instance);
|
|
+ } catch (InvocationTargetException ex) {
|
|
+ throw Throwables.propagate(ex.getCause());
|
|
+ } catch (Exception ex) {
|
|
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ try {
|
|
+ config.save(CONFIG_FILE);
|
|
+ } catch (IOException ex) {
|
|
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private static void set(String path, Object val) {
|
|
+ config.addDefault(path, val);
|
|
+ config.set(path, val);
|
|
+ }
|
|
+
|
|
+ private static String getString(String path, String def) {
|
|
+ config.addDefault(path, def);
|
|
+ return config.getString(path, config.getString(path));
|
|
+ }
|
|
+
|
|
+ private static boolean getBoolean(String path, boolean def) {
|
|
+ config.addDefault(path, def);
|
|
+ return config.getBoolean(path, config.getBoolean(path));
|
|
+ }
|
|
+
|
|
+ private static double getDouble(String path, double def) {
|
|
+ config.addDefault(path, def);
|
|
+ return config.getDouble(path, config.getDouble(path));
|
|
+ }
|
|
+
|
|
+ private static int getInt(String path, int def) {
|
|
+ config.addDefault(path, def);
|
|
+ return config.getInt(path, config.getInt(path));
|
|
+ }
|
|
+
|
|
+ private static <T> List getList(String path, T def) {
|
|
+ config.addDefault(path, def);
|
|
+ return config.getList(path, config.getList(path));
|
|
+ }
|
|
+
|
|
+ static Map<String, Object> getMap(String path, Map<String, Object> def) {
|
|
+ if (def != null && config.getConfigurationSection(path) == null) {
|
|
+ config.addDefault(path, def);
|
|
+ return def;
|
|
+ }
|
|
+ return toMap(config.getConfigurationSection(path));
|
|
+ }
|
|
+
|
|
+ private static Map<String, Object> toMap(ConfigurationSection section) {
|
|
+ ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
|
|
+ if (section != null) {
|
|
+ for (String key : section.getKeys(false)) {
|
|
+ Object obj = section.get(key);
|
|
+ if (obj != null) {
|
|
+ builder.put(key, obj instanceof ConfigurationSection val ? toMap(val) : obj);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return builder.build();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..3e64e0d2d925f9fca1eb38cc07c20cae785ef39f
|
|
--- /dev/null
|
|
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
|
|
@@ -0,0 +1,80 @@
|
|
+package space.bxteam.divinemc.configuration;
|
|
+
|
|
+import org.apache.commons.lang.BooleanUtils;
|
|
+import org.bukkit.World;
|
|
+import org.bukkit.configuration.ConfigurationSection;
|
|
+
|
|
+import java.util.List;
|
|
+import java.util.Map;
|
|
+import java.util.function.Predicate;
|
|
+
|
|
+import static space.bxteam.divinemc.configuration.DivineConfig.log;
|
|
+
|
|
+@SuppressWarnings("unused")
|
|
+public class DivineWorldConfig {
|
|
+
|
|
+ private final String worldName;
|
|
+ private final World.Environment environment;
|
|
+
|
|
+ public DivineWorldConfig(String worldName, World.Environment environment) {
|
|
+ this.worldName = worldName;
|
|
+ this.environment = environment;
|
|
+ init();
|
|
+ }
|
|
+
|
|
+ public void init() {
|
|
+ log("-------- World Settings For [" + worldName + "] --------");
|
|
+ DivineConfig.readConfig(DivineWorldConfig.class, this);
|
|
+ }
|
|
+
|
|
+ private void set(String path, Object val) {
|
|
+ DivineConfig.config.addDefault("world-settings.default." + path, val);
|
|
+ DivineConfig.config.set("world-settings.default." + path, val);
|
|
+ if (DivineConfig.config.get("world-settings." + worldName + "." + path) != null) {
|
|
+ DivineConfig.config.addDefault("world-settings." + worldName + "." + path, val);
|
|
+ DivineConfig.config.set("world-settings." + worldName + "." + path, val);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private ConfigurationSection getConfigurationSection(String path) {
|
|
+ ConfigurationSection section = DivineConfig.config.getConfigurationSection("world-settings." + worldName + "." + path);
|
|
+ return section != null ? section : DivineConfig.config.getConfigurationSection("world-settings.default." + path);
|
|
+ }
|
|
+
|
|
+ private String getString(String path, String def) {
|
|
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
|
+ return DivineConfig.config.getString("world-settings." + worldName + "." + path, DivineConfig.config.getString("world-settings.default." + path));
|
|
+ }
|
|
+
|
|
+ private boolean getBoolean(String path, boolean def) {
|
|
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
|
+ return DivineConfig.config.getBoolean("world-settings." + worldName + "." + path, DivineConfig.config.getBoolean("world-settings.default." + path));
|
|
+ }
|
|
+
|
|
+ private boolean getBoolean(String path, Predicate<Boolean> predicate) {
|
|
+ String val = getString(path, "default").toLowerCase();
|
|
+ Boolean bool = BooleanUtils.toBooleanObject(val, "true", "false", "default");
|
|
+ return predicate.test(bool);
|
|
+ }
|
|
+
|
|
+ private double getDouble(String path, double def) {
|
|
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
|
+ return DivineConfig.config.getDouble("world-settings." + worldName + "." + path, DivineConfig.config.getDouble("world-settings.default." + path));
|
|
+ }
|
|
+
|
|
+ private int getInt(String path, int def) {
|
|
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
|
+ return DivineConfig.config.getInt("world-settings." + worldName + "." + path, DivineConfig.config.getInt("world-settings.default." + path));
|
|
+ }
|
|
+
|
|
+ private <T> List<?> getList(String path, T def) {
|
|
+ DivineConfig.config.addDefault("world-settings.default." + path, def);
|
|
+ return DivineConfig.config.getList("world-settings." + worldName + "." + path, DivineConfig.config.getList("world-settings.default." + path));
|
|
+ }
|
|
+
|
|
+ private Map<String, Object> getMap(String path, Map<String, Object> def) {
|
|
+ final Map<String, Object> fallback = DivineConfig.getMap("world-settings.default." + path, def);
|
|
+ final Map<String, Object> value = DivineConfig.getMap("world-settings." + worldName + "." + path, null);
|
|
+ return value.isEmpty() ? fallback : value;
|
|
+ }
|
|
+}
|