From 8b6f4dd482dc5f152a433475f20055f7fbf1b182 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 12 Jun 2022 10:07:43 +0200 Subject: [PATCH] Add paper-settings-directory cl argument (#7949) --- patches/server/0004-Paper-config-files.patch | 19 +++++++++++++------ ...-option-to-load-extra-plugin-jars-no.patch | 6 +++--- ...ient-crashes-server-lists-and-Mojang.patch | 6 +++--- .../0097-Add-server-name-parameter.patch | 4 ++-- ...oleAppender-for-console-improvements.patch | 16 ++++++++-------- .../0148-Fix-this-stupid-bullshit.patch | 4 ++-- ...61-Remove-garbage-Java-version-check.patch | 4 ++-- .../0384-Improved-Watchdog-Support.patch | 6 +++--- ...4-Bukkit-world-container-is-not-used.patch | 4 ++-- 9 files changed, 38 insertions(+), 31 deletions(-) diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index 2c109bbbd..bdfff0604 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -4093,10 +4093,10 @@ index 6cc81495d8d09ff1fbb09f2e63a16ec4fa6138ec..73662a463fc9d38b39c4c779fcfaa09a // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index 697ca7457115423a8c4d8a7d1f7a353237b56509..3997024eca83af2d82132de3bb5770e155659797 100644 +index 697ca7457115423a8c4d8a7d1f7a353237b56509..d7d65d0faefa5551480a4090de3a881828238ffd 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java -@@ -7,14 +7,28 @@ import java.io.File; +@@ -7,14 +7,30 @@ import java.io.File; import net.minecraft.server.players.GameProfileCache; import net.minecraft.util.SignatureValidator; @@ -4123,7 +4123,9 @@ index 697ca7457115423a8c4d8a7d1f7a353237b56509..3997024eca83af2d82132de3bb5770e1 SignatureValidator signatureValidator = SignatureValidator.from(authenticationService.getServicesKey()); - return new Services(minecraftSessionService, signatureValidator, gameProfileRepository, gameProfileCache); + // Paper start -+ io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(((File) optionSet.valueOf("paper-settings")).toPath(), java.nio.file.Path.of(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR), rootDirectory.toPath(), (File) optionSet.valueOf("spigot-settings")); ++ final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath(); ++ final java.nio.file.Path configDirPath = ((File) optionSet.valueOf("paper-settings-directory")).toPath(); ++ io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(legacyConfigPath, configDirPath, rootDirectory.toPath(), (File) optionSet.valueOf("spigot-settings")); + return new Services(minecraftSessionService, signatureValidator, gameProfileRepository, gameProfileCache, paperConfigurations); + // Paper end } @@ -4197,16 +4199,21 @@ index 1d94c0fbdead83155aefc8d4a16dbcb95b3c9838..42be8ab024e5c889b2a114f1098e1bed world.serverLevelData.setDifficulty(config.difficulty); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e5008c75054df38356af193fd049110d7d56e2d4..c694c6dfed0b3aa098b1822676e39bd3eb04b45a 100644 +index e5008c75054df38356af193fd049110d7d56e2d4..df98326c49973183e81ccb96d4b1a7a7626dffee 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -129,6 +129,14 @@ public class Main { +@@ -129,6 +129,19 @@ public class Main { .defaultsTo(new File("spigot.yml")) .describedAs("Yml file"); // Spigot End + + // Paper Start -+ acceptsAll(asList("paper", "paper-settings"), "File for paper settings") ++ acceptsAll(asList("paper-dir", "paper-settings-directory"), "Directory for Paper settings") ++ .withRequiredArg() ++ .ofType(File.class) ++ .defaultsTo(new File(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR)) ++ .describedAs("Config directory"); ++ acceptsAll(asList("paper", "paper-settings"), "File for Paper settings") + .withRequiredArg() + .ofType(File.class) + .defaultsTo(new File("paper.yml")) diff --git a/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch index 71568677f..aa6f0278d 100644 --- a/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c9e528c66cc2dab4895ff8b33e63d458c44cfc36..7c82bce3d17ff466ea4bd157fd4961826e31ae1d 100644 +index 441ec74f965744c384fd44795540ec1906a4815c..3a9d6ba52f512e8d2468d99783e518ef613a5822 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -394,10 +394,15 @@ public final class CraftServer implements Server { @@ -66,10 +66,10 @@ index c9e528c66cc2dab4895ff8b33e63d458c44cfc36..7c82bce3d17ff466ea4bd157fd496182 if (type == PluginLoadOrder.STARTUP) { this.helpMap.clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0d427758182ebe01d612d5140e4a0d519a96d8c0..193a97a99b8ffe54e456276445e931b2ca1d53db 100644 +index 18652607d36a980a4b0956584f8a722be776dad2..556ab2908c2a9f448d4bd856bb9fbf82867148b1 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -142,6 +142,12 @@ public class Main { +@@ -147,6 +147,12 @@ public class Main { .ofType(File.class) .defaultsTo(new File("paper.yml")) .describedAs("Yml file"); diff --git a/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 957eb4827..f0ff66217 100644 --- a/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -19,7 +19,7 @@ index 1190d62594c5b1be1c11d55e646ee0bac27307cb..c38cfd4781911db0fe191412f089c55c public SystemReport fillSystemReport(SystemReport details) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7c82bce3d17ff466ea4bd157fd4961826e31ae1d..fe2eaed213c3f816b23fb4debb4f8c508e76fb0d 100644 +index 3a9d6ba52f512e8d2468d99783e518ef613a5822..bca3b028410ca6a6d114bc192e0605ee22e3c29b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -241,7 +241,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -32,10 +32,10 @@ index 7c82bce3d17ff466ea4bd157fd4961826e31ae1d..fe2eaed213c3f816b23fb4debb4f8c50 private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 193a97a99b8ffe54e456276445e931b2ca1d53db..f017abbf3418c6000648950dc05b177f9d41f97b 100644 +index 556ab2908c2a9f448d4bd856bb9fbf82867148b1..eac977169ee071c4961ee63d2f21d76bd3e49760 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -216,12 +216,25 @@ public class Main { +@@ -221,12 +221,25 @@ public class Main { deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); diff --git a/patches/server/0097-Add-server-name-parameter.patch b/patches/server/0097-Add-server-name-parameter.patch index 8cacd0c6d..1c1c9ab15 100644 --- a/patches/server/0097-Add-server-name-parameter.patch +++ b/patches/server/0097-Add-server-name-parameter.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add server-name parameter diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index f017abbf3418c6000648950dc05b177f9d41f97b..3f531ec9232568243a15ad1b238839b8036a2d82 100644 +index eac977169ee071c4961ee63d2f21d76bd3e49760..2595ee05d1b77dee0f1f5bf11c10df186f434d84 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -149,6 +149,14 @@ public class Main { +@@ -154,6 +154,14 @@ public class Main { .defaultsTo(new File[] {}) .describedAs("Jar file"); // Paper end diff --git a/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch index 02db20f35..af463bb4b 100644 --- a/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/build.gradle.kts b/build.gradle.kts -index 9442f5e05869aeb267f8effd01974cad5f167188..a8bc19403fc82ef03e43afe8ddf5fa78890e8dda 100644 +index a87cf2a4ad955b7429269f2d46adbe59f6e4525e..30bd0b7d980652b982088b09145266bc48b07216 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,17 @@ plugins { @@ -112,7 +112,7 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e4913a7dd431dc861fa93c099e9be97f00519a18..2cdde6eaf2221bb634fd0d34db849c0a6833cfbd 100644 +index 454c3a678886649c268992bc67c6cec83cb04b76..037749e1f6a6dcd53fc4455869f5b41417ae8e94 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -157,7 +157,7 @@ import org.slf4j.Logger; @@ -171,7 +171,7 @@ index e4913a7dd431dc861fa93c099e9be97f00519a18..2cdde6eaf2221bb634fd0d34db849c0a public KeyPair getKeyPair() { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 6effe3fae35b4039fbe8dd6d6922097afed646fe..3594241f443f2ebeb21721c3fb6cc10f09e2f5ed 100644 +index ee509d7b06a9785a39b59329a19531047953831b..b248c0f481436b1b101dc1f75eaaf8023f4ba0ea 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -103,6 +103,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -236,7 +236,7 @@ index b28bb51e5476b250d9de91f2e380dd8ed2aa7041..9cb9e0a4d1467cb5c23dfd38e83d495a this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d4f944daae8139973b615983620957cf89d96e7b..a04f678289551208cfa42523ec6bf3d2e77e2fa4 100644 +index 285d6aef955692adf93808589a8dac2248c9e1a5..14d0c9f5f50aef75d67a7794a46f80f55bccf6aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -44,7 +44,6 @@ import java.util.logging.Level; @@ -262,7 +262,7 @@ index d4f944daae8139973b615983620957cf89d96e7b..a04f678289551208cfa42523ec6bf3d2 @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 3f531ec9232568243a15ad1b238839b8036a2d82..95be6c63cd30ab10d5a9f2a159e9dcadff761c99 100644 +index 2595ee05d1b77dee0f1f5bf11c10df186f434d84..254a06a07e99642f96a8df052166676928dcb855 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,7 +12,7 @@ import java.util.logging.Level; @@ -274,7 +274,7 @@ index 3f531ec9232568243a15ad1b238839b8036a2d82..95be6c63cd30ab10d5a9f2a159e9dcad public class Main { public static boolean useJline = true; -@@ -195,6 +195,8 @@ public class Main { +@@ -200,6 +200,8 @@ public class Main { } try { @@ -283,7 +283,7 @@ index 3f531ec9232568243a15ad1b238839b8036a2d82..95be6c63cd30ab10d5a9f2a159e9dcad // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); -@@ -212,9 +214,18 @@ public class Main { +@@ -217,9 +219,18 @@ public class Main { // This ensures the terminal literal will always match the jline implementation System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName()); } @@ -302,7 +302,7 @@ index 3f531ec9232568243a15ad1b238839b8036a2d82..95be6c63cd30ab10d5a9f2a159e9dcad } if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { -@@ -242,7 +253,7 @@ public class Main { +@@ -247,7 +258,7 @@ public class Main { System.out.println("Unable to read system info"); } // Paper end diff --git a/patches/server/0148-Fix-this-stupid-bullshit.patch b/patches/server/0148-Fix-this-stupid-bullshit.patch index 470a961ff..102307dc3 100644 --- a/patches/server/0148-Fix-this-stupid-bullshit.patch +++ b/patches/server/0148-Fix-this-stupid-bullshit.patch @@ -31,10 +31,10 @@ index e359919de57f97d18667df1b2f1bf54a19a49c2f..c5822637e48fad4ca4e8cf210431b5ea Bootstrap.isBootstrapped = true; if (Registry.REGISTRY.keySet().isEmpty()) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 95be6c63cd30ab10d5a9f2a159e9dcadff761c99..96c18080e663c055508e0798edb545dcecebc804 100644 +index 254a06a07e99642f96a8df052166676928dcb855..edda95afdde52df3a809c3826a3f099d5b4691ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -234,10 +234,12 @@ public class Main { +@@ -239,10 +239,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { diff --git a/patches/server/0361-Remove-garbage-Java-version-check.patch b/patches/server/0361-Remove-garbage-Java-version-check.patch index c17cd041a..c4e1fb1a9 100644 --- a/patches/server/0361-Remove-garbage-Java-version-check.patch +++ b/patches/server/0361-Remove-garbage-Java-version-check.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove garbage Java version check diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 96c18080e663c055508e0798edb545dcecebc804..fea479165e4cf1e4fc6e462d63123bf31bb4e3c3 100644 +index edda95afdde52df3a809c3826a3f099d5b4691ad..94b46dde76b186a441e6b0ef64553dcab5dfa717 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -189,10 +189,6 @@ public class Main { +@@ -194,10 +194,6 @@ public class Main { System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'."); return; } diff --git a/patches/server/0384-Improved-Watchdog-Support.patch b/patches/server/0384-Improved-Watchdog-Support.patch index 00fb07603..d4c56b0bb 100644 --- a/patches/server/0384-Improved-Watchdog-Support.patch +++ b/patches/server/0384-Improved-Watchdog-Support.patch @@ -336,7 +336,7 @@ index 943060b67d962a53bba8c2caa39de435060e036d..10d81c2300b17b9d8981450fc03915db // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index fea479165e4cf1e4fc6e462d63123bf31bb4e3c3..5e79ad04aed13462d1d187a71801aeb2628495e8 100644 +index 94b46dde76b186a441e6b0ef64553dcab5dfa717..37d38fe2077e92adc8d9ddf3bb0a02b7313fd9b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -12,6 +12,8 @@ import java.util.logging.Level; @@ -348,7 +348,7 @@ index fea479165e4cf1e4fc6e462d63123bf31bb4e3c3..5e79ad04aed13462d1d187a71801aeb2 import net.minecrell.terminalconsole.TerminalConsoleAppender; // Paper public class Main { -@@ -162,6 +164,36 @@ public class Main { +@@ -167,6 +169,36 @@ public class Main { OptionSet options = null; @@ -385,7 +385,7 @@ index fea479165e4cf1e4fc6e462d63123bf31bb4e3c3..5e79ad04aed13462d1d187a71801aeb2 try { options = parser.parse(args); } catch (joptsimple.OptionException ex) { -@@ -257,8 +289,64 @@ public class Main { +@@ -262,8 +294,64 @@ public class Main { } catch (Throwable t) { t.printStackTrace(); } diff --git a/patches/server/0467-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0467-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 1e35fd6e3..02319f589 100644 --- a/patches/server/0467-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0467-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -29,7 +29,7 @@ index 8fda43173012ed3134ed1f114143ceaad66cae4a..3e1b589031d46126bdd6b6f63d7a1333 String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index 3997024eca83af2d82132de3bb5770e155659797..fbcbec480f66f0ebb57e1b937cb1bd320d53748c 100644 +index d7d65d0faefa5551480a4090de3a881828238ffd..ef6ff78af2ae747e939895b82ee9d11c75012dcd 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java @@ -19,12 +19,12 @@ public record Services(MinecraftSessionService sessionService, SignatureValidato @@ -47,4 +47,4 @@ index 3997024eca83af2d82132de3bb5770e155659797..fbcbec480f66f0ebb57e1b937cb1bd32 + GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, userCacheFile); // Paper SignatureValidator signatureValidator = SignatureValidator.from(authenticationService.getServicesKey()); // Paper start - io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(((File) optionSet.valueOf("paper-settings")).toPath(), java.nio.file.Path.of(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR), rootDirectory.toPath(), (File) optionSet.valueOf("spigot-settings")); + final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath();