Split rewriting flag into paper.disableOldApiSupport and paper.disablePluginRemapping (#11108)

This commit is contained in:
Nassim Jahnke 2024-07-19 13:08:08 +02:00 committed by GitHub
parent 2a39276794
commit 75af62b298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 107 additions and 99 deletions

View File

@ -66,7 +66,7 @@ index a2bb659ae3a502d4c181d1ccbd15eefc38e4823b..8350fc099b68918fb03a21b6a5047cee
+ mainClass.set(null as String?)
+}
diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..6f14cb9a73faa1d0ae2939d08809d9f6c2a99e1d 100644
index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..49d8e207795997e5deaf830eb971067f84bfc791 100644
--- a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
+++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
@@ -6,10 +6,12 @@ import io.papermc.paper.plugin.entrypoint.Entrypoint;
@ -92,7 +92,7 @@ index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..6f14cb9a73faa1d0ae2939d08809d9f6
PluginInitializerManager(final Path pluginDirectory, final Path updateDirectory) {
this.pluginDirectory = pluginDirectory;
this.updateDirectory = updateDirectory;
+ this.pluginRemapper = Boolean.getBoolean("paper.disable-plugin-rewriting")
+ this.pluginRemapper = Boolean.getBoolean("paper.disablePluginRemapping")
+ ? null
+ : PluginRemapper.create(pluginDirectory);
+ LibraryLoader.REMAPPER = this.pluginRemapper == null ? Function.identity() : this.pluginRemapper::remapLibraries;

View File

@ -237,30 +237,19 @@ index 0000000000000000000000000000000000000000..1240c061c121e8d5eb9add4e5e21955e
+ }
+}
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java
index f9a2c55a354c877749db3f92956de802ae575788..39182cdd17473da0123dc7172dce507eab29fedc 100644
index f9a2c55a354c877749db3f92956de802ae575788..0e734c07dbe82ba4c319a237f9e79b08b57b997f 100644
--- a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java
@@ -1,12 +1,17 @@
package io.papermc.paper.plugin.entrypoint.classloader;
import io.papermc.paper.plugin.configuration.PluginMeta;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassWriter;
// Stub, implement in future.
public class PaperClassloaderBytecodeModifier implements ClassloaderBytecodeModifier {
@@ -7,6 +7,6 @@ public class PaperClassloaderBytecodeModifier implements ClassloaderBytecodeModi
@Override
public byte[] modify(PluginMeta configuration, byte[] bytecode) {
- return bytecode;
+ ClassReader classReader = new ClassReader(bytecode);
+ ClassWriter classWriter = new ClassWriter(classReader, 0);
+ classReader.accept(io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(classWriter), 0);
+ return classWriter.toByteArray();
+ return io.papermc.paper.pluginremap.reflect.ReflectionRemapper.processClass(bytecode);
}
}
diff --git a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
index f576060c8fe872772bbafe2016fc9b83a3c095f1..f9d4b33050a6fe8c2dabe8e5eec075d95dc513e0 100644
index f576060c8fe872772bbafe2016fc9b83a3c095f1..f871a329eb52da077f58d0ceaaabd3349f84cad0 100644
--- a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
+++ b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
@@ -2,12 +2,12 @@ package io.papermc.paper.plugin.loader;
@ -292,7 +281,7 @@ index f576060c8fe872772bbafe2016fc9b83a3c095f1..f9d4b33050a6fe8c2dabe8e5eec075d9
try {
- return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), new URLClassLoader(urls, getClass().getClassLoader()));
+ final URLClassLoader libraryLoader = MappingEnvironment.DISABLE_PLUGIN_REWRITING
+ final URLClassLoader libraryLoader = MappingEnvironment.DISABLE_PLUGIN_REMAPPING
+ ? new URLClassLoader(urls, this.getClass().getClassLoader())
+ : new BytecodeModifyingURLClassLoader(urls, this.getClass().getClassLoader());
+ return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), libraryLoader);
@ -300,7 +289,7 @@ index f576060c8fe872772bbafe2016fc9b83a3c095f1..f9d4b33050a6fe8c2dabe8e5eec075d9
throw new RuntimeException(exception);
}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058 100644
index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..1bf0fa1530b8e5f94d726d0313b7a00f675b500c 100644
--- a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
@@ -1,9 +1,12 @@
@ -321,7 +310,7 @@ index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..fdb52ad85cfaa1d53aadcad72cec3d3c
class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvider, PluginDescriptionFile> {
+ static {
+ if (!MappingEnvironment.DISABLE_PLUGIN_REWRITING) {
+ if (!MappingEnvironment.DISABLE_PLUGIN_REMAPPING) {
+ LibraryLoader.LIBRARY_LOADER_FACTORY = BytecodeModifyingURLClassLoader::new;
+ }
+ }
@ -331,10 +320,10 @@ index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..fdb52ad85cfaa1d53aadcad72cec3d3c
// Copied from SimplePluginManager#loadPlugins
diff --git a/src/main/java/io/papermc/paper/pluginremap/reflect/PaperReflection.java b/src/main/java/io/papermc/paper/pluginremap/reflect/PaperReflection.java
new file mode 100644
index 0000000000000000000000000000000000000000..795d79bcfc4177edfcb12cf9db392780c3f04aa7
index 0000000000000000000000000000000000000000..92bc8e4933ff13764fa2ac7f3729216332e202c9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/pluginremap/reflect/PaperReflection.java
@@ -0,0 +1,216 @@
@@ -0,0 +1,211 @@
+package io.papermc.paper.pluginremap.reflect;
+
+import com.mojang.logging.LogUtils;
@ -352,8 +341,6 @@ index 0000000000000000000000000000000000000000..795d79bcfc4177edfcb12cf9db392780
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassWriter;
+import org.slf4j.Logger;
+
+// todo proper inheritance handling
@ -541,10 +528,7 @@ index 0000000000000000000000000000000000000000..795d79bcfc4177edfcb12cf9db392780
+ // todo apply bytecode remap here as well
+ private static byte[] processClass(final byte[] bytes) {
+ try {
+ final ClassReader reader = new ClassReader(bytes);
+ final ClassWriter writer = new ClassWriter(reader, 0);
+ reader.accept(ReflectionRemapper.visitor(writer), 0);
+ return writer.toByteArray();
+ return ReflectionRemapper.processClass(bytes);
+ } catch (final Exception ex) {
+ LOGGER.warn("Failed to process class bytes", ex);
+ return bytes;
@ -553,10 +537,10 @@ index 0000000000000000000000000000000000000000..795d79bcfc4177edfcb12cf9db392780
+}
diff --git a/src/main/java/io/papermc/paper/pluginremap/reflect/ReflectionRemapper.java b/src/main/java/io/papermc/paper/pluginremap/reflect/ReflectionRemapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..5fa5868e82d1f00498d0c5771369e1718b2df4ee
index 0000000000000000000000000000000000000000..a3045afbc0cc057e99189b909367b21cf6a9e03f
--- /dev/null
+++ b/src/main/java/io/papermc/paper/pluginremap/reflect/ReflectionRemapper.java
@@ -0,0 +1,54 @@
@@ -0,0 +1,66 @@
+package io.papermc.paper.pluginremap.reflect;
+
+import io.papermc.asm.ClassInfoProvider;
@ -569,7 +553,9 @@ index 0000000000000000000000000000000000000000..5fa5868e82d1f00498d0c5771369e171
+import java.lang.reflect.Method;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Opcodes;
+
+@DefaultQualifier(NonNull.class)
@ -593,12 +579,22 @@ index 0000000000000000000000000000000000000000..5fa5868e82d1f00498d0c5771369e171
+ }
+
+ public static ClassVisitor visitor(final ClassVisitor parent) {
+ if (MappingEnvironment.reobf()) {
+ if (MappingEnvironment.reobf() || MappingEnvironment.DISABLE_PLUGIN_REMAPPING) {
+ return parent;
+ }
+ return VISITOR_FACTORY.createVisitor(parent);
+ }
+
+ public static byte[] processClass(final byte[] bytes) {
+ if (MappingEnvironment.DISABLE_PLUGIN_REMAPPING) {
+ return bytes;
+ }
+ final ClassReader classReader = new ClassReader(bytes);
+ final ClassWriter classWriter = new ClassWriter(classReader, 0);
+ classReader.accept(ReflectionRemapper.visitor(classWriter), 0);
+ return classWriter.toByteArray();
+ }
+
+ private static void setupProxy() {
+ try {
+ final byte[] bytes = ProxyGenerator.generateProxy(PaperReflection.class, PAPER_REFLECTION_HOLDER_DESC);
@ -612,14 +608,14 @@ index 0000000000000000000000000000000000000000..5fa5868e82d1f00498d0c5771369e171
+ }
+}
diff --git a/src/main/java/io/papermc/paper/util/MappingEnvironment.java b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..2458685e7612040cea9d638dd2d945da1399ed77 100644
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..fb6aa9e2575b22e3089ea7fb32e6abfa6bb07d18 100644
--- a/src/main/java/io/papermc/paper/util/MappingEnvironment.java
+++ b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
@@ -10,6 +10,8 @@ import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class)
public final class MappingEnvironment {
+ public static final boolean DISABLE_PLUGIN_REWRITING = Boolean.getBoolean("paper.disable-plugin-rewriting");
+ public static final boolean DISABLE_PLUGIN_REMAPPING = Boolean.getBoolean("paper.disablePluginRemapping");
+ public static final String LEGACY_CB_VERSION = "v1_21_R1";
private static final @Nullable String MAPPINGS_HASH = readMappingsHash();
private static final boolean REOBF = checkReobf();
@ -649,7 +645,7 @@ index 242811578a786e3807a1a7019d472d5a68f87116..0b65fdf53124f3dd042b2363b1b8df8e
return traceElements;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 421ddf6ca955215dff77655a7eda62eb9d90aa92..1cef3614e81e751c98b504c26da4718dc88746df 100644
index 421ddf6ca955215dff77655a7eda62eb9d90aa92..8a1570ceb4755a1872911751943c84b8f06eb4c2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -102,36 +102,26 @@ public class Commodore {
@ -700,33 +696,45 @@ index 421ddf6ca955215dff77655a7eda62eb9d90aa92..1cef3614e81e751c98b504c26da4718d
}
// Paper end - Plugin rewrites
@@ -214,7 +204,7 @@ public class Commodore {
@@ -214,6 +204,7 @@ public class Commodore {
visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES));
}
- cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, visitor) {
+ cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor)) { // Paper
+ visitor = io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor); // Paper
cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, visitor) {
final Set<RerouteMethodData> rerouteMethodData = new HashSet<>();
String className;
boolean isInterface;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a6de88625aeb2c5ababd476e804e9b45b1185efe..7fdc5f5b8ce2401ac480dd5691d99b2d297c6168 100644
index a6de88625aeb2c5ababd476e804e9b45b1185efe..fa2e43020fafc283a9c063d10a82280158c7f93d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -340,7 +340,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -74,6 +74,7 @@ import org.bukkit.potion.PotionType;
@SuppressWarnings("deprecation")
public final class CraftMagicNumbers implements UnsafeValues {
public static final UnsafeValues INSTANCE = new CraftMagicNumbers();
+ public static final boolean DISABLE_OLD_API_SUPPORT = Boolean.getBoolean("paper.disableOldApiSupport"); // Paper
private CraftMagicNumbers() {}
@@ -340,7 +341,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
}
- if (toCheck.isOlderThan(ApiVersion.FLATTENING)) {
+ if (!io.papermc.paper.util.MappingEnvironment.DISABLE_PLUGIN_REWRITING && toCheck.isOlderThan(ApiVersion.FLATTENING)) { // Paper
+ if (!DISABLE_OLD_API_SUPPORT && toCheck.isOlderThan(ApiVersion.FLATTENING)) { // Paper
CraftLegacy.init();
}
@@ -355,6 +355,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -355,6 +356,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) {
+ if (io.papermc.paper.util.MappingEnvironment.DISABLE_PLUGIN_REWRITING) return clazz; // Paper
+ // Paper start
+ if (DISABLE_OLD_API_SUPPORT) {
+ // Make sure we still go through our reflection rewriting if needed
+ return io.papermc.paper.pluginremap.reflect.ReflectionRemapper.processClass(clazz);
+ }
+ // Paper end
try {
clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()), ((CraftServer) Bukkit.getServer()).activeCompatibilities);
} catch (Exception ex) {

View File

@ -977,7 +977,7 @@ index d38ecbc208c34509eaf77751ac45d9ef51a5dce8..b51c3f8c485496734ea58c15377a1215
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 16cfa946f2e121594875a57e4ff982052cf5ffd1..d60c70d59d0a6ef21224c597c9015cb3f51dabb8 100644
index 449608e60f3900778247101581ff598f1637499b..bb5115b3593c314f5edfb5947a3c35a489bf71af 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@
@ -1985,10 +1985,10 @@ 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 7fdc5f5b8ce2401ac480dd5691d99b2d297c6168..3a0c10d2d3dfbd04be421225f639cbd31aa93e70 100644
index fa2e43020fafc283a9c063d10a82280158c7f93d..9576cabff99d154ef77595b074082adf9212698d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -196,6 +196,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -197,6 +197,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftNamespacedKey.toMinecraft(mat.getKey());
}
// ========================================================================
@ -2001,7 +2001,7 @@ index 7fdc5f5b8ce2401ac480dd5691d99b2d297c6168..3a0c10d2d3dfbd04be421225f639cbd3
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
@@ -436,6 +442,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -442,6 +448,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) {
return new CraftDamageSourceBuilder(damageType);
}

