aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api
diff options
context:
space:
mode:
authorSoSeDiK <[email protected]>2024-05-01 20:14:27 +0300
committerGitHub <[email protected]>2024-05-01 19:14:27 +0200
commit18c201b838697a2c7ad0a106106adb54f03b661d (patch)
tree7282b765d97aa0b170e58ed1290681b9206f30f2 /patches/api
parentfaa7aa266a50bce345e2fda6e4a99ba6e4368bde (diff)
downloadPaper-18c201b838697a2c7ad0a106106adb54f03b661d.tar.gz
Paper-18c201b838697a2c7ad0a106106adb54f03b661d.zip
Add EquipmentSlot#getOppositeHand (#10632)
Diffstat (limited to 'patches/api')
-rw-r--r--patches/api/0376-Add-EquipmentSlot-convenience-methods.patch19
1 files changed, 17 insertions, 2 deletions
diff --git a/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch b/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch
index fc2c0fcc98..14a97a21b4 100644
--- a/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch
+++ b/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Add EquipmentSlot convenience methods
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
-index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..adf0a94f98eb66b3957d4009d83ad5f741e0aa79 100644
+index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..a10d56b797e58b56bd4cef6de40691f7eac9b5b1 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
-@@ -33,4 +33,27 @@ public enum EquipmentSlot {
+@@ -33,4 +33,42 @@ public enum EquipmentSlot {
public EquipmentSlotGroup getGroup() {
return group.get();
}
@@ -24,6 +24,21 @@ index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..adf0a94f98eb66b3957d4009d83ad5f7
+ }
+
+ /**
++ * Gets the opposite hand
++ *
++ * @return the opposite hand
++ * @throws IllegalArgumentException if this equipment slot is not a hand
++ * @see #isHand()
++ */
++ public @NotNull EquipmentSlot getOppositeHand() {
++ return switch (this) {
++ case HAND -> OFF_HAND;
++ case OFF_HAND -> HAND;
++ default -> throw new IllegalArgumentException("Unable to determine an opposite hand for equipment slot: " + name());
++ };
++ }
++
++ /**
+ * Checks whether this equipment slot
+ * is one of the armor slots:
+ * {@link #HEAD}, {@link #CHEST},