aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNassim <[email protected]>2021-04-12 19:45:58 +0200
committerGitHub <[email protected]>2021-04-12 17:45:58 +0000
commit8756d232c671b5a67cb0dd8975ed7e2d3219ac38 (patch)
tree46a0c529316e4523c65556e4eed1f28fcd082d7e
parent4492bc4cc18d29471ae6ab58dc20c8212cf6e5b8 (diff)
downloadPaper-8756d232c671b5a67cb0dd8975ed7e2d3219ac38.tar.gz
Paper-8756d232c671b5a67cb0dd8975ed7e2d3219ac38.zip
Expose server protocol version (#5416)
-rw-r--r--Spigot-API-Patches/0284-Expose-protocol-version.patch23
-rw-r--r--Spigot-Server-Patches/0700-Expose-protocol-version.patch22
2 files changed, 45 insertions, 0 deletions
diff --git a/Spigot-API-Patches/0284-Expose-protocol-version.patch b/Spigot-API-Patches/0284-Expose-protocol-version.patch
new file mode 100644
index 0000000000..c03733e74a
--- /dev/null
+++ b/Spigot-API-Patches/0284-Expose-protocol-version.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: KennyTV <[email protected]>
+Date: Fri, 26 Mar 2021 11:23:27 +0100
+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
+--- a/src/main/java/org/bukkit/UnsafeValues.java
++++ b/src/main/java/org/bukkit/UnsafeValues.java
+@@ -141,5 +141,12 @@ public interface UnsafeValues {
+ * @return the itemstack rarity
+ */
+ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
++
++ /**
++ * Returns the server's protocol version.
++ *
++ * @return the server's protocol version
++ */
++ int getProtocolVersion();
+ // Paper end
+ }
diff --git a/Spigot-Server-Patches/0700-Expose-protocol-version.patch b/Spigot-Server-Patches/0700-Expose-protocol-version.patch
new file mode 100644
index 0000000000..f965e759b4
--- /dev/null
+++ b/Spigot-Server-Patches/0700-Expose-protocol-version.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: KennyTV <[email protected]>
+Date: Fri, 26 Mar 2021 11:23:17 +0100
+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
+--- 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 {
+ return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getItemStackRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
+ }
+
++ @Override
++ public int getProtocolVersion() {
++ return net.minecraft.SharedConstants.getGameVersion().getProtocolVersion();
++ }
++
+ // Paper end
+
+ /**