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
This commit is contained in:
Aikar 2020-07-22 00:50:40 -04:00
parent dc80610ff3
commit bede4d304d
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
4 changed files with 44 additions and 9 deletions

View file

@ -3,6 +3,7 @@ From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 21:02:09 -0600 Date: Mon, 29 Feb 2016 21:02:09 -0600
Subject: [PATCH] Paper config files 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 diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
new file mode 100644 new file mode 100644
@ -614,8 +615,42 @@ index 62f62c2c98fbaff163d9079091e6f39db2d77fa0..484e78746aa62bb0b12968165bf8e056
+ } + }
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index d88946122e98abdefed54b29f510c7d4049fdff6..11ad9ca7d030895662903a09558fd353dcc3e49e 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -64,6 +64,12 @@ 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);
@@ -206,6 +212,16 @@ 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<ResourceKey<DimensionManager>> 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d5e1da2eeea7c06289f52509af844df59e8a29b2..63d3d43f74bed94cd03aa3b7254e66302be861d5 100644 index 5ffc84b40454e0d04e449e8b895fd5a44ebf34f6..c2403484daa7d0973b27654a9b48d0945661aa6c 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -77,6 +77,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -77,6 +77,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -700,7 +735,7 @@ index d05c57ce64b7d880ffd7dbd387d56f05f05cd3f0..239fa2404859d233161764cceec5cd0f
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a5c4b7f28f13f0aad4712912f60ba5fc6785539a..3d15661eb1f15f74213ecb7e8eceb1f231ad2c1c 100644 index 5014cbbeef9a9980cca43680c3378b9d6cc210d3..fc76dc4585c54608531c75e48a3bacce7dc9d729 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/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,14 @@ public class Main {

View file

@ -450,10 +450,10 @@ index da7a325d070e194cd1664ed20dcb3a762c9a517a..797654c653ec6dc4d46b457cf8a6121b
* Calculates distance between 2 entities * Calculates distance between 2 entities
* @param e1 * @param e1
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index d88946122e98abdefed54b29f510c7d4049fdff6..55c79f17a25f1bfe80cbc65e8c01ea1703f27538 100644 index 11ad9ca7d030895662903a09558fd353dcc3e49e..52476513405a28b4125170650ff53a07deba0ec2 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -87,7 +87,7 @@ public class Main { @@ -93,7 +93,7 @@ public class Main {
} }
File file = (File) optionset.valueOf("universe"); // CraftBukkit File file = (File) optionset.valueOf("universe"); // CraftBukkit

View file

@ -8,7 +8,7 @@ our own relocation. Also lets us rewrite NMS calls for when we're
debugging in an IDE pre-relocate. debugging in an IDE pre-relocate.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index ac48431777b70c200f9e4113c8a0c03957126e90..6ef2baa62cdc36c2363973f4b9235085cfb8aba6 100644 index ac48431777b70c200f9e4113c8a0c03957126e90..455989e82be5ba8e6ca3e724235d3f55a9698498 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -6,7 +6,9 @@ import java.io.FileOutputStream; @@ -6,7 +6,9 @@ import java.io.FileOutputStream;
@ -52,7 +52,7 @@ index ac48431777b70c200f9e4113c8a0c03957126e90..6ef2baa62cdc36c2363973f4b9235085
+ if ( Boolean.getBoolean( "debug.rewriteForIde" ) ) + if ( Boolean.getBoolean( "debug.rewriteForIde" ) )
+ { + {
+ // unversion incoming calls for pre-relocate debug work + // 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( "net/minecraft/".concat( "server/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE );
+ getAndRemove.put( "org/bukkit/".concat( "craftbukkit/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); + getAndRemove.put( "org/bukkit/".concat( "craftbukkit/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE );

View file

@ -2929,10 +2929,10 @@ index 99801463d958540b5148e55c1e44f90a1078c371..9615c4d324e42f7f91a7e60b6151c16d
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 55c79f17a25f1bfe80cbc65e8c01ea1703f27538..2f29d7040d37e8be2ba5f8f634011e069a07db2f 100644 index 52476513405a28b4125170650ff53a07deba0ec2..79ac93c5f2cad09a5dd0450b55c709415d5fb3e6 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -166,6 +166,7 @@ public class Main { @@ -172,6 +172,7 @@ public class Main {
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object); convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
*/ */
@ -3899,7 +3899,7 @@ index b8c15047771bd4527b86e514a3b950b2ffc6eef0..303f6b0953ff3c29bd31ec5e02386a92
HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index b1ac1387e7c9e67120f0155957a4e66cc92a6d0d..546a7eaa6cf06a37193104509d78fce7d344b224 100644 index f1b2ef8836d31ce0dd5502357d6af655eabd9006..d88e7e24d5fdd8caa075fe2aaf22f11f611e31bd 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -93,6 +93,79 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -93,6 +93,79 @@ public class WorldServer extends World implements GeneratorAccessSeed {