diff options
author | Jake Potrebic <[email protected]> | 2024-04-25 23:29:16 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-25 23:29:16 -0700 |
commit | 7e9da43b33aab434a49743e7bc5e969a7bf3e7d2 (patch) | |
tree | ec31eb15303ab9d9b21c73b79895947460859356 | |
parent | 2997fd6459c4518e3d0006ea7fc2b6a93e1cfea7 (diff) | |
download | Paper-7e9da43b33aab434a49743e7bc5e969a7bf3e7d2.tar.gz Paper-7e9da43b33aab434a49743e7bc5e969a7bf3e7d2.zip |
support patch versions in api-version
24 files changed, 77 insertions, 124 deletions
diff --git a/patches/server/0019-Paper-Plugins.patch b/patches/server/0019-Paper-Plugins.patch index 9a291f527d..cd028c0ffb 100644 --- a/patches/server/0019-Paper-Plugins.patch +++ b/patches/server/0019-Paper-Plugins.patch @@ -4861,10 +4861,10 @@ index 0000000000000000000000000000000000000000..e3430f535e8e9c3b8b44bf2daece8c47 +} diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java new file mode 100644 -index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940aee49799b +index 0000000000000000000000000000000000000000..c685871155c8dff1d57ff151d7a5ec70350e5390 --- /dev/null +++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java -@@ -0,0 +1,248 @@ +@@ -0,0 +1,271 @@ +package io.papermc.paper.plugin.provider.configuration; + +import com.google.common.base.Preconditions; @@ -4878,6 +4878,9 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a +import io.papermc.paper.plugin.provider.configuration.type.DependencyConfiguration; +import io.papermc.paper.plugin.provider.configuration.type.PermissionConfiguration; +import io.papermc.paper.plugin.provider.configuration.type.PluginDependencyLifeCycle; ++import java.lang.reflect.Type; ++import java.util.function.Predicate; ++import org.bukkit.craftbukkit.util.ApiVersion; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; +import org.bukkit.plugin.PluginLoadOrder; @@ -4890,6 +4893,8 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a +import org.spongepowered.configurate.objectmapping.ConfigSerializable; +import org.spongepowered.configurate.objectmapping.ObjectMapper; +import org.spongepowered.configurate.objectmapping.meta.Required; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; +import org.spongepowered.configurate.yaml.NodeStyle; +import org.spongepowered.configurate.yaml.YamlConfigurationLoader; + @@ -4925,14 +4930,14 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a + @FlattenedResolver + private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of()); + @Required -+ @PluginConfigConstraints.PluginVersion -+ private String apiVersion; ++ private ApiVersion apiVersion; + + private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class); + + public PaperPluginMeta() { + } + ++ static final ApiVersion MINIMUM = ApiVersion.getOrCreateVersion("1.19"); + public static PaperPluginMeta create(BufferedReader reader) throws ConfigurateException { + YamlConfigurationLoader loader = YamlConfigurationLoader.builder() + .indent(2) @@ -4943,6 +4948,25 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a + + return options.serializers((serializers) -> { + serializers ++ .register(new ScalarSerializer<>(ApiVersion.class) { ++ @Override ++ public ApiVersion deserialize(final Type type, final Object obj) throws SerializationException { ++ try { ++ final ApiVersion version = ApiVersion.getOrCreateVersion(obj.toString()); ++ if (version.isOlderThan(MINIMUM)) { ++ throw new SerializationException(version + " is too old for a paper plugin!"); ++ } ++ return version; ++ } catch (final IllegalArgumentException e) { ++ throw new SerializationException(e); ++ } ++ } ++ ++ @Override ++ protected Object serialize(final ApiVersion item, final Predicate<Class<?>> typeSupported) { ++ return item.getVersionString(); ++ } ++ }) + .register(new EnumValueSerializer()) + .register(PermissionConfiguration.class, PermissionConfigurationSerializer.SERIALIZER) + .register(new ComponentSerializer()) @@ -4950,7 +4974,6 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a + ObjectMapper.factoryBuilder() + .addConstraint(Constraint.class, new Constraint.Factory()) + .addConstraint(PluginConfigConstraints.PluginName.class, String.class, new PluginConfigConstraints.PluginName.Factory()) -+ .addConstraint(PluginConfigConstraints.PluginVersion.class, String.class, new PluginConfigConstraints.PluginVersion.Factory()) + .addConstraint(PluginConfigConstraints.PluginNameSpace.class, String.class, new PluginConfigConstraints.PluginNameSpace.Factory()) + .addNodeResolver(new FlattenedResolver.Factory()) + .build() @@ -5092,7 +5115,7 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a + + @Override + public @NotNull String getAPIVersion() { -+ return this.apiVersion; ++ return this.apiVersion.getVersionString(); + } + + @Override @@ -5322,10 +5345,10 @@ index 0000000000000000000000000000000000000000..f951f4024745503e9cdfa7ff17b9313a +} diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java new file mode 100644 -index 0000000000000000000000000000000000000000..2e02f73b857c530a0cce3a8d6aae46e3b0966486 +index 0000000000000000000000000000000000000000..3043a4216ec13c3de0cb931f11492ded1e6dc8de --- /dev/null +++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java -@@ -0,0 +1,86 @@ +@@ -0,0 +1,67 @@ +package io.papermc.paper.plugin.provider.configuration.serializer.constraints; + +import io.papermc.paper.plugin.util.NamespaceChecker; @@ -5345,7 +5368,6 @@ index 0000000000000000000000000000000000000000..2e02f73b857c530a0cce3a8d6aae46e3 +public final class PluginConfigConstraints { + + public static final Set<String> RESERVED_KEYS = Set.of("bukkit", "minecraft", "mojang", "spigot", "paper"); -+ public static final Set<String> VALID_PAPER_VERSIONS = Set.of("1.19", "1.20"); + + @Documented + @Retention(RetentionPolicy.RUNTIME) @@ -5393,24 +5415,6 @@ index 0000000000000000000000000000000000000000..2e02f73b857c530a0cce3a8d6aae46e3 + } + } + } -+ -+ @Documented -+ @Retention(RetentionPolicy.RUNTIME) -+ @Target(ElementType.FIELD) -+ public @interface PluginVersion { -+ -+ final class Factory implements Constraint.Factory<PluginVersion, String> { -+ -+ @Override -+ public Constraint<String> make(PluginVersion data, Type type) { -+ return value -> { -+ if (value != null && !VALID_PAPER_VERSIONS.contains(value)) { -+ throw new SerializationException("Provided plugin's version (%s) is not supported on this version.".formatted(value)); -+ } -+ }; -+ } -+ } -+ } +} diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java new file mode 100644 @@ -7322,17 +7326,21 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7 @Override public FileConfiguration getConfig() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index da97b4e91b7952f1459e59c74447a659842990bc..adf28b8e77d42267ce41713e031ee316366202e8 100644 +index da97b4e91b7952f1459e59c74447a659842990bc..fb8d14a2bdaaa25a2237fa4161388439ea8cfc0f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -421,6 +421,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -421,6 +421,16 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); return nmsItemStack.getItem().getDescriptionId(nmsItemStack); } + // Paper start + @Override + public boolean isSupportedApiVersion(String apiVersion) { -+ return apiVersion != null && SUPPORTED_API.contains(apiVersion); ++ if (apiVersion == null) return false; ++ final ApiVersion toCheck = ApiVersion.getOrCreateVersion(apiVersion); ++ final ApiVersion minimumVersion = MinecraftServer.getServer().server.minimumAPI; ++ ++ return !toCheck.isNewerThan(ApiVersion.CURRENT) && !toCheck.isOlderThan(minimumVersion); + } + // Paper end diff --git a/patches/server/0020-Plugin-remapping.patch b/patches/server/0020-Plugin-remapping.patch index 35b7e6ecc9..e183741195 100644 --- a/patches/server/0020-Plugin-remapping.patch +++ b/patches/server/0020-Plugin-remapping.patch @@ -1836,7 +1836,7 @@ index 45160b93a24dc74f6368441e2a4fe659ceaf5bf5..6573e72d041714ccc2bf0e3c8734bc21 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index adf28b8e77d42267ce41713e031ee316366202e8..29698be6e4990769cbe1c00088dfb9cfc73d966a 100644 +index fb8d14a2bdaaa25a2237fa4161388439ea8cfc0f..fdeec67b7f71700f88714b8ad734a5525fb119fd 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -72,6 +72,7 @@ import org.bukkit.potion.PotionType; diff --git a/patches/server/0025-Timings-v2.patch b/patches/server/0025-Timings-v2.patch index e82b379523..8a207ead75 100644 --- a/patches/server/0025-Timings-v2.patch +++ b/patches/server/0025-Timings-v2.patch @@ -2005,7 +2005,7 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222 + } // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 29698be6e4990769cbe1c00088dfb9cfc73d966a..b1c07c945758e4cf4af86caa1dda47688feba849 100644 +index fdeec67b7f71700f88714b8ad734a5525fb119fd..9ae089c6dbb1cc919b005fd9672a690f89ca2b42 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -2021,7 +2021,7 @@ index 29698be6e4990769cbe1c00088dfb9cfc73d966a..b1c07c945758e4cf4af86caa1dda4768 public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -459,6 +465,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -463,6 +469,12 @@ public final class CraftMagicNumbers implements UnsafeValues { public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) { return new CraftDamageSourceBuilder(damageType); } diff --git a/patches/server/0038-Implement-Paper-VersionChecker.patch b/patches/server/0038-Implement-Paper-VersionChecker.patch index 9e9309575e..484e0425d5 100644 --- a/patches/server/0038-Implement-Paper-VersionChecker.patch +++ b/patches/server/0038-Implement-Paper-VersionChecker.patch @@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..22a55be34fde453fedd987173d95b8b3 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index b1c07c945758e4cf4af86caa1dda47688feba849..9e6e6ba95d5cd6cc5d4ada6ac5637b7b82e6fc97 100644 +index 9ae089c6dbb1cc919b005fd9672a690f89ca2b42..2f21520106aa848a9108937474570a8c4e723cfb 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -470,6 +470,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -474,6 +474,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getTimingsServerName() { return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; } diff --git a/patches/server/0338-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/0338-Add-Raw-Byte-ItemStack-Serialization.patch index 2af7eead67..711b66b07b 100644 --- a/patches/server/0338-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/0338-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 9e6e6ba95d5cd6cc5d4ada6ac5637b7b82e6fc97..9d81a9893ea556b93127130e575be6c422247049 100644 +index 2f21520106aa848a9108937474570a8c4e723cfb..13568d93bf9c0243a9505d1c0aa36fb912bf2bb7 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -475,6 +475,53 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -479,6 +479,53 @@ public final class CraftMagicNumbers implements UnsafeValues { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.PaperVersionFetcher(); } diff --git a/patches/server/0427-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0427-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 963d315a4a..a704a14645 100644 --- a/patches/server/0427-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0427-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -21,10 +21,10 @@ index c8e4e37b706bd8cb9698ac2d13d0d8668e2d1d14..909575a02bf5f7040eb9c8edb034e7b6 + // Paper end - Expose entity id counter } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 9d81a9893ea556b93127130e575be6c422247049..afd99d6a1c0face439cea5cf3e9646fe7139e77f 100644 +index 13568d93bf9c0243a9505d1c0aa36fb912bf2bb7..b338b83d333b420c54c0362e2fc9839332fcc32e 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -522,6 +522,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -526,6 +526,11 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); return compound; } diff --git a/patches/server/0443-Fix-client-lag-on-advancement-loading.patch b/patches/server/0443-Fix-client-lag-on-advancement-loading.patch index a6e8dc2ab3..aca8035481 100644 --- a/patches/server/0443-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0443-Fix-client-lag-on-advancement-loading.patch @@ -15,7 +15,7 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index afd99d6a1c0face439cea5cf3e9646fe7139e77f..75d78e99a9191547d95c340c34876398b694bee3 100644 +index b338b83d333b420c54c0362e2fc9839332fcc32e..07befa14f64c5ae097378023a5b352278df2731a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0518-Expand-world-key-API.patch b/patches/server/0518-Expand-world-key-API.patch index 079814d60c..ead35a3b57 100644 --- a/patches/server/0518-Expand-world-key-API.patch +++ b/patches/server/0518-Expand-world-key-API.patch @@ -67,10 +67,10 @@ index 99fa8f65801b1816b788fa42d49d6672bf331579..6debfd5866d4411ef8d51995bd07a0e2 // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 75d78e99a9191547d95c340c34876398b694bee3..a3366affccd901f35e5a018f4fb7614c621d2912 100644 +index 07befa14f64c5ae097378023a5b352278df2731a..c0592a85a1a0781b83232533b9ca1b30b116eb98 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -533,6 +533,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -537,6 +537,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public int nextEntityId() { return net.minecraft.world.entity.Entity.nextEntityId(); } diff --git a/patches/server/0520-Item-Rarity-API.patch b/patches/server/0520-Item-Rarity-API.patch index 208a0fa62d..789b4967f0 100644 --- a/patches/server/0520-Item-Rarity-API.patch +++ b/patches/server/0520-Item-Rarity-API.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Item Rarity API public net.minecraft.world.item.Item rarity diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a3366affccd901f35e5a018f4fb7614c621d2912..1b4ea6cd4388b8d273816725dcd15d16f99d5695 100644 +index c0592a85a1a0781b83232533b9ca1b30b116eb98..125ed63d8ae812284cd452b4387fd0d674c9c25a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -538,6 +538,20 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -542,6 +542,20 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getMainLevelName() { return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName; } diff --git a/patches/server/0524-Expose-protocol-version.patch b/patches/server/0524-Expose-protocol-version.patch index 6c32427e95..fc6a93944d 100644 --- a/patches/server/0524-Expose-protocol-version.patch +++ b/patches/server/0524-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 1b4ea6cd4388b8d273816725dcd15d16f99d5695..75a53b4e8aa917399bc2054c3dde3e2f56362b45 100644 +index 125ed63d8ae812284cd452b4387fd0d674c9c25a..c4457bb46c3e66f5954383fb18b6109a5fe2772d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -552,6 +552,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -556,6 +556,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { return io.papermc.paper.inventory.ItemRarity.values()[itemStack.getRarity().ordinal()]; } diff --git a/patches/server/0551-ItemStack-repair-check-API.patch b/patches/server/0551-ItemStack-repair-check-API.patch index 3d578b8457..04cf961fe1 100644 --- a/patches/server/0551-ItemStack-repair-check-API.patch +++ b/patches/server/0551-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 75a53b4e8aa917399bc2054c3dde3e2f56362b45..6b3fbdf0a53f95c43eee7b745d85e8fcf84413b0 100644 +index c4457bb46c3e66f5954383fb18b6109a5fe2772d..a8ac14a908060aa656756ad728d0d1e826d3bbe7 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -553,6 +553,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -557,6 +557,14 @@ public final class CraftMagicNumbers implements UnsafeValues { return io.papermc.paper.inventory.ItemRarity.values()[itemStack.getRarity().ordinal()]; } diff --git a/patches/server/0558-Fix-item-default-attributes-API.patch b/patches/server/0558-Fix-item-default-attributes-API.patch index a3726019c7..b1e4c1dbd5 100644 --- a/patches/server/0558-Fix-item-default-attributes-API.patch +++ b/patches/server/0558-Fix-item-default-attributes-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix item default attributes API (previously added this API but upstream also added it) diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6b3fbdf0a53f95c43eee7b745d85e8fcf84413b0..bbe66459f29edf0c3de289a8b8a93e926323f82a 100644 +index a8ac14a908060aa656756ad728d0d1e826d3bbe7..991a63f1a7cbd5d2cb88784a59ed0085b7bdfbe2 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -396,9 +396,14 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0606-Get-entity-default-attributes.patch b/patches/server/0606-Get-entity-default-attributes.patch index ac552e1e77..616f74da09 100644 --- a/patches/server/0606-Get-entity-default-attributes.patch +++ b/patches/server/0606-Get-entity-default-attributes.patch @@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index bbe66459f29edf0c3de289a8b8a93e926323f82a..c9c18f0e1d7ccb2c7024ed60bf1ac99d30f0104d 100644 +index 991a63f1a7cbd5d2cb88784a59ed0085b7bdfbe2..4e02a5c432f0d9ff705c7f02dfccbc7d76d39805 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -570,6 +570,18 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -574,6 +574,18 @@ public final class CraftMagicNumbers implements UnsafeValues { public int getProtocolVersion() { return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion(); } diff --git a/patches/server/0612-Add-isCollidable-methods-to-various-places.patch b/patches/server/0612-Add-isCollidable-methods-to-various-places.patch index 6bcc5653a6..e7b98fac20 100644 --- a/patches/server/0612-Add-isCollidable-methods-to-various-places.patch +++ b/patches/server/0612-Add-isCollidable-methods-to-various-places.patch @@ -39,10 +39,10 @@ index 1002123cd0c6f57cecc4e80f5f21cc6ff5886d37..e96023b71845526383288917e8d7c575 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index c9c18f0e1d7ccb2c7024ed60bf1ac99d30f0104d..71488300c3c4e45e6a8742c70f156fbc901efe5e 100644 +index 4e02a5c432f0d9ff705c7f02dfccbc7d76d39805..c1c90d38ceaf7020dc19f1774cc88dbff1f05caf 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -582,6 +582,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -586,6 +586,12 @@ public final class CraftMagicNumbers implements UnsafeValues { var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); } diff --git a/patches/server/0615-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0615-Add-Raw-Byte-Entity-Serialization.patch index 5007c8b775..4e849ec251 100644 --- a/patches/server/0615-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0615-Add-Raw-Byte-Entity-Serialization.patch @@ -50,10 +50,10 @@ index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0c @Override public boolean isInvisible() { // Paper - moved up from LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 71488300c3c4e45e6a8742c70f156fbc901efe5e..277ed7b7281821b25d508e0faf56433ef2ede59e 100644 +index c1c90d38ceaf7020dc19f1774cc88dbff1f05caf..af29b750a066ba44d6869eb8d466c3028c5c874d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -506,7 +506,33 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -510,7 +510,33 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } diff --git a/patches/server/0757-Add-NamespacedKey-biome-methods.patch b/patches/server/0757-Add-NamespacedKey-biome-methods.patch index 94253c34e4..910ff7350d 100644 --- a/patches/server/0757-Add-NamespacedKey-biome-methods.patch +++ b/patches/server/0757-Add-NamespacedKey-biome-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods Co-authored-by: Thonk <[email protected]> diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 277ed7b7281821b25d508e0faf56433ef2ede59e..b44aa2f312d3cf51741c1a8e10dee366a724dc13 100644 +index af29b750a066ba44d6869eb8d466c3028c5c874d..7852b06b3cd3bb8ca761e9d05b172a27f9ef6330 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -614,6 +614,19 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -618,6 +618,19 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(material.isBlock(), material + " is not a block"); return getBlock(material).hasCollision; } diff --git a/patches/server/0884-Fix-custom-statistic-criteria-creation.patch b/patches/server/0884-Fix-custom-statistic-criteria-creation.patch index 30ac66f7e8..dbad1b4c5e 100644 --- a/patches/server/0884-Fix-custom-statistic-criteria-creation.patch +++ b/patches/server/0884-Fix-custom-statistic-criteria-creation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix custom statistic criteria creation diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index b44aa2f312d3cf51741c1a8e10dee366a724dc13..c5042837254bdc84e3064941b7aa567348af77a2 100644 +index 7852b06b3cd3bb8ca761e9d05b172a27f9ef6330..1a92d22d2b536a84af1cc404ca9809cae066407a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -627,6 +627,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -631,6 +631,12 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey))); cra.setBiome(x, y, z, biomeBase); } diff --git a/patches/server/0922-Fix-UnsafeValues-loadAdvancement.patch b/patches/server/0922-Fix-UnsafeValues-loadAdvancement.patch index 458f262592..84ec6f0acd 100644 --- a/patches/server/0922-Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/0922-Fix-UnsafeValues-loadAdvancement.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index c5042837254bdc84e3064941b7aa567348af77a2..8dde83ba89ee5b29dcc8cc89dbf9274fea46eb00 100644 +index 1a92d22d2b536a84af1cc404ca9809cae066407a..0a59d4354e332f4dba99404b770eb88f418546ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -320,7 +320,27 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0957-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/0957-Add-api-for-spawn-egg-texture-colors.patch index 5b26539aae..3f171b51f4 100644 --- a/patches/server/0957-Add-api-for-spawn-egg-texture-colors.patch +++ b/patches/server/0957-Add-api-for-spawn-egg-texture-colors.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 8dde83ba89ee5b29dcc8cc89dbf9274fea46eb00..0ea32cb3ccfc07b62fb174a381a24d52d082b5b4 100644 +index 0a59d4354e332f4dba99404b770eb88f418546ca..4213e5debc1737364de0dae42fbd1cb68dcb0c83 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -655,6 +655,15 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -659,6 +659,15 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end diff --git a/patches/server/0958-Add-Lifecycle-Event-system.patch b/patches/server/0958-Add-Lifecycle-Event-system.patch index 8f5ca91ce2..6b41e179b3 100644 --- a/patches/server/0958-Add-Lifecycle-Event-system.patch +++ b/patches/server/0958-Add-Lifecycle-Event-system.patch @@ -739,10 +739,10 @@ index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a46 + // Paper end - lifecycle events } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0ea32cb3ccfc07b62fb174a381a24d52d082b5b4..90e2e6719c043b133734a5f544f7e80f6a67b2f9 100644 +index 4213e5debc1737364de0dae42fbd1cb68dcb0c83..92d7e2435ea5c8b6fe9e5d2abb9d3c8cb350ef4d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -664,6 +664,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -668,6 +668,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - spawn egg color visibility diff --git a/patches/server/0959-ItemStack-Tooltip-API.patch b/patches/server/0959-ItemStack-Tooltip-API.patch index f293e899b6..477d02c3fa 100644 --- a/patches/server/0959-ItemStack-Tooltip-API.patch +++ b/patches/server/0959-ItemStack-Tooltip-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack Tooltip API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 90e2e6719c043b133734a5f544f7e80f6a67b2f9..a59f450f6eebaa144377c62a80ccf94c8c040dcc 100644 +index 92d7e2435ea5c8b6fe9e5d2abb9d3c8cb350ef4d..2f44452631256e3d6abce02f861cc5bfa5208b53 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -654,6 +654,20 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -658,6 +658,20 @@ public final class CraftMagicNumbers implements UnsafeValues { return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName(); } // Paper end diff --git a/patches/server/0980-Rewrite-dataconverter-system.patch b/patches/server/0980-Rewrite-dataconverter-system.patch index 329de44236..bbb4bda157 100644 --- a/patches/server/0980-Rewrite-dataconverter-system.patch +++ b/patches/server/0980-Rewrite-dataconverter-system.patch @@ -28899,10 +28899,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d return nbttagcompound; }); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a59f450f6eebaa144377c62a80ccf94c8c040dcc..50068b7914e16c043ad31cf40ddc2dafdb33d324 100644 +index 2f44452631256e3d6abce02f861cc5bfa5208b53..ca1240c2534f1e6c7182996fde23e58f9c252960 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -522,7 +522,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -526,7 +526,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); final int dataVersion = compound.getInt("DataVersion"); @@ -28911,7 +28911,7 @@ index a59f450f6eebaa144377c62a80ccf94c8c040dcc..50068b7914e16c043ad31cf40ddc2daf return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } -@@ -543,7 +543,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -547,7 +547,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); int dataVersion = compound.getInt("DataVersion"); diff --git a/removed-patches-1-20-5/0042-fix-ItemMeta-removing-CustomModelData.patch b/removed-patches-1-20-5/0042-fix-ItemMeta-removing-CustomModelData.patch deleted file mode 100644 index e42dfffc09..0000000000 --- a/removed-patches-1-20-5/0042-fix-ItemMeta-removing-CustomModelData.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Tue, 2 Jan 2024 10:35:46 -0800 -Subject: [PATCH] fix ItemMeta removing CustomModelData - - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 2157034e735c3921d4ef128688c30917aaad7161..ffdea312f93d00289364ef4d41a820cd1338f3bd 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -353,7 +353,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - } - } - -- if (tag.contains(CraftMetaItem.CUSTOM_MODEL_DATA.NBT, CraftMagicNumbers.NBT.TAG_INT)) { -+ if (tag.contains(CraftMetaItem.CUSTOM_MODEL_DATA.NBT, CraftMagicNumbers.NBT.TAG_ANY_NUMBER)) { // Paper - correctly allow any number type - this.customModelData = tag.getInt(CraftMetaItem.CUSTOM_MODEL_DATA.NBT); - } - if (tag.contains(CraftMetaItem.BLOCK_DATA.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) { diff --git a/removed-patches-1-20-5/0486-Cache-burn-durations.patch b/removed-patches-1-20-5/0486-Cache-burn-durations.patch deleted file mode 100644 index 32d702d124..0000000000 --- a/removed-patches-1-20-5/0486-Cache-burn-durations.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: lukas <[email protected]> -Date: Sun, 27 Dec 2020 16:47:00 +0100 -Subject: [PATCH] Cache burn durations - - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 9801b777bc6ab7de91d82b29a142459292ee8605..8f7029e602300f68b3c8411caa2d9e0b1e8be62e 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -134,7 +134,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - this.recipeType = recipeType; // Paper - cook speed multiplier API - } - -+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations - public static Map<Item, Integer> getFuel() { -+ // Paper start - cache burn durations -+ if(cachedBurnDurations != null) { -+ return cachedBurnDurations; -+ } -+ // Paper end - cache burn durations - Map<Item, Integer> map = Maps.newLinkedHashMap(); - - AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000); -@@ -196,7 +202,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.AZALEA, 100); - AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.FLOWERING_AZALEA, 100); - AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.MANGROVE_ROOTS, 300); -- return map; -+ // Paper start - cache burn durations -+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map); -+ return cachedBurnDurations; -+ // Paper end - cache burn durations - } - - // CraftBukkit start - add fields and methods |