Drop that stuping patch name convention
This commit is contained in:
515
patches/server/0002-Empty-configuration.patch
Normal file
515
patches/server/0002-Empty-configuration.patch
Normal file
@@ -0,0 +1,515 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Fri, 10 Feb 2023 05:53:10 +0200
|
||||
Subject: [PATCH] Empty configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7da7e0aeb5eac9ac73a3570e716f1ceb11fd7027
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -0,0 +1,195 @@
|
||||
+package dev.kaiijumc.kaiiju;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import com.google.common.collect.ImmutableMap;
|
||||
+import dev.kaiijumc.kaiiju.command.KaiijuCommand;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+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.Arrays;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class KaiijuConfig {
|
||||
+ protected static final String HEADER = "This is the main configuration file for Kaiiju.\n"
|
||||
+ + "Some options may impact gameplay, so use with caution.\n"
|
||||
+ + "If you need help or have any questions related to Kaiiju,\n"
|
||||
+ + "Join our Discord server: https://discord.com/invite/qagZRAepb7\n"
|
||||
+ + "Documentation: https://github.com/KaiijuMC/Kaiiju/wiki/Configuration";
|
||||
+ protected static File CONFIG_FILE;
|
||||
+ public static YamlConfiguration config;
|
||||
+
|
||||
+ protected static Map<String, Command> commands;
|
||||
+
|
||||
+ public static int version;
|
||||
+ static boolean verbose;
|
||||
+
|
||||
+ public static void init(File configFile) {
|
||||
+ init(configFile, true);
|
||||
+ }
|
||||
+
|
||||
+ public static void reload(File configFile) {
|
||||
+ init(configFile, false);
|
||||
+ }
|
||||
+
|
||||
+ private static void init(File configFile, boolean setup) {
|
||||
+ CONFIG_FILE = configFile;
|
||||
+ config = new YamlConfiguration();
|
||||
+ if (configFile.exists()) {
|
||||
+ try {
|
||||
+ config.load(CONFIG_FILE);
|
||||
+ } catch (InvalidConfigurationException ex){
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load kaiiju.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ } catch (IOException ignore) {
|
||||
+ }
|
||||
+ }
|
||||
+ config.options().header(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ verbose = getBoolean("verbose", false);
|
||||
+
|
||||
+ commands = new HashMap<>();
|
||||
+ commands.put("kaiiju", new KaiijuCommand("kaiiju"));
|
||||
+
|
||||
+ version = getInt("config-version", 1);
|
||||
+ set("config-version", 1);
|
||||
+
|
||||
+ readConfig(KaiijuConfig.class, null, setup);
|
||||
+ }
|
||||
+
|
||||
+ 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(), "Kaiiju", entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void readConfig(Class<?> clazz, Object instance, boolean setup) {
|
||||
+ for (Method method : clazz.getDeclaredMethods()) {
|
||||
+ if (Modifier.isPrivate(method.getModifiers())) {
|
||||
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
+ if (method.getName().endsWith("Setup") && !setup) continue;
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected static void set(String path, Object val) {
|
||||
+ config.addDefault(path, val);
|
||||
+ config.set(path, val);
|
||||
+ }
|
||||
+
|
||||
+ protected static String getString(String path, String def, String... comment) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static boolean getBoolean(String path, boolean def, String... comment) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getBoolean(path, config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static double getDouble(String path, double def, String... comment) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getDouble(path, config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static int getInt(String path, int def, String... comment) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getInt(path, config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static <T> List getList(String path, T def, String... comment) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getList(path, config.getList(path));
|
||||
+ }
|
||||
+
|
||||
+ static Map<String, Object> getMap(String path, Map<String, Object> def, String... comment) {
|
||||
+ if (def != null && config.getConfigurationSection(path) == null) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return def;
|
||||
+ }
|
||||
+ return toMap(config.getConfigurationSection(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static String getString(String path, String def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static boolean getBoolean(String path, boolean def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getBoolean(path, config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static double getDouble(String path, double def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getDouble(path, config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ protected static int getInt(String path, int def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getInt(path, config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ protected 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));
|
||||
+ }
|
||||
+
|
||||
+ protected 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/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dd4c3ca77acb3aeefc69b8eb948b8b202ff87a19
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -0,0 +1,125 @@
|
||||
+package dev.kaiijumc.kaiiju;
|
||||
+
|
||||
+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 dev.kaiijumc.kaiiju.KaiijuConfig.log;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class KaiijuWorldConfig {
|
||||
+
|
||||
+ private final String worldName;
|
||||
+ private final World.Environment environment;
|
||||
+
|
||||
+ public KaiijuWorldConfig(String worldName, World.Environment environment) {
|
||||
+ this.worldName = worldName;
|
||||
+ this.environment = environment;
|
||||
+ init();
|
||||
+ }
|
||||
+
|
||||
+ public void init() {
|
||||
+ init(true);
|
||||
+ }
|
||||
+
|
||||
+ public void reload() {
|
||||
+ init(false);
|
||||
+ }
|
||||
+
|
||||
+ private void init(boolean setup) {
|
||||
+ KaiijuConfig.log("-------- World Settings For [" + worldName + "] --------");
|
||||
+ KaiijuConfig.readConfig(KaiijuWorldConfig.class, this, setup);
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, val);
|
||||
+ KaiijuConfig.config.set("world-settings.default." + path, val);
|
||||
+ if (KaiijuConfig.config.get("world-settings." + worldName + "." + path) != null) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings." + worldName + "." + path, val);
|
||||
+ KaiijuConfig.config.set("world-settings." + worldName + "." + path, val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected ConfigurationSection getConfigurationSection(String path) {
|
||||
+ ConfigurationSection section = KaiijuConfig.config.getConfigurationSection("world-settings." + worldName + "." + path);
|
||||
+ return section != null ? section : KaiijuConfig.config.getConfigurationSection("world-settings.default." + path);
|
||||
+ }
|
||||
+
|
||||
+ protected String getString(String path, String def, String... comment) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getString("world-settings." + worldName + "." + path, KaiijuConfig.config.getString("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected boolean getBoolean(String path, boolean def, String... comment) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getBoolean("world-settings." + worldName + "." + path, KaiijuConfig.config.getBoolean("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected boolean getBoolean(String path, Predicate<Boolean> predicate, String... comment) {
|
||||
+ String val = getString(path, "default", comment).toLowerCase();
|
||||
+ Boolean bool = BooleanUtils.toBooleanObject(val, "true", "false", "default");
|
||||
+ return predicate.test(bool);
|
||||
+ }
|
||||
+
|
||||
+ protected double getDouble(String path, double def, String... comment) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getDouble("world-settings." + worldName + "." + path, KaiijuConfig.config.getDouble("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected int getInt(String path, int def, String... comment) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getInt("world-settings." + worldName + "." + path, KaiijuConfig.config.getInt("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected <T> List<?> getList(String path, T def, String... comment) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getList("world-settings." + worldName + "." + path, KaiijuConfig.config.getList("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected Map<String, Object> getMap(String path, Map<String, Object> def, String... comment) {
|
||||
+ final Map<String, Object> fallback = getMap("world-settings.default." + path, def, comment);
|
||||
+ final Map<String, Object> value = getMap("world-settings." + worldName + "." + path, null, comment);
|
||||
+ return value.isEmpty() ? fallback : value;
|
||||
+ }
|
||||
+
|
||||
+ protected String getString(String path, String def) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getString("world-settings." + worldName + "." + path, KaiijuConfig.config.getString("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected boolean getBoolean(String path, boolean def) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getBoolean("world-settings." + worldName + "." + path, KaiijuConfig.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);
|
||||
+ }
|
||||
+
|
||||
+ protected double getDouble(String path, double def) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getDouble("world-settings." + worldName + "." + path, KaiijuConfig.config.getDouble("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected int getInt(String path, int def) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getInt("world-settings." + worldName + "." + path, KaiijuConfig.config.getInt("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected <T> List<?> getList(String path, T def) {
|
||||
+ KaiijuConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return KaiijuConfig.config.getList("world-settings." + worldName + "." + path, KaiijuConfig.config.getList("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ protected Map<String, Object> getMap(String path, Map<String, Object> def) {
|
||||
+ final Map<String, Object> fallback = getMap("world-settings.default." + path, def);
|
||||
+ final Map<String, Object> value = getMap("world-settings." + worldName + "." + path, null);
|
||||
+ return value.isEmpty() ? fallback : value;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..08a2375b90a2088e2bdfb3e316144677346a3dd6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java
|
||||
@@ -0,0 +1,67 @@
|
||||
+package dev.kaiijumc.kaiiju.command;
|
||||
+
|
||||
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.md_5.bungee.api.ChatColor;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import java.awt.*;
|
||||
+import java.io.File;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+import java.util.stream.Collectors;
|
||||
+import java.util.stream.Stream;
|
||||
+
|
||||
+public class KaiijuCommand extends Command {
|
||||
+ public KaiijuCommand(String name) {
|
||||
+ super(name);
|
||||
+ this.description = "Kaiiju related commands";
|
||||
+ this.usageMessage = "/kaiiju [ reload / version ]";
|
||||
+ this.setPermission("bukkit.command.kaiiju");
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ String prefix = ChatColor.of(Color.decode("#F25DF6")) + "Kaiiju » " + ChatColor.RESET;
|
||||
+
|
||||
+ if (args.length != 1) {
|
||||
+ sender.sendMessage(prefix + ChatColor.RED + "Usage: " + usageMessage);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (args[0].equalsIgnoreCase("reload")) {
|
||||
+ Command.broadcastCommandMessage(sender, prefix + ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
||||
+ Command.broadcastCommandMessage(sender, prefix + ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
+
|
||||
+ MinecraftServer console = MinecraftServer.getServer();
|
||||
+ KaiijuConfig.reload((File) console.options.valueOf("kaiiju-settings"));
|
||||
+ for (ServerLevel level : console.getAllLevels()) {
|
||||
+ level.kaiijuConfig.reload();
|
||||
+ }
|
||||
+ console.server.reloadCount++;
|
||||
+
|
||||
+ Command.broadcastCommandMessage(sender, prefix + ChatColor.GREEN + "Kaiiju 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;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 7abd4f38ae59a6019137345af960fd60a3c7adf0..426777730f77664c69bd0a084a9323d767ebc0ad 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this);
|
||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
|
||||
+ // Kaiiju start
|
||||
+ try {
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.init((java.io.File) options.valueOf("kaiiju-settings"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands();
|
||||
+ // Kaiiju end
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index afb3d0fa48b7fd6d273361c6dc32764b5d35c356..a3b4b49ca8612a61bc2e7a1e2d2e942e7ebe1883 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -167,6 +167,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
+ public final dev.kaiijumc.kaiiju.KaiijuWorldConfig kaiijuConfig; // Kaiiju
|
||||
+
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
@@ -294,6 +296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
|
||||
+ this.kaiijuConfig = new dev.kaiijumc.kaiiju.KaiijuWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Kaiiju
|
||||
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 176f3acec268dad80cc90029edd88e7a0c3e8885..48f946243af24a9d4847f6a7a59449136cf6ee83 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1067,6 +1067,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.init((File) console.options.valueOf("kaiiju-settings")); // Kaiiju
|
||||
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))
|
||||
@@ -1082,6 +1083,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
+ world.kaiijuConfig.init(); // Kaiiju
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1097,6 +1099,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands(); // Kaiiju
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -2857,6 +2860,13 @@ public final class CraftServer implements Server {
|
||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||
}
|
||||
|
||||
+ // Kaiiju start
|
||||
+ @Override
|
||||
+ public YamlConfiguration getKaiijuConfig() {
|
||||
+ return dev.kaiijumc.kaiiju.KaiijuConfig.config;
|
||||
+ }
|
||||
+ // Kaiiju 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 4966a1e3dd35357a8ea6a7d2944c84c9c3e9058e..79a004dda72365afddb80fcd730828e351d7cce1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -173,6 +173,14 @@ public class Main {
|
||||
.describedAs("Jar file");
|
||||
// Paper end
|
||||
|
||||
+ // Purpur Start
|
||||
+ acceptsAll(asList("kaiiju", "kaiiju-settings"), "File for kaiiju settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("kaiiju.yml"))
|
||||
+ .describedAs("Yml file");
|
||||
+ // Purpur end
|
||||
+
|
||||
// Paper start
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
Reference in New Issue
Block a user