Archiviert
13
0

Fix sealed package check in BytecodeModifyingURLClassLoader (#10627)

Dieser Commit ist enthalten in:
Jason Penilla 2024-04-30 01:21:16 -07:00 committet von GitHub
Ursprung 25e44bc63b
Commit 3fdd0948b7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
21 geänderte Dateien mit 88 neuen und 87 gelöschten Zeilen

Datei anzeigen

@ -377,7 +377,7 @@ index 0000000000000000000000000000000000000000..d738b31f0005aca352a511c1a57e76b6
+}
diff --git a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..f3f7849412f4fd762fb044223b9fc25f6a8a0774
index 0000000000000000000000000000000000000000..265c636abfd63f9ba0b0f0198867a10401c14da1
--- /dev/null
+++ b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
@@ -0,0 +1,438 @@
@ -723,7 +723,7 @@ index 0000000000000000000000000000000000000000..f3f7849412f4fd762fb044223b9fc25f
+ }
+
+ return this.reobf.remapped().thenApplyAsync(reobfServer -> {
+ LOGGER.info("Remapping plugin '{}'...", inputFile);
+ LOGGER.info("Remapping {} '{}'...", library ? "library" : "plugin", inputFile);
+ final long start = System.currentTimeMillis();
+ try (final DebugLogger logger = DebugLogger.forOutputFile(destination)) {
+ try (final Renamer renamer = Renamer.builder()
@ -1915,32 +1915,3 @@ 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 c8c66f78335868100adbb4d044037168872d5f94..96f0c447354d8081c614e466b0c17bfdb43c6fe7 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;
@SuppressWarnings("deprecation")
public final class CraftMagicNumbers implements UnsafeValues {
+ public static final boolean DISABLE_PLUGIN_REWRITING = Boolean.getBoolean("paper.disable-plugin-rewriting");
public static final UnsafeValues INSTANCE = new CraftMagicNumbers();
private CraftMagicNumbers() {}
@@ -356,7 +357,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 (!DISABLE_PLUGIN_REWRITING && toCheck.isOlderThan(ApiVersion.FLATTENING)) { // Paper
CraftLegacy.init();
}
@@ -371,6 +372,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) {
+ if (DISABLE_PLUGIN_REWRITING) return clazz; // Paper
try {
clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()));
} catch (Exception ex) {

Datei anzeigen

@ -45,10 +45,10 @@ index 893ad5e7c2d32ccd64962d95d146bbd317c28ab8..3d73ea0e63c97b2b08e719b7be7af389
}
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/BytecodeModifyingURLClassLoader.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/BytecodeModifyingURLClassLoader.java
new file mode 100644
index 0000000000000000000000000000000000000000..405416dc3d1c8c58b4e0c880d8751ca319188f62
index 0000000000000000000000000000000000000000..1240c061c121e8d5eb9add4e5e21955ee6df9368
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/BytecodeModifyingURLClassLoader.java
@@ -0,0 +1,185 @@
@@ -0,0 +1,187 @@
+package io.papermc.paper.plugin.entrypoint.classloader;
+
+import io.papermc.paper.pluginremap.reflect.ReflectionRemapper;
@ -56,6 +56,7 @@ index 0000000000000000000000000000000000000000..405416dc3d1c8c58b4e0c880d8751ca3
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.net.JarURLConnection;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.CodeSigner;
@ -133,17 +134,18 @@ index 0000000000000000000000000000000000000000..405416dc3d1c8c58b4e0c880d8751ca3
+ String pkgname = name.substring(0, i);
+ // Check if package already loaded.
+ final @Nullable Manifest man = this.manifestFor(url);
+ if (this.getAndVerifyPackage(pkgname, man, url) == null) {
+ final URL jarUrl = URI.create(jarName(url)).toURL();
+ if (this.getAndVerifyPackage(pkgname, man, jarUrl) == null) {
+ try {
+ if (man != null) {
+ this.definePackage(pkgname, man, url);
+ this.definePackage(pkgname, man, jarUrl);
+ } else {
+ this.definePackage(pkgname, null, null, null, null, null, null, null);
+ }
+ } catch (IllegalArgumentException iae) {
+ // parallel-capable class loaders: re-verify in case of a
+ // race condition
+ if (this.getAndVerifyPackage(pkgname, man, url) == null) {
+ if (this.getAndVerifyPackage(pkgname, man, jarUrl) == null) {
+ // Should never happen
+ throw new AssertionError("Cannot find package " +
+ pkgname);
@ -258,10 +260,10 @@ index f9a2c55a354c877749db3f92956de802ae575788..39182cdd17473da0123dc7172dce507e
}
}
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..82032370e7896b621e37ee3726016440e177619f 100644
index f576060c8fe872772bbafe2016fc9b83a3c095f1..f9d4b33050a6fe8c2dabe8e5eec075d95dc513e0 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,11 @@ package io.papermc.paper.plugin.loader;
@@ -2,12 +2,12 @@ package io.papermc.paper.plugin.loader;
import io.papermc.paper.plugin.PluginInitializerManager;
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
@ -273,10 +275,11 @@ index f576060c8fe872772bbafe2016fc9b83a3c095f1..82032370e7896b621e37ee3726016440
import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
-import org.jetbrains.annotations.NotNull;
-
+import io.papermc.paper.util.MappingEnvironment;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -17,6 +16,7 @@ import java.util.ArrayList;
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.jar.JarFile;
import java.util.logging.Logger;
@ -284,39 +287,44 @@ index f576060c8fe872772bbafe2016fc9b83a3c095f1..82032370e7896b621e37ee3726016440
public class PaperClasspathBuilder implements PluginClasspathBuilder {
@@ -60,7 +60,8 @@ public class PaperClasspathBuilder implements PluginClasspathBuilder {
@@ -60,7 +61,10 @@ public class PaperClasspathBuilder implements PluginClasspathBuilder {
}
try {
- return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), new URLClassLoader(urls, getClass().getClassLoader()));
+ final URLClassLoader libraryLoader = new BytecodeModifyingURLClassLoader(urls, this.getClass().getClassLoader());
+ final URLClassLoader libraryLoader = MappingEnvironment.DISABLE_PLUGIN_REWRITING
+ ? new URLClassLoader(urls, this.getClass().getClassLoader())
+ : new BytecodeModifyingURLClassLoader(urls, this.getClass().getClassLoader());
+ return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), libraryLoader);
} catch (IOException exception) {
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..31f05a7336ea124d24a5059652a2950a9f672758 100644
index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058 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,11 @@
@@ -1,9 +1,12 @@
package io.papermc.paper.plugin.provider.type.spigot;
+import io.papermc.paper.plugin.entrypoint.classloader.BytecodeModifyingURLClassLoader;
import io.papermc.paper.plugin.provider.configuration.serializer.constraints.PluginConfigConstraints;
import io.papermc.paper.plugin.provider.type.PluginTypeFactory;
+import io.papermc.paper.util.MappingEnvironment;
import org.bukkit.plugin.InvalidDescriptionException;
import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.java.LibraryLoader;
import org.yaml.snakeyaml.error.YAMLException;
import java.io.IOException;
@@ -15,6 +17,10 @@ import java.util.jar.JarFile;
@@ -15,6 +18,12 @@ import java.util.jar.JarFile;
class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvider, PluginDescriptionFile> {
+ static {
+ if (!MappingEnvironment.DISABLE_PLUGIN_REWRITING) {
+ LibraryLoader.LIBRARY_LOADER_FACTORY = BytecodeModifyingURLClassLoader::new;
+ }
+ }
+
@Override
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {
@ -600,13 +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..38745299ea49f253a410e77557100903ecb472b0 100644
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..4d57213c9917ea965bfe06a5d242e61422457ee2 100644
--- a/src/main/java/io/papermc/paper/util/MappingEnvironment.java
+++ b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
@@ -10,6 +10,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
@@ -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 String LEGACY_CB_VERSION = "v1_20_R4";
private static final @Nullable String MAPPINGS_HASH = readMappingsHash();
private static final boolean REOBF = checkReobf();
@ -696,3 +705,24 @@ index 8420a53672cfb0f060d9c85c445d200b6701f521..fc04bfcb8b5dfa6d093c8d75b2f20c50
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 c8c66f78335868100adbb4d044037168872d5f94..beffeedee0afdb885558c832f8801cd713d741a3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -356,7 +356,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
CraftLegacy.init();
}
@@ -371,6 +371,7 @@ 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
try {
clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()));
} catch (Exception ex) {

Datei anzeigen

@ -2005,10 +2005,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 96f0c447354d8081c614e466b0c17bfdb43c6fe7..71a3a506f92b6881602b2e77a9b5ecfb6930cb2a 100644
index beffeedee0afdb885558c832f8801cd713d741a3..beae45fb45eb0629ba36f8daabaf7d9cb9716b71 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 {
@@ -212,6 +212,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end
// ========================================================================
@ -2021,7 +2021,7 @@ index 96f0c447354d8081c614e466b0c17bfdb43c6fe7..71a3a506f92b6881602b2e77a9b5ecfb
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
@@ -463,6 +469,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -462,6 +468,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) {
return new CraftDamageSourceBuilder(damageType);
}

Datei anzeigen

@ -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 71a3a506f92b6881602b2e77a9b5ecfb6930cb2a..2c1df47a3ef416b63ac26d7eb33fc85f5b760d23 100644
index beae45fb45eb0629ba36f8daabaf7d9cb9716b71..d568c3c85c44efc0fd0a43e7758fcd6899a60000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -474,6 +474,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -473,6 +473,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() {
return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName;
}

Datei anzeigen

@ -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 2c1df47a3ef416b63ac26d7eb33fc85f5b760d23..488946dfe508d2d2a22b9dc4f687b2292d830260 100644
index d568c3c85c44efc0fd0a43e7758fcd6899a60000..54e5d76e5ec40912a5c09123d879cd5bef8da4b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -479,6 +479,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -478,6 +478,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.PaperVersionFetcher();
}

Datei anzeigen

@ -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 488946dfe508d2d2a22b9dc4f687b2292d830260..05f073907538991cc74996cf5235351848bc03e1 100644
index 54e5d76e5ec40912a5c09123d879cd5bef8da4b1..9b199fffb86cb04b9ad0013316a911ccf59d4051 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -526,6 +526,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -525,6 +525,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
return compound;
}

Datei anzeigen

@ -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 05f073907538991cc74996cf5235351848bc03e1..30bca0a9ead81055b1e7b8d9411c515e817e3a7b 100644
index 9b199fffb86cb04b9ad0013316a911ccf59d4051..a5e9000034444fb36864020453acb0b183272922 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 {
@@ -332,7 +332,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
}

Datei anzeigen

@ -67,10 +67,10 @@ index 1460060f2ff42ebaa7b2418b375ce661c73bd17f..b9180b7552796331d09c3aef1e863a25
// 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 30bca0a9ead81055b1e7b8d9411c515e817e3a7b..a914618ddcca61f30316a97c73f88698d44bc301 100644
index a5e9000034444fb36864020453acb0b183272922..a847717c0da236ee9743773eed3f2a3f1a8b10a6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -537,6 +537,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -536,6 +536,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId();
}

Datei anzeigen

@ -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 a914618ddcca61f30316a97c73f88698d44bc301..d27175bf9899b7ee79ab697eb2c20cd2e7ca6499 100644
index a847717c0da236ee9743773eed3f2a3f1a8b10a6..dd28ead9b0d7cea53e7cf952ec1e2ca594efe0bb 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -542,6 +542,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -541,6 +541,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getMainLevelName() {
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
}

Datei anzeigen

@ -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 d27175bf9899b7ee79ab697eb2c20cd2e7ca6499..bb72e1180a354a41c2f268fec49efd98354d1395 100644
index dd28ead9b0d7cea53e7cf952ec1e2ca594efe0bb..18d46779f56f97aae264325a5202568d8a06a747 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -547,6 +547,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -546,6 +546,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
}

Datei anzeigen

@ -6,10 +6,10 @@ 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 bb72e1180a354a41c2f268fec49efd98354d1395..0254b4e5146ee7e082a467812dc04a2d07094af7 100644
index 18d46779f56f97aae264325a5202568d8a06a747..abc5f221e90fb39fe2fa192bcbd0a3bb75444d64 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 {
@@ -395,9 +395,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {

Datei anzeigen

@ -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 0254b4e5146ee7e082a467812dc04a2d07094af7..5cb1da944f0040e7c5a21db201d41fda3c5bda83 100644
index abc5f221e90fb39fe2fa192bcbd0a3bb75444d64..29661c484414e98c036045459dedf675aa661d85 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -560,6 +560,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -559,6 +559,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

Datei anzeigen

@ -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 5cb1da944f0040e7c5a21db201d41fda3c5bda83..d8d13aca9a002f92b3af2bc67b86f4f9dd092603 100644
index 29661c484414e98c036045459dedf675aa661d85..03ac06c4bd89e6da2272c3ff109a1b2d3454efd2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -572,6 +572,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -571,6 +571,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);
}

Datei anzeigen

@ -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 d8d13aca9a002f92b3af2bc67b86f4f9dd092603..a14a316d63e34ac4ac7ee81a27a8fbdfcdb2b451 100644
index 03ac06c4bd89e6da2272c3ff109a1b2d3454efd2..64327d5dd0e1ec3f5ad411ee692923a340d6174f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -510,7 +510,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -509,7 +509,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}

