aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch
diff options
context:
space:
mode:
authorMalfrador <[email protected]>2024-07-15 12:31:41 +0200
committerGitHub <[email protected]>2024-07-15 12:31:41 +0200
commit9fd5b3cfbd40b2847dec14f53c1b3b68aed46f12 (patch)
tree96914d111f50e21fa04bde89a96d9237e581675b /patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch
parent99ae7bbc9760e02fbd5388ad3890258203ee6d5a (diff)
downloadPaper-9fd5b3cfbd40b2847dec14f53c1b3b68aed46f12.tar.gz
Paper-9fd5b3cfbd40b2847dec14f53c1b3b68aed46f12.zip
Add AttributeModifier constructor without EquipmentSlotGroup (#11079)
Diffstat (limited to 'patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch')
-rw-r--r--patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch b/patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch
new file mode 100644
index 0000000000..e72f86be5d
--- /dev/null
+++ b/patches/api/0421-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch
@@ -0,0 +1,47 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Tamion <[email protected]>
+Date: Mon, 25 Sep 2023 19:55:51 +0200
+Subject: [PATCH] Fix PlayerSwapHandItemsEvent throwing exception when mainhand
+ or offhand set to null
+
+
+diff --git a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java
+index 9f592317c920589c22a5fb8e916c6ca58ebe5c59..39dd08de71b8b52fe3462c105ecdbfc1cd2cd9a3 100644
+--- a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java
++++ b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java
+@@ -31,7 +31,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
+ *
+ * @return item in the main hand
+ */
+- @Nullable
++ @NotNull // Paper
+ public ItemStack getMainHandItem() {
+ return mainHandItem;
+ }
+@@ -42,7 +42,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
+ * @param mainHandItem new item in the main hand
+ */
+ public void setMainHandItem(@Nullable ItemStack mainHandItem) {
+- this.mainHandItem = mainHandItem;
++ this.mainHandItem = mainHandItem == null ? ItemStack.empty() : mainHandItem; // Paper
+ }
+
+ /**
+@@ -50,7 +50,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
+ *
+ * @return item in the off hand
+ */
+- @Nullable
++ @NotNull // Paper
+ public ItemStack getOffHandItem() {
+ return offHandItem;
+ }
+@@ -61,7 +61,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable
+ * @param offHandItem new item in the off hand
+ */
+ public void setOffHandItem(@Nullable ItemStack offHandItem) {
+- this.offHandItem = offHandItem;
++ this.offHandItem = offHandItem == null ? ItemStack.empty() : offHandItem; // Paper
+ }
+
+ @Override