View File

@ -638,10 +638,10 @@ index 1c8049bbc08be77673d375205bd42a346ff951b8..e37a7aceae6c69083ecf81af4f750c01
net.minecraft.server.Main.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 3a0c10d2d3dfbd04be421225f639cbd31aa93e70..7af1d4685dcf1e73c5972cb25ded219e713b1f0a 100644
index 9576cabff99d154ef77595b074082adf9212698d..e091356ee1fa3ec09839de6ef5c450824ea40844 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -447,6 +447,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -453,6 +453,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() {
return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName;
}

View File

@ -40,7 +40,7 @@ index 2d9db1ac80216a509a7590254e422b3c4792e3ec..b31f00f2f0b7cec59301afe36c9dd7cd
playerName = gameprofile.getName();
uniqueId = gameprofile.getId();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index fec45c058695e68a907684880c87ccf11827565d..9019e25f61d4fdb7c5d12ea7630b0bc23827ab6e 100644
index 768a5c6ebc4466aae4108a79e1564b2bfc93463a..26cee48ea3650aaf87fd2ba9c70d4ca9a88e2d87 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -831,10 +831,16 @@ public abstract class PlayerList {
@ -220,10 +220,10 @@ index 4602c3d0be94f0146a2b205268f70aaf85410f20..422c25577a0d95b31b5528fad8fc9b3a
public void onEntityRemove(Entity entity) {
this.invertedVisibilityEntities.remove(entity.getUUID());
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 1cef3614e81e751c98b504c26da4718dc88746df..eeaa9787c7e04e7155b93aa8d83bd073e8dc209e 100644
index 8a1570ceb4755a1872911751943c84b8f06eb4c2..38339b8b1b3b70bbbf0259d7095b02ee8c22b609 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -447,6 +447,13 @@ public class Commodore {
@@ -448,6 +448,13 @@ public class Commodore {
}
// Paper end - Rewrite plugins

View File

@ -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 7af1d4685dcf1e73c5972cb25ded219e713b1f0a..c1511a45a11df8a08f1d19d7fbd2a478e1a6f44f 100644
index e091356ee1fa3ec09839de6ef5c450824ea40844..e6bca66597b9b5a15d911760b44641e17e42e521 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -452,6 +452,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -458,6 +458,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.PaperVersionFetcher();
}

View File

@ -21,10 +21,10 @@ index 08dd2b77df5162a3b4b6941663efaa1eb0e42746..f7cfce209dde71e61009f3678c667062
+ // 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 c1511a45a11df8a08f1d19d7fbd2a478e1a6f44f..5e20397ea379ed0df274ab73e5f8500977e08322 100644
index e6bca66597b9b5a15d911760b44641e17e42e521..2979277847635c0bef54d06be30e5051557cc5e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -499,6 +499,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -505,6 +505,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
return compound;
}

View File

@ -15,10 +15,10 @@ 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 5e20397ea379ed0df274ab73e5f8500977e08322..cf666e427d95b5fd9ce4db44e1b22e5e61ba7983 100644
index 22fc5bf2024f70f85cc278ddd374bff0a6d626fa..12c4f68623119427a30c1eec28b4aff0400aa8c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -316,7 +316,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -317,7 +317,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
}

