mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
Expose more Adventure serializers through PaperComponents (#5443)
This commit is contained in:
parent
3f63bde0cd
commit
711b7a80bf
@ -399,6 +399,100 @@ index 0000000000000000000000000000000000000000..13c5df5fb8ce1d0203d99e88dd691019
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+}
|
||||
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..239f41e32dd94c75a8a549816465417bb4c63d71
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/text/PaperComponents.java
|
||||
@@ -0,0 +1,88 @@
|
||||
+package io.papermc.paper.text;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.flattener.ComponentFlattener;
|
||||
+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 org.bukkit.Bukkit;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+
|
||||
+/**
|
||||
+ * Paper API-specific methods for working with {@link Component}s and related.
|
||||
+ */
|
||||
+public final class PaperComponents {
|
||||
+ private PaperComponents() {
|
||||
+ throw new RuntimeException("PaperComponents is not to be instantiated!");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Return a component flattener that can use game data to resolve extra information about components.
|
||||
+ *
|
||||
+ * @return a component flattener
|
||||
+ */
|
||||
+ public static @NonNull ComponentFlattener flattener() {
|
||||
+ return Bukkit.getUnsafe().componentFlattener();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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 @NonNull PlainComponentSerializer plainSerializer() {
|
||||
+ return Bukkit.getUnsafe().plainComponentSerializer();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a serializer for {@link Component}s that will convert to and from the
|
||||
+ * standard JSON serialization format using Gson.
|
||||
+ *
|
||||
+ * <p>Implementations may provide a serializer capable of processing any
|
||||
+ * information that requires implementation details, such as legacy
|
||||
+ * (pre-1.16) hover events.</p>
|
||||
+ *
|
||||
+ * @return a json component serializer
|
||||
+ */
|
||||
+ public static @NonNull GsonComponentSerializer gsonSerializer() {
|
||||
+ return Bukkit.getUnsafe().gsonComponentSerializer();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a serializer for {@link Component}s that will convert to and from the
|
||||
+ * standard JSON serialization format using Gson, downsampling any RGB colors
|
||||
+ * to their nearest {@link NamedTextColor} counterpart.
|
||||
+ *
|
||||
+ * <p>Implementations may provide a serializer capable of processing any
|
||||
+ * information that requires implementation details, such as legacy
|
||||
+ * (pre-1.16) hover events.</p>
|
||||
+ *
|
||||
+ * @return a json component serializer
|
||||
+ */
|
||||
+ public static @NonNull GsonComponentSerializer colorDownsamplingGsonSerializer() {
|
||||
+ return Bukkit.getUnsafe().colorDownsamplingGsonComponentSerializer();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a serializer for {@link Component}s that will convert to and from the
|
||||
+ * legacy component format used by Bukkit. This serializer uses the
|
||||
+ * {@link LegacyComponentSerializer.Builder#useUnusualXRepeatedCharacterHexFormat()}
|
||||
+ * option to match upstream behavior.
|
||||
+ *
|
||||
+ * <p>This legacy serializer uses the standard section symbol to mark
|
||||
+ * formatting characters.</p>
|
||||
+ *
|
||||
+ * <p>Implementations may provide a serializer capable of processing any
|
||||
+ * information that requires access to implementation details.</p>
|
||||
+ *
|
||||
+ * @return a section serializer
|
||||
+ */
|
||||
+ public static @NonNull LegacyComponentSerializer legacySectionSerializer() {
|
||||
+ return Bukkit.getUnsafe().legacyComponentSerializer();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 7c715fdc11ab7837552b1fe3ffd08b31cec0a63b..426b1e83226e674ee4bf3ec05ddcd3ac4376b06d 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
@ -907,14 +1001,20 @@ index 768f35c19c4557236bded5f4a85f48a2b2b2a9e6..d0ce64412276512cde133937a85a3340
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..dd0b80c268644ac714311501215f45166092b856 100644
|
||||
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..207c656c0a11a3a630bc70491efcf433b2681e18 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -17,6 +17,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
@@ -17,6 +17,13 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
*/
|
||||
@Deprecated
|
||||
public interface UnsafeValues {
|
||||
+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); // Paper
|
||||
+ // Paper start
|
||||
+ net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener();
|
||||
+ net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer();
|
||||
+ // Paper end
|
||||
|
||||
void reportTimings(); // Paper
|
||||
Material toLegacy(Material material);
|
||||
@ -931,7 +1031,7 @@ index efb97712cc9dc7c1e12a59f5b94e4f2ad7c6b7d8..3024468af4c073324e536c1cb26beffb
|
||||
return warning == null || warning.value();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index fd2af5fded9335602e263a2098760da0e64a87a3..44f01a3d8a461acab187367fc8876e0b73c92386 100644
|
||||
index 0fcf1dbb7b9cd2cfcb803b1a430d6131de87c92d..f9dea4ed6c57c88fa2f5b710440a35f4d310dd5f 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
@ -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 dd0b80c268644ac714311501215f45166092b856..bed84606a111648ce39c2e6683c0ca5a2138592f 100644
|
||||
index 207c656c0a11a3a630bc70491efcf433b2681e18..195b6bb328de92c4d17d1cd14e13578226b1ac3c 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -78,5 +78,12 @@ public interface UnsafeValues {
|
||||
@@ -84,5 +84,12 @@ public interface UnsafeValues {
|
||||
* @return name
|
||||
*/
|
||||
String getTimingsServerName();
|
||||
@ -73,7 +73,7 @@ index dd0b80c268644ac714311501215f45166092b856..bed84606a111648ce39c2e6683c0ca5a
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index 2305eb40832a82159cd89162934870cf57e1aa0e..5819797b1d6223c4b4ac7a60bdc710ba69cee313 100644
|
||||
index 2305eb40832a82159cd89162934870cf57e1aa0e..4c2ddc722a9dc4011906ad9530b13fa9be1d3ff9 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -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 bed84606a111648ce39c2e6683c0ca5a2138592f..3aacc3103698144b343facdd7f4a35fbdb62e241 100644
|
||||
index 195b6bb328de92c4d17d1cd14e13578226b1ac3c..d6897f43a0692e031bed8a212d9a637ef548cc60 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -85,5 +85,11 @@ public interface UnsafeValues {
|
||||
@@ -91,5 +91,11 @@ public interface UnsafeValues {
|
||||
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ index 3578f491a053154789ad696e93c70fdde74912e6..0654873eef22d1e35c7430f098ff9e8f
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 41db4fdbf25d7a2a7b6db373cf2eecc8cd9a5aa7..699aa48312f2183f7d11655fe59e12d51d148afe 100644
|
||||
index ce9ee2d6d72069af518fc8d7d48a35c03b5f9f1f..3d63514729ddc30ff559a65815612be81e777892 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -8,6 +8,7 @@ import java.util.Set; // Paper
|
||||
|
@ -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 3aacc3103698144b343facdd7f4a35fbdb62e241..b824a1b0590014d428e64f789008454bd241996a 100644
|
||||
index d6897f43a0692e031bed8a212d9a637ef548cc60..e348034288c74ab80360086d71f0b7f61551df24 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -91,5 +91,9 @@ public interface UnsafeValues {
|
||||
@@ -97,5 +97,9 @@ public interface UnsafeValues {
|
||||
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
||||
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
}
|
||||
@ -20,7 +20,7 @@ index 3aacc3103698144b343facdd7f4a35fbdb62e241..b824a1b0590014d428e64f789008454b
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index b26b9344a7d226a0d81d133fd7bfcfb36d8a742b..878f09d5e587bc4bd70443fbdb89dac29e5a538d 100644
|
||||
index 3d63514729ddc30ff559a65815612be81e777892..58f99e3ebac9a01ebffe4d208e16cbee474d4aa3 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -619,6 +619,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
|
@ -27,10 +27,10 @@ index 2b53e68e96ea346a6f2b5cadcf9f81b2c231c408..e453e5eb7245aad3ecbb19652ebb34ab
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index b824a1b0590014d428e64f789008454bd241996a..23d0798d479fc3dd9cc4c41f7999a889987b9ab0 100644
|
||||
index e348034288c74ab80360086d71f0b7f61551df24..a604b7e00e64912a2103d9af845eddff6835e825 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -95,5 +95,27 @@ public interface UnsafeValues {
|
||||
@@ -101,5 +101,27 @@ public interface UnsafeValues {
|
||||
byte[] serializeItem(ItemStack item);
|
||||
|
||||
ItemStack deserializeItem(byte[] data);
|
||||
|
@ -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 23d0798d479fc3dd9cc4c41f7999a889987b9ab0..f486d7c819f6330223980793c9b086fded0af059 100644
|
||||
index a604b7e00e64912a2103d9af845eddff6835e825..fafc4d63b6202b00a133c50cd38dec54db9b3576 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -117,5 +117,13 @@ public interface UnsafeValues {
|
||||
@@ -123,5 +123,13 @@ public interface UnsafeValues {
|
||||
* @return the translation key
|
||||
*/
|
||||
String getTranslationKey(org.bukkit.entity.EntityType type);
|
||||
|
@ -61,10 +61,10 @@ index 112c3f035ec7e7a7cae939264e0af4c6f4450abd..9b1c9e60dba9ea3ef8d8e164f13dd76d
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index f486d7c819f6330223980793c9b086fded0af059..7f90ef2fd1c87c5b8b69f2e9dba3ad8e6e9ce3ec 100644
|
||||
index fafc4d63b6202b00a133c50cd38dec54db9b3576..6db8c3bae9c9bb10eedf8102b3ac4c6eb288b77b 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -125,5 +125,21 @@ public interface UnsafeValues {
|
||||
@@ -131,5 +131,21 @@ public interface UnsafeValues {
|
||||
*/
|
||||
public int nextEntityId();
|
||||
|
||||
|
@ -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 7f90ef2fd1c87c5b8b69f2e9dba3ad8e6e9ce3ec..ba899198be49f9e95c3fb64759313662f75c4567 100644
|
||||
index 6db8c3bae9c9bb10eedf8102b3ac4c6eb288b77b..3bf6e58b2351cee935e23abec1cea289e31943dc 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -141,5 +141,12 @@ public interface UnsafeValues {
|
||||
@@ -147,5 +147,12 @@ public interface UnsafeValues {
|
||||
* @return the itemstack rarity
|
||||
*/
|
||||
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
|
||||
|
@ -448,10 +448,10 @@ index 0000000000000000000000000000000000000000..caa9708f321f04cd02534161231c0599
|
||||
+}
|
||||
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..71938ad7b3494e803beca7e4022aad12a51f2096
|
||||
index 0000000000000000000000000000000000000000..cd2da276c09dcf98c1c50dc66aa30dd3b67b43af
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -0,0 +1,340 @@
|
||||
@@ -0,0 +1,344 @@
|
||||
+package io.papermc.paper.adventure;
|
||||
+
|
||||
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
@ -536,9 +536,13 @@ index 0000000000000000000000000000000000000000..71938ad7b3494e803beca7e4022aad12
|
||||
+ .build();
|
||||
+ public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().flattener(FLATTENER).hexColors().useUnusualXRepeatedCharacterHexFormat().build();
|
||||
+ public static final PlainComponentSerializer PLAIN = PlainComponentSerializer.builder().flattener(FLATTENER).build();
|
||||
+ static final GsonComponentSerializer GSON = GsonComponentSerializer.builder()
|
||||
+ public static final GsonComponentSerializer GSON = GsonComponentSerializer.builder()
|
||||
+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
|
||||
+ .build();
|
||||
+ public static final GsonComponentSerializer COLOR_DOWNSAMPLING_GSON = GsonComponentSerializer.builder()
|
||||
+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
|
||||
+ .downsampleColors()
|
||||
+ .build();
|
||||
+ private static final Codec<NBTTagCompound, String, IOException, IOException> NBT_CODEC = new Codec<NBTTagCompound, String, IOException, IOException>() {
|
||||
+ @Override
|
||||
+ public @NonNull NBTTagCompound decode(final @NonNull String encoded) throws IOException {
|
||||
@ -3140,15 +3144,35 @@ index 6a0b4cd36ac54df41642e8499c50e59f2b347b48..666af6cc91bd12ba5d5a846d663a5aab
|
||||
|
||||
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 65131f0977fa55c4761c34ce52720170feb61a72..229c6c18be548dde8057288b59ba2329604a8c50 100644
|
||||
index 65131f0977fa55c4761c34ce52720170feb61a72..8f737f63f280c00c1276bd1dc3ecf60448732ca8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -59,6 +59,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -59,6 +59,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
private CraftMagicNumbers() {}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.FLATTENER;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.COLOR_DOWNSAMPLING_GSON;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.GSON;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.PLAIN;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC;
|
||||
+ }
|
||||
|
@ -128,10 +128,10 @@ index 0000000000000000000000000000000000000000..c8b911e5d013525ffc5d2911ee0e421d
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 47370fc3a623a38fbd24dfe484db065a64d44204..83d056f2696498ec6e5d12a1602f8fcb833734c0 100644
|
||||
index 8f737f63f280c00c1276bd1dc3ecf60448732ca8..8aa9e7796ea39c09a965750d06c3d358250f33b8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -350,6 +350,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -370,6 +370,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public String getTimingsServerName() {
|
||||
return com.destroystokyo.paper.PaperConfig.timingsServerName;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Allow Reloading of Custom Permissions
|
||||
https://github.com/PaperMC/Paper/issues/49
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index a02ec4d765ef54955459a372960fb5b539f912df..e5f6dfa4061b98ccb5f3b0cd93ef416a2c20ee78 100644
|
||||
index b16d5f35d2c1c2ac29be2d6457ad83d0fcb98379..991ef9048822e52d1f39467f9b815eb1ba779f4b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2244,5 +2244,23 @@ public final class CraftServer implements Server {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Allow Reloading of Command Aliases
|
||||
Reload the aliases stored in commands.yml
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7a1a24c71999462aa4f8aebd78914d9bf243f5c9..c87c5648582132db4e310a3c580eb3045afc32b8 100644
|
||||
index f1572f708911d61ae6dc0077475fee8d815e28db..d3621b626799f470329e8f5097fc10016cd48560 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2273,5 +2273,24 @@ public final class CraftServer implements Server {
|
||||
|
@ -20,7 +20,7 @@ index 4e2f243faa209925dcb7c3ef89df3ed875c5ff78..48319aaf1c525c6fb7bdee5c2f570a0d
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c87e3189f2c582a22188555332b8d8ad17372c76..6c228e1f884f0023867c691cee9bd45481b5baec 100644
|
||||
index d3621b626799f470329e8f5097fc10016cd48560..1f0021c5374e1af9c9cd29d44e6b0bd9522394d9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2292,5 +2292,10 @@ public final class CraftServer implements Server {
|
||||
|
@ -29,7 +29,7 @@ index 13edb435b3fa65b4980bd7472aa5a5196f4d5b2b..469f78775b03cf363d88e35c69c0dc18
|
||||
Object val = config.get("settings.save-player-data");
|
||||
if (val instanceof Boolean) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 04d53310998fdb21636810b8e7dd9c359691090c..b4267ce12c0c952b8dd048c0a6a199ebff148377 100644
|
||||
index ed541a9782d09d3537e04e3651833208a83d7b12..0b16f2b3dad8f391a4067cbac99a8d01acbaacb4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2335,6 +2335,11 @@ public final class CraftServer implements Server {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Expose the internal current tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index f420f41742efbd4f7bf02067768178bd8288848f..80e917d7154ed8cafd308440c66ae16fb782dd35 100644
|
||||
index 153de70249442caa3568fb2591cfd88bdb37e687..cfacac7233c6e1f1a34aee1b5d26a072949fd512 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2358,5 +2358,10 @@ public final class CraftServer implements Server {
|
||||
|
@ -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 83d056f2696498ec6e5d12a1602f8fcb833734c0..e60ee5f6bd990ce89a130a85b6821c5b7f346ae8 100644
|
||||
index 8aa9e7796ea39c09a965750d06c3d358250f33b8..7e4cceff7ce9ffaff00caf21088fd7bc59e66933 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -355,6 +355,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -375,6 +375,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
return new com.destroystokyo.paper.PaperVersionFetcher();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
|
||||
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 255ab2909440a7daeae756fc2e3d21ff71f7a551..fafe6354fa73d1f11d30be88bd4ff4354bbbb016 100644
|
||||
index f8e053a1c128b345051d00307997eb2bea79a98d..4828d356ca01cba5964c6397584d56643dbc0dae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2373,5 +2373,10 @@ public final class CraftServer implements Server {
|
||||
|
@ -50,10 +50,10 @@ index 661f400ae4f5cebef5d1743819529ecf647b6681..0468f80b7f52ee45fc9364470b23f80f
|
||||
try {
|
||||
return new ItemStack(nbttagcompound);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 79ac4e1f3aad1a855a5d7ef7df2a3bfd1c4362f2..51aa0c37df947a229eddaa3c4e3372f64575617e 100644
|
||||
index 7e4cceff7ce9ffaff00caf21088fd7bc59e66933..2519dbce9717ff647d50c31aed6aca68b9f4e3af 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -360,6 +360,46 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -380,6 +380,46 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public boolean isSupportedApiVersion(String apiVersion) {
|
||||
return apiVersion != null && SUPPORTED_API.contains(apiVersion);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ index e3ab0b76e5003553b29215a43bc5a762f2663648..ee8977a1e4a83598ba7873c4c482fea8
|
||||
// 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 51aa0c37df947a229eddaa3c4e3372f64575617e..6fbface979f6f9ed97bb39ca91a29bffe05fddda 100644
|
||||
index 2519dbce9717ff647d50c31aed6aca68b9f4e3af..6c59816bb9246f22d518aa9f87ec382ae3d3a014 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -45,6 +45,7 @@ import org.bukkit.Registry;
|
||||
@ -85,7 +85,7 @@ index 51aa0c37df947a229eddaa3c4e3372f64575617e..6fbface979f6f9ed97bb39ca91a29bff
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.legacy.CraftLegacy;
|
||||
@@ -400,6 +401,25 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -420,6 +421,25 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ index 344862c3f479ae7b6d4f929c9ef7882aba983ffb..e2301dbeb3d76684b2a0ab4262bb76ca
|
||||
+ // 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 6fbface979f6f9ed97bb39ca91a29bffe05fddda..25af57d0ab191f6a29ae95cec764667e9c23bdd4 100644
|
||||
index 6c59816bb9246f22d518aa9f87ec382ae3d3a014..a1c918e84627d79f6665237851f614880a9da6f7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -420,6 +420,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -440,6 +440,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null);
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,10 @@ index 8e760445885f6ab92f60db0ee2a02d098b5e5f03..7a8a1960882e291c46301d07da3e1c54
|
||||
if (this.m || !this.i.isEmpty() || !this.j.isEmpty()) {
|
||||
Map<MinecraftKey, AdvancementProgress> map = Maps.newHashMap();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 25af57d0ab191f6a29ae95cec764667e9c23bdd4..4b7ca6d2e13fad43a75a345608b739f47adba738 100644
|
||||
index a1c918e84627d79f6665237851f614880a9da6f7..74ebd6257ca7c87bcedff831d213273e7d542612 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -289,7 +289,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -309,7 +309,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ index fe2ad3f9298af4d405711b4798e34ae484a19db9..a4755e2cdb40afe6af47435f92963a53
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 4b7ca6d2e13fad43a75a345608b739f47adba738..ca911ed346daf8c43b7b6e0acabf9ac0c64223aa 100644
|
||||
index 74ebd6257ca7c87bcedff831d213273e7d542612..f69b4576f05dbf763e99d5d1cbed069c55c793ed 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -98,8 +98,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -118,8 +118,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>();
|
||||
private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>();
|
||||
private static final Map<Material, FluidType> MATERIAL_FLUID = new HashMap<>();
|
||||
@ -77,7 +77,7 @@ index 4b7ca6d2e13fad43a75a345608b739f47adba738..ca911ed346daf8c43b7b6e0acabf9ac0
|
||||
for (Block block : IRegistry.BLOCK) {
|
||||
BLOCK_MATERIAL.put(block, Material.getMaterial(IRegistry.BLOCK.getKey(block).getKey().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
@@ -165,6 +174,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -185,6 +194,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public static MinecraftKey key(Material mat) {
|
||||
return CraftNamespacedKey.toMinecraft(mat.getKey());
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ index 5d7c44a53fb98532057b09176677ce0d719b055b..e6a838430084d64326d1042c7b2089f4
|
||||
if (!itemstack.hasEnchantments()) {
|
||||
return this.a;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index ca911ed346daf8c43b7b6e0acabf9ac0c64223aa..712a32c0b64dace1f3e3d6f8acb8cbef1736b1f9 100644
|
||||
index f69b4576f05dbf763e99d5d1cbed069c55c793ed..971877c42f7a46696a389ef7d93f44993c360810 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -447,6 +447,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -467,6 +467,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return net.minecraft.world.entity.Entity.nextEntityId();
|
||||
}
|
||||
|
||||
|
@ -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 712a32c0b64dace1f3e3d6f8acb8cbef1736b1f9..6bfba82b428250e6725688d196b3dc6ac11a5e01 100644
|
||||
index 971877c42f7a46696a389ef7d93f44993c360810..6141e86278d876e42dbed6e8f2275280babcef77 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -461,6 +461,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -481,6 +481,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getItemStackRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user