Datei anzeigen

@ -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 a14a316d63e34ac4ac7ee81a27a8fbdfcdb2b451..6ab39cc723f0874c28def182eaada05c11d36678 100644
index 64327d5dd0e1ec3f5ad411ee692923a340d6174f..76802c72fa2da7e8e16a7d611ac860d6d9ec7cff 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -604,6 +604,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -603,6 +603,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(material.isBlock(), material + " is not a block");
return getBlock(material).hasCollision;
}

Datei anzeigen

@ -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 6ab39cc723f0874c28def182eaada05c11d36678..e47db705f078245a2be8afc15dd081919188626e 100644
index 76802c72fa2da7e8e16a7d611ac860d6d9ec7cff..4a978ebf1b5796833d83939a9502934d18ebb549 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -617,6 +617,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -616,6 +616,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);
}

Datei anzeigen

@ -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 e47db705f078245a2be8afc15dd081919188626e..c45e2e29cade6bb8fabc19c5818d5da64a9093c3 100644
index 4a978ebf1b5796833d83939a9502934d18ebb549..a7a1c9962a57fc9ed99f1523b2f5230a55b2afd1 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 {
@@ -319,7 +319,27 @@ public final class CraftMagicNumbers implements UnsafeValues {
JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class);
net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement).getOrThrow(JsonParseException::new);
if (nms != null) {

Datei anzeigen

@ -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 c45e2e29cade6bb8fabc19c5818d5da64a9093c3..283e306d43152eeb6897ad30a30550af8a6f9ac0 100644
index a7a1c9962a57fc9ed99f1523b2f5230a55b2afd1..cf29c541b74ab37592997c31adb7b240d92b2bea 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -645,6 +645,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -644,6 +644,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end

Datei anzeigen

@ -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 283e306d43152eeb6897ad30a30550af8a6f9ac0..d7beec81ab50d1d060d7063b9ab942577b3ba311 100644
index cf29c541b74ab37592997c31adb7b240d92b2bea..12289984948b0cc34df39767945222616844aebb 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -654,6 +654,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -653,6 +653,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - spawn egg color visibility

Datei anzeigen

@ -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 d7beec81ab50d1d060d7063b9ab942577b3ba311..350abcd717e9bb2973f7470f3c529a6dee715898 100644
index 12289984948b0cc34df39767945222616844aebb..4d66c0d64af800c92e84a40e90cda9c6a49d3f04 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -644,6 +644,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -643,6 +643,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName();
}
// Paper end

Datei anzeigen

@ -28906,10 +28906,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 350abcd717e9bb2973f7470f3c529a6dee715898..2afd0335334fc2392503e598919b3eec95c73961 100644
index 4d66c0d64af800c92e84a40e90cda9c6a49d3f04..a1c9989df460d7ae3666fffe7968750832a30b85 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -526,7 +526,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -525,7 +525,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
final int dataVersion = compound.getInt("DataVersion");
@ -28918,7 +28918,7 @@ index 350abcd717e9bb2973f7470f3c529a6dee715898..2afd0335334fc2392503e598919b3eec
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}
@@ -547,7 +547,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -546,7 +546,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
int dataVersion = compound.getInt("DataVersion");