View File

@ -893,7 +893,7 @@ index 1f58b92c17d28e14621e8dc28042a5368f1f4a1f..ef80e6b4dff557daaab1b9fde4d8d401
// PatternType
private static final FieldRenameData PATTERN_TYPE_DATA = FieldRenameData.Builder.newBuilder()
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index eeaa9787c7e04e7155b93aa8d83bd073e8dc209e..07e3ff72a186165734da56cb0a60138b7b77dc5a 100644
index 38339b8b1b3b70bbbf0259d7095b02ee8c22b609..9fffb9c9161caad8eb62a99b37d0f31862b568a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -189,20 +189,10 @@ public class Commodore {
@ -915,9 +915,9 @@ index eeaa9787c7e04e7155b93aa8d83bd073e8dc209e..07e3ff72a186165734da56cb0a60138b
- visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES));
- }
cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor)) { // Paper
final Set<RerouteMethodData> rerouteMethodData = new HashSet<>();
@@ -268,15 +258,6 @@ public class Commodore {
visitor = io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor); // Paper
cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, visitor) {
@@ -269,15 +259,6 @@ public class Commodore {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {

View File

@ -67,10 +67,10 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c
// 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 cf666e427d95b5fd9ce4db44e1b22e5e61ba7983..a58fb15e6e7054ee99560790bab0757231337ed6 100644
index 5fe9b94c342a91d6fb3bc582ac7e84cb25b90a9e..e44bcf61c09245a63d50dd1be3c5b1fca7225ff9 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -510,6 +510,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId();
}

View File

@ -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 a58fb15e6e7054ee99560790bab0757231337ed6..3f2222bfed1b852cd68b509d16d18cda9ed30237 100644
index e44bcf61c09245a63d50dd1be3c5b1fca7225ff9..fd36c8c62503e4ce035d51b0cc4e8dd55e66cc5d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -515,6 +515,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -521,6 +521,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getMainLevelName() {
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
}

View File

@ -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 3f2222bfed1b852cd68b509d16d18cda9ed30237..ee87e3d1233a9dc776d26ef535034a2c38eed958 100644
index fd36c8c62503e4ce035d51b0cc4e8dd55e66cc5d..dec695198708838fd77285ba818e82861da49a98 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -520,6 +520,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -526,6 +526,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
}

View File

@ -65,10 +65,10 @@ index 66d773cadb74f9176e6cf68a565568034f52ec63..a1f2b9d40d374e8cdbaf916b25fa74b6
return defaultAttributes.build();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index ee87e3d1233a9dc776d26ef535034a2c38eed958..e7696331e51211a4e1de9b43e7e763047d805ca0 100644
index dec695198708838fd77285ba818e82861da49a98..17fc3d78f1f5002d8f9cb2113706a2cc6a6c821f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -379,7 +379,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -385,7 +385,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {

View File

@ -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 e7696331e51211a4e1de9b43e7e763047d805ca0..64aa0228fb81e975755bf24d1a58306d5875f9c6 100644
index 17fc3d78f1f5002d8f9cb2113706a2cc6a6c821f..98f60520ced0a68dc1e35999b9eaea405a9799ed 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -532,6 +532,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -538,6 +538,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

View File

@ -164,10 +164,10 @@ index 8ca86852319d7463f60832bc98b825b0b4325995..62ada73302c6b3ce3fb2dcc8c31a1d9c
private final DisplayInfo handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 07e3ff72a186165734da56cb0a60138b7b77dc5a..376520f5136dca50a3f35a42bd1f19091df36dfd 100644
index 9fffb9c9161caad8eb62a99b37d0f31862b568a5..72eca2c6e2107f695ad6c1d85e02dae1890ea410 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -433,6 +433,11 @@ public class Commodore {
@@ -434,6 +434,11 @@ public class Commodore {
super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
return;
}

View File

@ -37,10 +37,10 @@ index eabb8b42b890224dd19b879ff276e9908674310d..803a19063c03627dbea79cb1c395ae35
+ // Paper end - old getSpawnEgg API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 376520f5136dca50a3f35a42bd1f19091df36dfd..0103dcc3f34e07c540e7db0f9bf32c358ccef8f2 100644
index 72eca2c6e2107f695ad6c1d85e02dae1890ea410..b67dfb358a9c1ae26793557ca2151357db4b1691 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -440,6 +440,15 @@ public class Commodore {
@@ -441,6 +441,15 @@ public class Commodore {
}
// Paper end

View File

@ -50,10 +50,10 @@ index 7310f53747e68b918f132ee0f0a142e36537902e..6f9286e65f7ac730b808ddf9b52c344f
@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 64aa0228fb81e975755bf24d1a58306d5875f9c6..7b111a801703dc846be82fad7b225dc1de36c7fd 100644
index 98f60520ced0a68dc1e35999b9eaea405a9799ed..5ba8ce0f8c516567f38a6f95662bde71086e6ae4 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -482,7 +482,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -488,7 +488,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7b111a801703dc846be82fad7b225dc1de36c7fd..ba82266c6f3e9e8f325b799171e8346a32033126 100644
index 5ba8ce0f8c516567f38a6f95662bde71086e6ae4..24cb9d97bb04a4fe60c46055520ec324fbf6fa3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -572,6 +572,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -578,6 +578,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Mitigate effects of WorldCreator#keepSpawnLoaded ret type
TODO: Remove in 1.21?
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 0103dcc3f34e07c540e7db0f9bf32c358ccef8f2..1c44050735430f7d9b41a95c64c57fc924b0a7bc 100644
index b67dfb358a9c1ae26793557ca2151357db4b1691..a28bd14454a599014f24ed21210a8a185ac624db 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -438,6 +438,12 @@ public class Commodore {
@@ -439,6 +439,12 @@ public class Commodore {
super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, runtimeCbPkgPrefix() + "advancement/CraftAdvancement", "getDisplay0", desc, false);
return;
}

View File

@ -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 ba82266c6f3e9e8f325b799171e8346a32033126..9b98070aa4998071b0821605f1f9bc1622716938 100644
index 24cb9d97bb04a4fe60c46055520ec324fbf6fa3b..398068e8ffa77ac7199baf7aaab5b60c9dc639f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -587,6 +587,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -593,6 +593,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - namespaced key biome methods

View File

@ -5,10 +5,10 @@ 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 9b98070aa4998071b0821605f1f9bc1622716938..c4d1cf7399a20c2067c51c81b5107a4841a35337 100644
index 48eeac0795c479ebb2ff64005b1405421131fcd7..1d98c0e9f138f122aa73e2f1dd6d485d7865720d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -301,9 +301,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -302,9 +302,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
ResourceLocation minecraftkey = CraftNamespacedKey.toMinecraft(key);
JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class);

View File

@ -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 c4d1cf7399a20c2067c51c81b5107a4841a35337..f3bc116dc9838e88a2aa9f0dfe283dbfac5b27a9 100644
index 9449fe944c7a06a8fdeaf0a0dfc7280950fdb6db..87e5ce7b30efe8ec99191208636b1420e4d002a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -631,6 +631,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -637,6 +637,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
}

View File

@ -735,10 +735,10 @@ index 7ea2676397025bdbe20f88ec122bd6d545dcf959..61c19b1005dc387d671fd72331a8774c
this.reloadCount++;
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index f3bc116dc9838e88a2aa9f0dfe283dbfac5b27a9..054058180b938101926f6613715f4266618fed94 100644
index 87e5ce7b30efe8ec99191208636b1420e4d002a1..09cba6563ae754f51cfb352ba63e097fc2bd9b65 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -640,6 +640,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -646,6 +646,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - spawn egg color visibility

View File

@ -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 054058180b938101926f6613715f4266618fed94..9fbe938e7c1efdc256aa5303651a7f14e972e559 100644
index 09cba6563ae754f51cfb352ba63e097fc2bd9b65..364202607498b376422d02d91965430e90d21fec 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -616,6 +616,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -622,6 +622,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - fix custom stats criteria creation

View File

@ -29388,10 +29388,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 9fbe938e7c1efdc256aa5303651a7f14e972e559..ff60dc1eae8d3c13006b5f19e5bb64c8309fd3d3 100644
index 364202607498b376422d02d91965430e90d21fec..e182de47cc9c12f2d7051edd0ab3d2b4267f54b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -499,7 +499,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -505,7 +505,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
final int dataVersion = compound.getInt("DataVersion");
@ -29400,7 +29400,7 @@ index 9fbe938e7c1efdc256aa5303651a7f14e972e559..ff60dc1eae8d3c13006b5f19e5bb64c8
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}
@@ -520,7 +520,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -526,7 +526,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
int dataVersion = compound.getInt("DataVersion");

View File

@ -1347,10 +1347,10 @@ index fc9aec589414bf8d3f672183928235b5b51d1a02..0f3c46b8bb93fc42160300c9988d04be
+ // Paper end - RegistrySet API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index ff60dc1eae8d3c13006b5f19e5bb64c8309fd3d3..1627e141a68b5df65dbc1526d72fbe24edc2189f 100644
index e182de47cc9c12f2d7051edd0ab3d2b4267f54b2..02be833b259873c27bd629bb3148f2286f418bc3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -662,6 +662,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -668,6 +668,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - lifecycle event API

View File

@ -205,10 +205,10 @@ index 9c004e7cb46841d874ab997bf2e3b63ae763aec7..d7c8f26b21276d9ff1d5c7c9738cc112
+ // 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 1627e141a68b5df65dbc1526d72fbe24edc2189f..28b3ad04e1f4b38ce21084864a59a2cd81b3992c 100644
index 02be833b259873c27bd629bb3148f2286f418bc3..41c34ffdf9d95a04ed55a1e09ebc78e8cf946777 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -677,6 +677,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -683,6 +683,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - hack to get tags for non server-backed registries