From c14612391952848fe653b00be65af201696cf8e5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 22 Jul 2020 00:50:40 -0400 Subject: [PATCH] Load config files early on also fixes the ide commodore rewrite patch version Prep for other PR's to be updated to use these as some options need to use some values earlier --- .../Hook-into-CB-plugin-rewrites.patch | 2 +- .../Paper-config-files.patch | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch b/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch index 6bc040443a..a5e7867299 100644 --- a/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch +++ b/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ( Boolean.getBoolean( "debug.rewriteForIde" ) ) + { + // unversion incoming calls for pre-relocate debug work -+ final String NMS_REVISION_PACKAGE = "v1_13_R2/"; ++ final String NMS_REVISION_PACKAGE = "v1_15_R1/"; + + getAndRemove.put( "net/minecraft/".concat( "server/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); + getAndRemove.put( "org/bukkit/".concat( "craftbukkit/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch index 60b387e6d3..83131e2f65 100644 --- a/Spigot-Server-Patches/Paper-config-files.patch +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -3,6 +3,7 @@ From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Mon, 29 Feb 2016 21:02:09 -0600 Subject: [PATCH] Paper config files +Loads each yml file for early init too so it can be used for early options diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java new file mode 100644 @@ -614,6 +615,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -0,0 +0,0 @@ public class Main { + DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support + + dedicatedserversettings.save(); ++ // Paper start - load config files for access below if needed ++ org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = loadConfigFile((File) optionset.valueOf("bukkit-settings")); ++ org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = loadConfigFile((File) optionset.valueOf("spigot-settings")); ++ org.bukkit.configuration.file.YamlConfiguration paperConfiguration = loadConfigFile((File) optionset.valueOf("paper-settings")); ++ // Paper end ++ + java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt"); + EULA eula = new EULA(java_nio_file_path1); + +@@ -0,0 +0,0 @@ public class Main { + + } + ++ // Paper start - load config files ++ private static org.bukkit.configuration.file.YamlConfiguration loadConfigFile(File configFile) throws java.io.IOException, org.bukkit.configuration.InvalidConfigurationException { ++ org.bukkit.configuration.file.YamlConfiguration config = new org.bukkit.configuration.file.YamlConfiguration(); ++ if (configFile.exists()) { ++ config.load(configFile); ++ } ++ return config; ++ } ++ // Paper end ++ + public static void convertWorld(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, ImmutableSet> immutableset) { // CraftBukkit + Main.LOGGER.info("Forcing world upgrade! {}", convertable_conversionsession.getLevelName()); // CraftBukkit + WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, immutableset, flag); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java