mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Add EquipmentSlot#getOppositeHand (#10632)
This commit is contained in:
parent
6ad89448b8
commit
71c03637bf
1 changed files with 15 additions and 0 deletions
|
@ -24,6 +24,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
+ * 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
|
+ * Checks whether this equipment slot
|
||||||
+ * is one of the armor slots:
|
+ * is one of the armor slots:
|
||||||
+ * {@link #HEAD}, {@link #CHEST},
|
+ * {@link #HEAD}, {@link #CHEST},
|
||||||
|
|
Loading…
Reference in a new issue