3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/patches/api/0382-Add-EquipmentSlot-convenience-methods.patch
Jake Potrebic 2f92d4e00e
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type

CraftBukkit Changes:
cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20db PR-1303: Create registry for banner pattern and cat type
4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
2023-12-08 11:00:39 -08:00

40 Zeilen
1.2 KiB
Diff

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
index 1e7d77118a55ca9db99eabb94894e6ef3409946b..8f793982d0ceeb949422fe3f125fb08229d3266a 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
@@ -8,4 +8,28 @@ public enum EquipmentSlot {
LEGS,
CHEST,
HEAD
+ // 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},
+ * {@link #LEGS}, or {@link #FEET}
+ *
+ * @return whether this is an armor slot
+ */
+ public boolean isArmor() {
+ return this == HEAD || this == CHEST || this == LEGS || this == FEET;
+ }
+ // Paper end
}