2022-10-23 01:50:12 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: SoSeDiK <mrsosedik@gmail.com>
|
|
|
|
Date: Sun, 16 Oct 2022 15:28:49 +0300
|
|
|
|
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
|
2024-04-28 03:00:01 +02:00
|
|
|
index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..adf0a94f98eb66b3957d4009d83ad5f741e0aa79 100644
|
2022-10-23 01:50:12 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
2024-04-28 03:00:01 +02:00
|
|
|
@@ -33,4 +33,27 @@ public enum EquipmentSlot {
|
2024-04-23 19:02:08 +02:00
|
|
|
public EquipmentSlotGroup getGroup() {
|
2024-04-28 03:00:01 +02:00
|
|
|
return group.get();
|
2024-04-23 19:02:08 +02:00
|
|
|
}
|
2022-10-23 01:50:12 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Checks whether this equipment slot is a hand:
|
|
|
|
+ * either {@link #HAND} or {@link #OFF_HAND}
|
|
|
|
+ *
|
|
|
|
+ * @return whether this is a hand slot
|
|
|
|
+ */
|
|
|
|
+ public boolean isHand() {
|
|
|
|
+ return this == HAND || this == OFF_HAND;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Checks whether this equipment slot
|
|
|
|
+ * is one of the armor slots:
|
|
|
|
+ * {@link #HEAD}, {@link #CHEST},
|
2024-04-23 19:02:08 +02:00
|
|
|
+ * {@link #LEGS}, {@link #FEET}, or {@link #BODY}
|
2022-10-23 01:50:12 +02:00
|
|
|
+ *
|
|
|
|
+ * @return whether this is an armor slot
|
|
|
|
+ */
|
|
|
|
+ public boolean isArmor() {
|
2024-04-23 19:02:08 +02:00
|
|
|
+ return this == HEAD || this == CHEST || this == LEGS || this == FEET || this == BODY;
|
2022-10-23 01:50:12 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|