mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
fix more config migration issues
This commit is contained in:
parent
e5ed99a29a
commit
77de07a15d
@ -3037,10 +3037,10 @@ index 0000000000000000000000000000000000000000..75f612b04f872d0d014fdc40b07c1511
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a779e2e4875f55761a573f0db9e9d0fd177d6567
|
||||
index 0000000000000000000000000000000000000000..2de6b4fdda91e29d651ee56e6256c3466c357db0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
|
||||
@@ -0,0 +1,313 @@
|
||||
@@ -0,0 +1,319 @@
|
||||
+package io.papermc.paper.configuration.transformation.world;
|
||||
+
|
||||
+import io.papermc.paper.configuration.Configuration;
|
||||
@ -3058,6 +3058,7 @@ index 0000000000000000000000000000000000000000..a779e2e4875f55761a573f0db9e9d0fd
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Locale;
|
||||
+import java.util.Map;
|
||||
+import java.util.Optional;
|
||||
+
|
||||
@ -3076,9 +3077,12 @@ index 0000000000000000000000000000000000000000..a779e2e4875f55761a573f0db9e9d0fd
|
||||
+
|
||||
+ private static ConfigurationTransformation.Versioned versioned() {
|
||||
+ return ConfigurationTransformation.versionedBuilder().versionKey(Configuration.LEGACY_CONFIG_VERSION_FIELD)
|
||||
+ .addVersion(13, ConfigurationTransformation.builder().addAction(path("enable-old-tnt-cannon-behaviors"), TransformAction.rename("prevent-tnt-from-moving-in-water")).build()).addVersion(16, ConfigurationTransformation.builder().addAction(path("use-chunk-inhabited-timer"), (path, value) -> {
|
||||
+ .addVersion(13, ConfigurationTransformation.builder().addAction(path("enable-old-tnt-cannon-behaviors"), TransformAction.rename("prevent-tnt-from-moving-in-water")).build())
|
||||
+ .addVersion(16, ConfigurationTransformation.builder().addAction(path("use-chunk-inhabited-timer"), (path, value) -> {
|
||||
+ if (!value.getBoolean(true)) {
|
||||
+ value.raw(0);
|
||||
+ } else {
|
||||
+ value.raw(-1);
|
||||
+ }
|
||||
+ final Object[] newPath = path.array();
|
||||
+ newPath[newPath.length - 1] = "fixed-chunk-inhabited-time";
|
||||
@ -3087,6 +3091,8 @@ index 0000000000000000000000000000000000000000..a779e2e4875f55761a573f0db9e9d0fd
|
||||
+ .addVersion(18, ConfigurationTransformation.builder().addAction(path("nether-ceiling-void-damage"), (path, value) -> {
|
||||
+ if (value.getBoolean(false)) {
|
||||
+ value.raw(128);
|
||||
+ } else {
|
||||
+ value.raw(0);
|
||||
+ }
|
||||
+ final Object[] newPath = path.array();
|
||||
+ newPath[newPath.length - 1] = "nether-ceiling-void-damage-height";
|
||||
@ -3141,9 +3147,9 @@ index 0000000000000000000000000000000000000000..a779e2e4875f55761a573f0db9e9d0fd
|
||||
+ )
|
||||
+ .addVersion(26, ConfigurationTransformation.builder().addAction(path("alt-item-despawn-rate", "items", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> {
|
||||
+ String itemName = path.get(path.size() - 1).toString();
|
||||
+ final Optional<Holder<Item>> item = Registry.ITEM.getHolder(ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemName)));
|
||||
+ final Optional<Holder<Item>> item = Registry.ITEM.getHolder(ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemName.toLowerCase(Locale.ENGLISH))));
|
||||
+ if (item.isEmpty()) {
|
||||
+ itemName = Material.valueOf(itemName).getKey().getKey().toString();
|
||||
+ itemName = Material.valueOf(itemName).getKey().getKey();
|
||||
+ }
|
||||
+ final Object[] newPath = path.array();
|
||||
+ newPath[newPath.length - 1] = itemName;
|
||||
|
Loading…
Reference in New Issue
Block a user