From 77de07a15d47a5648a006fe7c475bac154943352 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 9 Jun 2022 15:03:02 -0700 Subject: [PATCH] fix more config migration issues --- patches/server/0004-Paper-config-files.patch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index a10adb1d3..32cce772c 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -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> item = Registry.ITEM.getHolder(ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemName))); ++ final Optional> 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;