mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
DivineMC Configuration
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Mon, 27 Mar 2023 17:50:05 +0300
|
||||
Subject: [PATCH] Divine Configuration
|
||||
Date: Sat, 11 Jan 2025 22:53:30 +0300
|
||||
Subject: [PATCH] DivineMC Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ddb1ff894910761a78b91a343f32e129f03a03c4..ca097588b84912b6d8a763b7e36885fbdf3dffec 100644
|
||||
index 5c34da114f6bc4446a187fbfbf113a5455b84078..d7f7ae223418004b39715670976f6db050671cee 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2295,6 +2295,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 11 Jan 2025 22:49:50 +0300
|
||||
Subject: [PATCH] DivineMC Configuration
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index c02a7375d356ccdb23c24c784584029eab51fae1..88c699c16718e27b1c44db8f4460f2efcf04e492 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -217,6 +217,17 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
}
|
||||
org.purpurmc.purpur.PurpurConfig.registerCommands();
|
||||
// Purpur end - Configurable void damage height and damage
|
||||
+
|
||||
+ // DivineMC start - DivineMC Configuration
|
||||
+ try {
|
||||
+ space.bxteam.divinemc.configuration.DivineConfig.init((java.io.File) options.valueOf("divinemc-settings"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ space.bxteam.divinemc.configuration.DivineConfig.registerCommands();
|
||||
+ // DivineMC end - DivineMC Configuration
|
||||
+
|
||||
// Paper start - initialize global and world-defaults configuration
|
||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index 9eccdbc2ea91d434328db9fee2c270ce2ebb290c..c443ae6a3dd8289a74837087e7b563b94aed1b90 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files
|
||||
+ public final space.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC - DivineMC Configuration
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
private org.spigotmc.TickLimiter tileLimiter;
|
||||
@@ -898,6 +899,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).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) levelData).getLevelName(), env); // Purpur - Purpur config files
|
||||
+ this.divinemcConfig = new space.bxteam.divinemc.configuration.DivineWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName(), env); // DivineMC - DivineMC Configuration
|
||||
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur - Add adjustable breeding cooldown to config
|
||||
this.generator = gen;
|
||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
||||
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 11 Jan 2025 22:50:23 +0300
|
||||
Subject: [PATCH] DivineMC Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c9cb1c64313fe107fcb66c3bde4e0bb88a7d6ab3..a5643267680262c2466b81bfe1a846027922d22f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1087,6 +1087,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 - Purpur config files
|
||||
+ space.bxteam.divinemc.configuration.DivineConfig.init((File) console.options.valueOf("divinemc-settings")); // DivineMC - DivineMC Configuration
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1103,6 +1104,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.purpurConfig.init(); // Purpur - Purpur config files
|
||||
+ world.divinemcConfig.init(); // DivineMC - DivineMC Configuration
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1121,6 +1123,7 @@ public final class CraftServer implements Server {
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur - Purpur config files
|
||||
+ space.bxteam.divinemc.configuration.DivineConfig.registerCommands(); // DivineMC - DivineMC Configuration
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -3064,6 +3067,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Purpur end - Purpur config files
|
||||
|
||||
+ // DivineMC start - DivineMC Configuration
|
||||
+ @Override
|
||||
+ public YamlConfiguration getDivineConfig() {
|
||||
+ return space.bxteam.divinemc.configuration.DivineConfig.config;
|
||||
+ }
|
||||
+ // DivineMC end - DivineMC Configuration
|
||||
+
|
||||
@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 90fb036607e752fcf43575be4f03bbf00bbb05c7..22ba21fb13ed1e3ceede833c1173d17e5b60c1b6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -183,6 +183,15 @@ public class Main {
|
||||
.defaultsTo(new File("purpur.yml"))
|
||||
.describedAs("Yml file");
|
||||
// Purpur end - Purpur config files
|
||||
+
|
||||
+ // DivineMC start - DivineMC Configuration
|
||||
+ acceptsAll(asList("divinemc", "divinemc-settings"), "File for divinemc settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("divinemc.yml"))
|
||||
+ .describedAs("Yml file");
|
||||
+ // DivineMC end - DivineMC Configuration
|
||||
+
|
||||
// Paper start
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package space.bxteam.divinemc.configuration;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
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://docs.bx-team.space/divinemc \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);
|
||||
|
||||
Block.BLOCK_STATE_REGISTRY.forEach(BlockBehaviour.BlockStateBase::initCache);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,437 +0,0 @@
|
||||
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 7b312fa229bc03df45c9d2fa340396f62570356a..c9fc57d6b00bf5ca57805c9ad2829646de347475 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -57,6 +57,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;
|
||||
@@ -259,6 +260,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
|
||||
gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
|
||||
|
||||
+ // 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 72c9b9d8f520aa29106dd28a48dcdaf9bf8ea9e6..d152815ed2b12334458eba1eb88171d563169e84 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -176,6 +176,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files
|
||||
+ public final space.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
private org.spigotmc.TickLimiter tileLimiter;
|
||||
@@ -888,6 +889,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
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 - Purpur config files
|
||||
+ this.divinemcConfig = new space.bxteam.divinemc.configuration.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 badf280a6b01b06e8148c552330872d64e6256b7..c86dd96f7abfd9fe73f9a044689f1de7374d6a48 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1101,6 +1101,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 - Purpur config files
|
||||
+ space.bxteam.divinemc.configuration.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); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1117,6 +1118,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.purpurConfig.init(); // Purpur - Purpur config files
|
||||
+ world.divinemcConfig.init(); // DivineMC
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1135,6 +1137,7 @@ public final class CraftServer implements Server {
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur - Purpur config files
|
||||
+ space.bxteam.divinemc.configuration.DivineConfig.registerCommands(); // DivineMC
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -3113,6 +3116,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Purpur end - Purpur config files
|
||||
|
||||
+ // DivineMC start
|
||||
+ @Override
|
||||
+ public YamlConfiguration getDivineConfig() {
|
||||
+ return space.bxteam.divinemc.configuration.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 22380501e8cdc09ff785c188d68601a0030fd921..b4a4bc186086e8008e0e3279364d71a1ca6f097c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -190,6 +190,14 @@ public class Main {
|
||||
.describedAs("Yml file");
|
||||
// Purpur end - Purpur config files
|
||||
|
||||
+ // 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..27c45545e1e9ad6ea88e65c884c5a4955fc1c80c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
||||
@@ -0,0 +1,157 @@
|
||||
+package space.bxteam.divinemc.configuration;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import com.google.common.collect.ImmutableMap;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
+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://docs.bx-team.space/divinemc \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);
|
||||
+
|
||||
+ Block.BLOCK_STATE_REGISTRY.forEach(BlockBehaviour.BlockStateBase::initCache);
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user