Fix ABI breakage for plainSerializer (#7178)

This commit is contained in:
Josh Roy 2021-12-22 17:56:37 -05:00 committed by GitHub
parent cf621c5eb3
commit 1ce4281666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 85 additions and 61 deletions

View File

@ -379,10 +379,10 @@ index 0000000000000000000000000000000000000000..eb179aae1e1d2ce842442e49fe275827
+}
diff --git a/src/main/java/io/papermc/paper/text/PaperComponents.java b/src/main/java/io/papermc/paper/text/PaperComponents.java
new file mode 100644
index 0000000000000000000000000000000000000000..be72827aafc9a689883f936b4db97bdf01d3bb35
index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a1d2c5641
--- /dev/null
+++ b/src/main/java/io/papermc/paper/text/PaperComponents.java
@@ -0,0 +1,88 @@
@@ -0,0 +1,104 @@
+package io.papermc.paper.text;
+
+import net.kyori.adventure.text.Component;
@ -390,6 +390,7 @@ index 0000000000000000000000000000000000000000..be72827aafc9a689883f936b4db97bdf
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import org.bukkit.Bukkit;
+import org.jetbrains.annotations.NotNull;
@ -418,13 +419,28 @@ index 0000000000000000000000000000000000000000..be72827aafc9a689883f936b4db97bdf
+ * <p>Implementations may provide a serializer capable of processing any
+ * information that requires access to implementation details.</p>
+ *
+ * @deprecated will be removed in adventure 5.0.0, use {@link #plainTextSerializer()}
+ * @return a serializer to plain text
+ */
+ public static @NotNull PlainTextComponentSerializer plainSerializer() {
+ @Deprecated
+ public static @NotNull PlainComponentSerializer plainSerializer() {
+ return Bukkit.getUnsafe().plainComponentSerializer();
+ }
+
+ /**
+ * Get a serializer for {@link Component}s that will convert components to
+ * a plain-text string.
+ *
+ * <p>Implementations may provide a serializer capable of processing any
+ * information that requires access to implementation details.</p>
+ *
+ * @return a serializer to plain text
+ */
+ public static @NotNull PlainTextComponentSerializer plainTextSerializer() {
+ return Bukkit.getUnsafe().plainTextSerializer();
+ }
+
+ /**
+ * Get a serializer for {@link Component}s that will convert to and from the
+ * standard JSON serialization format using Gson.
+ *
@ -1086,16 +1102,17 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..3b10d6387606a6efbed059ce54d565bdc756e13e 100644
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..e464769f72bf7d8e0f0630fd4f03011f8ac80dc7 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -17,6 +17,13 @@ import org.bukkit.plugin.PluginDescriptionFile;
@@ -17,6 +17,14 @@ import org.bukkit.plugin.PluginDescriptionFile;
*/
@Deprecated
public interface UnsafeValues {
+ // Paper start
+ net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener();
+ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer();
+ net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer();
+ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer();
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer();
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer();
+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer();

View File

@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7
+ }
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 207c656c0a11a3a630bc70491efcf433b2681e18..195b6bb328de92c4d17d1cd14e13578226b1ac3c 100644
index e464769f72bf7d8e0f0630fd4f03011f8ac80dc7..bfeec56e83229dbfc8625b3b90bd6c138c73bc1d 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -84,5 +84,12 @@ public interface UnsafeValues {
@@ -85,5 +85,12 @@ public interface UnsafeValues {
* @return name
*/
String getTimingsServerName();

View File

@ -7,10 +7,10 @@ Not here to name and shame, only so server admins can be aware of which
plugins have and haven't been updated.
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 195b6bb328de92c4d17d1cd14e13578226b1ac3c..d6897f43a0692e031bed8a212d9a637ef548cc60 100644
index bfeec56e83229dbfc8625b3b90bd6c138c73bc1d..9341c7fbf619a42ed5329136b7fb4f52fb81a922 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -91,5 +91,11 @@ public interface UnsafeValues {
@@ -92,5 +92,11 @@ public interface UnsafeValues {
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
}

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/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index d6897f43a0692e031bed8a212d9a637ef548cc60..e348034288c74ab80360086d71f0b7f61551df24 100644
index 9341c7fbf619a42ed5329136b7fb4f52fb81a922..0f76963fb442b228ead081b1c50bfaf420d815d9 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -97,5 +97,9 @@ public interface UnsafeValues {
@@ -98,5 +98,9 @@ public interface UnsafeValues {
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
}

View File

@ -149,10 +149,10 @@ index 58c3ab444d484ac781810e26e04b9919eaff3bf2..b637686404f0aa87c6996220987ed4a3
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index e348034288c74ab80360086d71f0b7f61551df24..2d9264ffe0fee863f1b814952ef063daa7962d76 100644
index 0f76963fb442b228ead081b1c50bfaf420d815d9..5880774f1ca967894ba0bd66da20ffb97d5f6636 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -101,5 +101,34 @@ public interface UnsafeValues {
@@ -102,5 +102,34 @@ public interface UnsafeValues {
byte[] serializeItem(ItemStack item);
ItemStack deserializeItem(byte[] data);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 2d9264ffe0fee863f1b814952ef063daa7962d76..84eda68281c6c6968d95b1313a33696c3a9980d4 100644
index 5880774f1ca967894ba0bd66da20ffb97d5f6636..5a5098445eaa9399feb0f90550ab8c79376ac247 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -130,5 +130,12 @@ public interface UnsafeValues {
@@ -131,5 +131,12 @@ public interface UnsafeValues {
* @return the translation key
*/
String getTranslationKey(ItemStack itemStack);

View File

@ -61,10 +61,10 @@ index 5922f4a3d5ac69abb232e8e497d838e10e35316e..fd1f64089359bf432a4934932ca6cad4
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 84eda68281c6c6968d95b1313a33696c3a9980d4..bcd10b2c9255d778b678310febf1937301d01a50 100644
index 5a5098445eaa9399feb0f90550ab8c79376ac247..ec3a3a02cc7ed68b88cfbe6c83111bbe818c0a37 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -137,5 +137,22 @@ public interface UnsafeValues {
@@ -138,5 +138,22 @@ public interface UnsafeValues {
* Use this when sending custom packets, so that there are no collisions on the client or server.
*/
public int nextEntityId();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index bcd10b2c9255d778b678310febf1937301d01a50..6dbd520182b1e7713a68baad09b7f613424ef619 100644
index ec3a3a02cc7ed68b88cfbe6c83111bbe818c0a37..62e40c2e5f0da64a40772ae1445c679fd1c7c457 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -154,5 +154,12 @@ public interface UnsafeValues {
@@ -155,5 +155,12 @@ public interface UnsafeValues {
* @return the itemstack rarity
*/
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 6dbd520182b1e7713a68baad09b7f613424ef619..e504567cf755557be8511f2c93c171572b78e722 100644
index 62e40c2e5f0da64a40772ae1445c679fd1c7c457..e0043bb2890862d9227f5faf15a3e4993dfc59ca 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -155,6 +155,16 @@ public interface UnsafeValues {
@@ -156,6 +156,16 @@ public interface UnsafeValues {
*/
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);

View File

@ -29,10 +29,10 @@ index fd1f64089359bf432a4934932ca6cad46145c04b..d849908850025a078ec5127870ec0f61
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index e504567cf755557be8511f2c93c171572b78e722..379acee1b5f2d06e6a96f3444783f4a29ca24095 100644
index e0043bb2890862d9227f5faf15a3e4993dfc59ca..e21c42e14d9fdbe5ee9c15cfd8e408062cffc471 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -165,6 +165,18 @@ public interface UnsafeValues {
@@ -166,6 +166,18 @@ public interface UnsafeValues {
*/
public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Get entity default attributes
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 379acee1b5f2d06e6a96f3444783f4a29ca24095..0b15fe8b5da29bf691c394098f0203a49504242e 100644
index e21c42e14d9fdbe5ee9c15cfd8e408062cffc471..12b945dbae1d24c3e8a95037d17d0535108ec163 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -183,5 +183,22 @@ public interface UnsafeValues {
@@ -184,5 +184,22 @@ public interface UnsafeValues {
* @return the server's protocol version
*/
int getProtocolVersion();

View File

@ -26,10 +26,10 @@ index d849908850025a078ec5127870ec0f61d77a72e9..f24820f14d689d49dfea25605199d529
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 0b15fe8b5da29bf691c394098f0203a49504242e..c8c2e5bc2ec1d8d7ea445a1203c9d5a904dfc666 100644
index 12b945dbae1d24c3e8a95037d17d0535108ec163..85296a8aa92465e1ee8a828d56a134078b889678 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -200,5 +200,14 @@ public interface UnsafeValues {
@@ -201,5 +201,14 @@ public interface UnsafeValues {
* @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first)
*/
@org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index c8c2e5bc2ec1d8d7ea445a1203c9d5a904dfc666..014c9984018ad5e51a26228a137e1ba4eb3e80c8 100644
index 85296a8aa92465e1ee8a828d56a134078b889678..81e17ebb54f8b5c085842f223081f3d6d33a317d 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -102,6 +102,14 @@ public interface UnsafeValues {
@@ -103,6 +103,14 @@ public interface UnsafeValues {
ItemStack deserializeItem(byte[] data);

View File

@ -502,10 +502,10 @@ index 0000000000000000000000000000000000000000..eeedc30a45d9637d68f04f185b3dd90d
+}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
new file mode 100644
index 0000000000000000000000000000000000000000..f506244b4917b362a954d2bf73ba0b5f46c96843
index 0000000000000000000000000000000000000000..3661ac5e3bfdebb2911cb1b118942b9fc7884140
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -0,0 +1,359 @@
@@ -0,0 +1,361 @@
+package io.papermc.paper.adventure;
+
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
@ -527,6 +527,7 @@ index 0000000000000000000000000000000000000000..f506244b4917b362a954d2bf73ba0b5f
+import net.kyori.adventure.text.format.TextColor;
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import net.kyori.adventure.translation.GlobalTranslator;
+import net.kyori.adventure.translation.TranslationRegistry;
@ -599,6 +600,7 @@ index 0000000000000000000000000000000000000000..f506244b4917b362a954d2bf73ba0b5f
+ })
+ .build();
+ public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().flattener(FLATTENER).hexColors().useUnusualXRepeatedCharacterHexFormat().build();
+ public static final PlainComponentSerializer PLAIN_COMPONENT = PlainComponentSerializer.builder().flattener(FLATTENER).build();
+ public static final PlainTextComponentSerializer PLAIN = PlainTextComponentSerializer.builder().flattener(FLATTENER).build();
+ public static final GsonComponentSerializer GSON = GsonComponentSerializer.builder()
+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
@ -3523,10 +3525,10 @@ index f9b7b8f7ccc95b73967a51420fd6ce88d80d75fe..0de5a46423ae0403dcbfca630dfd7c5a
boolean hadFormat = false;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index afdf4bc63dfaa469a16701541332e5380a027c22..8cbd488ee38a568d746ccb909710a2bce85ab762 100644
index afdf4bc63dfaa469a16701541332e5380a027c22..df92e13eafbba7e2a09f4feaa25a701572799e4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -57,6 +57,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -57,6 +57,38 @@ public final class CraftMagicNumbers implements UnsafeValues {
private CraftMagicNumbers() {}
@ -3547,7 +3549,12 @@ index afdf4bc63dfaa469a16701541332e5380a027c22..8cbd488ee38a568d746ccb909710a2bc
+ }
+
+ @Override
+ public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer() {
+ public net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer() {
+ return io.papermc.paper.adventure.PaperAdventure.PLAIN_COMPONENT;
+ }
+
+ @Override
+ public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer() {
+ return io.papermc.paper.adventure.PaperAdventure.PLAIN;
+ }
+

View File

@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..91d7afc710a2d52b4f429e0381cf6417
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1049a7f39cf7ac2019d7ad7935e9205c98b100b7..bb8bad18ed799fd57ea2a1bcae4fb1399c3bde6a 100644
index df92e13eafbba7e2a09f4feaa25a701572799e4d..02f6b94b68778bbd5bc61832a5099080805a83a2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -385,6 +385,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -390,6 +390,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() {
return com.destroystokyo.paper.PaperConfig.timingsServerName;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add CraftMagicNumbers.isSupportedApiVersion()
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index f4d7975ab75a2699e46a42feb51f693563581f18..6487c87dbb3b8c019254581cb40875ad083d5a62 100644
index 02f6b94b68778bbd5bc61832a5099080805a83a2..539f259aad2733b1313547aebd3e128815c1680a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -390,6 +390,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -395,6 +395,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.PaperVersionFetcher();
}

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 063321a195bdbabc9be77672bc7b51202196286c..1c0ea2664e4b9b95b9bbd1351efd5e51111937f7 100644
index 539f259aad2733b1313547aebd3e128815c1680a..e1d73c1916d6ce26d0f4da107e83513cd369e4eb 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -395,6 +395,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -400,6 +400,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
public boolean isSupportedApiVersion(String apiVersion) {
return apiVersion != null && SUPPORTED_API.contains(apiVersion);
}

View File

@ -42,10 +42,10 @@ index eb99e0c2462a2d1ab4508a5c3f1580b6e31d7465..c536eceef3365a7b726cd970df345ba1
public net.minecraft.world.item.enchantment.Enchantment getHandle() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1c0ea2664e4b9b95b9bbd1351efd5e51111937f7..7f697673e41068d4f2252fc319355e20bcd5ad30 100644
index e1d73c1916d6ce26d0f4da107e83513cd369e4eb..b6abdad7b289ed200befdcf2a4d31508d2e934f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -442,6 +442,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -447,6 +447,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
return compound;
}

View File

@ -21,10 +21,10 @@ index a35078c299c3c8d7e670d2ca82c110e62b374490..a6cc8d8691f314fe7d5499f525a45b1c
+ // 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 7f697673e41068d4f2252fc319355e20bcd5ad30..91a8891531025dcce41e9c49505534250dbb7612 100644
index b6abdad7b289ed200befdcf2a4d31508d2e934f6..36f93f411563233b28018581f7d2cce461349915 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -466,6 +466,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -471,6 +471,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
}

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 91a8891531025dcce41e9c49505534250dbb7612..b56b206c5d875a6b0f55bc506521d5a3dd7c8b68 100644
index 36f93f411563233b28018581f7d2cce461349915..f6cb3cb848f62e1d360034721694e6d8a9e73d95 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -323,7 +323,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -328,7 +328,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Item Rarity API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b56b206c5d875a6b0f55bc506521d5a3dd7c8b68..88d18bcf4f0d7e14c7d358a2771c90422bca2f73 100644
index f6cb3cb848f62e1d360034721694e6d8a9e73d95..07acef23a63ece3cb4bd1cbd0410328df437afd4 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -476,6 +476,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -481,6 +481,20 @@ 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 88d18bcf4f0d7e14c7d358a2771c90422bca2f73..fdbc4ce80e99c6120daf6102102409c1ccab88ba 100644
index 07acef23a63ece3cb4bd1cbd0410328df437afd4..ca44ec3e2bb62f9ac029c854257bdae79a62531d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -490,6 +490,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -495,6 +495,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()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
}

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 fdbc4ce80e99c6120daf6102102409c1ccab88ba..1b1147c10c2e9caa4ccf3f2bcdb1211ed39d293a 100644
index ca44ec3e2bb62f9ac029c854257bdae79a62531d..a2567ee56b985321894d35a5edc338bd949b6d10 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -491,6 +491,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -496,6 +496,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
}

View File

@ -20,10 +20,10 @@ index 7e3826b271b2db3b48e6e21ac2e66911bf8993aa..393a19335c52b6e63d37aacdfbeff93e
+ // 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 1b1147c10c2e9caa4ccf3f2bcdb1211ed39d293a..444da43415fc1341800260ebf9359f29dc628c22 100644
index a2567ee56b985321894d35a5edc338bd949b6d10..45f8519052a9fd7b9afcb84fb889e0efde92c8c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -499,6 +499,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -504,6 +504,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

View File

@ -90,10 +90,10 @@ index 0000000000000000000000000000000000000000..4ecba0b02c2813a890aecc5586987879
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 444da43415fc1341800260ebf9359f29dc628c22..812fc61a81519980dad5dcd80127c8420f73676e 100644
index 45f8519052a9fd7b9afcb84fb889e0efde92c8c6..f9cb81313d6c894a2023123f4088ef0e0b7dbeff 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -516,6 +516,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -521,6 +521,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
}

View File

@ -37,10 +37,10 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33
+ // 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 812fc61a81519980dad5dcd80127c8420f73676e..9787bc1b989a7d7f92fe0a058b725519fe0d2156 100644
index f9cb81313d6c894a2023123f4088ef0e0b7dbeff..3118ba28e59c341c1210b6fadaa14b4f66f4facc 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -528,6 +528,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -533,6 +533,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.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
}

View File

@ -45,10 +45,10 @@ index ee50ea695585639d0ff184b675f3fb3b205b9f86..5aae88e20bc04560d6ad52cfcaa872d2
// 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 9787bc1b989a7d7f92fe0a058b725519fe0d2156..7978b4aa50f3abbcb9e07a0207c897b6be2a6129 100644
index 3118ba28e59c341c1210b6fadaa14b4f66f4facc..9679b17b19e208c82570e1769efb18e23b5b3778 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -421,6 +421,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -426,6 +426,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of((CompoundTag) converted.getValue()));
}