Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
Adjust config headers
Dieser Commit ist enthalten in:
Ursprung
dfc10448bb
Commit
9ad94dcbc4
@ -65,10 +65,10 @@ index 0000000000000000000000000000000000000000..817fd26cc3591f9cae0f61f4036dde43
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java b/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java b/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..cb7d11dcf13c6ac464634a7e8115bf3dee0e72a2
|
index 0000000000000000000000000000000000000000..227039a6c69c4c99bbd9c674b3aab0ef5e2c1374
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java
|
+++ b/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java
|
||||||
@@ -0,0 +1,26 @@
|
@@ -0,0 +1,27 @@
|
||||||
+package io.papermc.paper.configuration;
|
+package io.papermc.paper.configuration;
|
||||||
+
|
+
|
||||||
+import java.nio.file.Path;
|
+import java.nio.file.Path;
|
||||||
@ -85,6 +85,7 @@ index 0000000000000000000000000000000000000000..cb7d11dcf13c6ac464634a7e8115bf3d
|
|||||||
+ return YamlConfigurationLoader.builder()
|
+ return YamlConfigurationLoader.builder()
|
||||||
+ .indent(2)
|
+ .indent(2)
|
||||||
+ .nodeStyle(NodeStyle.BLOCK)
|
+ .nodeStyle(NodeStyle.BLOCK)
|
||||||
|
+ .headerMode(HeaderMode.PRESET)
|
||||||
+ .defaultOptions(options -> options.mapFactory(MapFactories.sortedNatural()));
|
+ .defaultOptions(options -> options.mapFactory(MapFactories.sortedNatural()));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -896,10 +897,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..bc46e342b398dc56c976702d98ff3646995eb41e
|
index 0000000000000000000000000000000000000000..518a00886f7bde1de95150366541fc992f178246
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
@@ -0,0 +1,396 @@
|
@@ -0,0 +1,405 @@
|
||||||
+package io.papermc.paper.configuration;
|
+package io.papermc.paper.configuration;
|
||||||
+
|
+
|
||||||
+import com.google.common.base.Suppliers;
|
+import com.google.common.base.Suppliers;
|
||||||
@ -963,6 +964,7 @@ index 0000000000000000000000000000000000000000..bc46e342b398dc56c976702d98ff3646
|
|||||||
+import java.util.HashMap;
|
+import java.util.HashMap;
|
||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
+import java.util.Map;
|
+import java.util.Map;
|
||||||
|
+import java.util.function.Function;
|
||||||
+import java.util.function.Supplier;
|
+import java.util.function.Supplier;
|
||||||
+
|
+
|
||||||
+import static com.google.common.base.Preconditions.checkState;
|
+import static com.google.common.base.Preconditions.checkState;
|
||||||
@ -978,7 +980,7 @@ index 0000000000000000000000000000000000000000..bc46e342b398dc56c976702d98ff3646
|
|||||||
+ public static final String CONFIG_DIR = "config";
|
+ public static final String CONFIG_DIR = "config";
|
||||||
+ private static final String BACKUP_DIR ="legacy-backup";
|
+ private static final String BACKUP_DIR ="legacy-backup";
|
||||||
+
|
+
|
||||||
+ private static final String GLOBAL_HEADER = """
|
+ private static final String GLOBAL_HEADER = String.format("""
|
||||||
+ This is the global configuration file for Paper.
|
+ This is the global configuration file for Paper.
|
||||||
+ As you can see, there's a lot to configure. Some options may impact gameplay, so use
|
+ As you can see, there's a lot to configure. Some options may impact gameplay, so use
|
||||||
+ with caution, and make sure you know what each option does before configuring.
|
+ with caution, and make sure you know what each option does before configuring.
|
||||||
@ -986,11 +988,12 @@ index 0000000000000000000000000000000000000000..bc46e342b398dc56c976702d98ff3646
|
|||||||
+ If you need help with the configuration or have any questions related to Paper,
|
+ If you need help with the configuration or have any questions related to Paper,
|
||||||
+ join us in our Discord or check the docs page.
|
+ join us in our Discord or check the docs page.
|
||||||
+
|
+
|
||||||
+ The world configuration options have been moved to their own files.
|
+ The world configuration options have been moved inside
|
||||||
|
+ their respective world folder. The files are named %s
|
||||||
+
|
+
|
||||||
|
+ Docs: https://docs.papermc.io/
|
||||||
+ Discord: https://discord.gg/papermc
|
+ Discord: https://discord.gg/papermc
|
||||||
+ Website: https://papermc.io/
|
+ Website: https://papermc.io/""", WORLD_CONFIG_FILE_NAME);
|
||||||
+ Docs: https://docs.papermc.io/""";
|
|
||||||
+
|
+
|
||||||
+ private static final String WORLD_DEFAULTS_HEADER = """
|
+ private static final String WORLD_DEFAULTS_HEADER = """
|
||||||
+ This is the world defaults configuration file for Paper.
|
+ This is the world defaults configuration file for Paper.
|
||||||
@ -1003,13 +1006,20 @@ index 0000000000000000000000000000000000000000..bc46e342b398dc56c976702d98ff3646
|
|||||||
+ Configuration options here apply to all worlds, unless you specify overrides inside
|
+ Configuration options here apply to all worlds, unless you specify overrides inside
|
||||||
+ the world-specific config file inside each world folder.
|
+ the world-specific config file inside each world folder.
|
||||||
+
|
+
|
||||||
|
+ Docs: https://docs.papermc.io/
|
||||||
+ Discord: https://discord.gg/papermc
|
+ Discord: https://discord.gg/papermc
|
||||||
+ Website: https://papermc.io/
|
+ Website: https://papermc.io/""";
|
||||||
+ Docs: https://docs.papermc.io/""";
|
|
||||||
+
|
+
|
||||||
+ private static final String WORLD_HEADER = """
|
+ private static final Function<ContextMap, String> WORLD_HEADER = map -> String.format("""
|
||||||
+ This is a world configuration file for Paper.
|
+ This is a world configuration file for Paper.
|
||||||
+ This file may start empty but can be filled with settings to override ones in the config/world-defaults.yml""";
|
+ This file may start empty but can be filled with settings to override ones in the %s/%s
|
||||||
|
+
|
||||||
|
+ World: %s (%s)""",
|
||||||
|
+ PaperConfigurations.CONFIG_DIR,
|
||||||
|
+ PaperConfigurations.WORLD_DEFAULTS_CONFIG_FILE_NAME,
|
||||||
|
+ map.require(WORLD_NAME),
|
||||||
|
+ map.require(WORLD_KEY)
|
||||||
|
+ );
|
||||||
+
|
+
|
||||||
+ private static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) {
|
+ private static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) {
|
||||||
+ @Override // override to ensure "verbose" is false
|
+ @Override // override to ensure "verbose" is false
|
||||||
@ -1084,7 +1094,7 @@ index 0000000000000000000000000000000000000000..bc46e342b398dc56c976702d98ff3646
|
|||||||
+ protected YamlConfigurationLoader.Builder createWorldConfigLoaderBuilder(final ContextMap contextMap) {
|
+ protected YamlConfigurationLoader.Builder createWorldConfigLoaderBuilder(final ContextMap contextMap) {
|
||||||
+ return super.createWorldConfigLoaderBuilder(contextMap)
|
+ return super.createWorldConfigLoaderBuilder(contextMap)
|
||||||
+ .defaultOptions(options -> options
|
+ .defaultOptions(options -> options
|
||||||
+ .header(contextMap.require(WORLD_NAME).equals(WORLD_DEFAULTS) ? WORLD_DEFAULTS_HEADER : WORLD_HEADER)
|
+ .header(contextMap.require(WORLD_NAME).equals(WORLD_DEFAULTS) ? WORLD_DEFAULTS_HEADER : WORLD_HEADER.apply(contextMap))
|
||||||
+ .serializers(serializers -> serializers
|
+ .serializers(serializers -> serializers
|
||||||
+ .register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
+ .register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
||||||
+ .register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
+ .register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
||||||
|
@ -1017,7 +1017,7 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
index bc46e342b398dc56c976702d98ff3646995eb41e..39522b2150106082754150ca77cb04e80ae35fac 100644
|
index 518a00886f7bde1de95150366541fc992f178246..15b6e73413eeaef4214889fc34f9af8093574b9a 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
||||||
@ -1027,7 +1027,7 @@ index bc46e342b398dc56c976702d98ff3646995eb41e..39522b2150106082754150ca77cb04e8
|
|||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Table;
|
import com.google.common.collect.Table;
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
@@ -192,6 +193,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -201,6 +202,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
.register(DoubleOrDefault.SERIALIZER)
|
.register(DoubleOrDefault.SERIALIZER)
|
||||||
.register(BooleanOrDefault.SERIALIZER)
|
.register(BooleanOrDefault.SERIALIZER)
|
||||||
.register(Duration.SERIALIZER)
|
.register(Duration.SERIALIZER)
|
||||||
@ -1172,7 +1172,7 @@ index d95db45e21861eb9f1623c44dd797429ae158760..1c3dacd12ff5f26dd5559d0b99c917a0
|
|||||||
List<Entity> list = Lists.newArrayList();
|
List<Entity> list = Lists.newArrayList();
|
||||||
List<Entity> list1 = Lists.newArrayList();
|
List<Entity> list1 = Lists.newArrayList();
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index aff0c117d88afab7d670a1ce95beda3df95fa0c2..bbe5e04ac07b47c143c46b3f728b8d5f968cc7f0 100644
|
index b2a8faec6562d784b3f16fe968c778f9abfedeb5..651e8fa620273c64ed94680c2c0ed378d152f459 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -402,7 +402,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -402,7 +402,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@ -1619,7 +1619,7 @@ index 66bd0ff02c6085d41251808140aceefa02782b1f..0c2658c2cd411b6e5e5dcb9a190e7b22
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 65edea6420256384a108663761ac9619ba110a8e..759370eff9dd53f41d7b00b8372154acf43908e6 100644
|
index 5c3744860ebbb54dc38200c1557d98f995de6c3f..86e512629b5ee0133b1c0b9e3d8ec2d4023661f0 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -401,11 +401,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@@ -401,11 +401,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren