aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0477-Fix-equipment-slot-and-group-API.patch
blob: d79d0c3cd2e4a371e322bff349ba6af2bdef60a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 22 May 2024 10:00:19 -0700
Subject: [PATCH] Fix equipment slot and group API

was missing the 'body' slot group

diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
index 90f18f355a6a236a7e4273cc1258e7c8034b8276..a0750d457a9cd7cf3ab9c45bb28ce5a2aef35298 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
@@ -112,6 +112,7 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
      */
     @Nullable
     @Deprecated
+    @io.papermc.paper.annotation.DoNotUse // Paper
     public EquipmentSlot getSlot() {
         return slot == EquipmentSlotGroup.ANY ? null : slot.getExample();
     }
diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java
index 1b34286fb6cbedb3841c84c499eb626f61885126..0829418cc4b586ea9c800617f7184b1e60f756a6 100644
--- a/src/main/java/org/bukkit/inventory/EntityEquipment.java
+++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java
@@ -15,6 +15,7 @@ public interface EntityEquipment {
      *
      * @param slot the slot to put the ItemStack
      * @param item the ItemStack to set
+     * @throws IllegalArgumentException if the slot is invalid for the entity
      */
     public void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack item);
 
@@ -23,7 +24,8 @@ public interface EntityEquipment {
      *
      * @param slot the slot to put the ItemStack
      * @param item the ItemStack to set
-     * @param silent whether or not the equip sound should be silenced
+     * @param silent whether the equip sound should be silenced
+     * @throws IllegalArgumentException if the slot is invalid for the entity
      */
     public void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack item, boolean silent);
 
@@ -32,6 +34,7 @@ public interface EntityEquipment {
      *
      * @param slot the slot to get the ItemStack
      * @return the ItemStack in the given slot
+     * @throws IllegalArgumentException if the slot is invalid for the entity
      */
     @NotNull
     public ItemStack getItem(@NotNull EquipmentSlot slot);
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
index 0019c8d91eefbfb44e76b9f929b25cd189295b79..5ce9da41ac4967f036e376fa270d4065b3d2e5d5 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
@@ -26,6 +26,7 @@ public final class EquipmentSlotGroup implements Predicate<EquipmentSlot> {
     public static final EquipmentSlotGroup CHEST = get("chest", EquipmentSlot.CHEST);
     public static final EquipmentSlotGroup HEAD = get("head", EquipmentSlot.HEAD);
     public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD, EquipmentSlot.CHEST);
+    public static final EquipmentSlotGroup BODY = get("body", EquipmentSlot.BODY); // Paper - add missing slot group
     //
     private final String key;
     private final Predicate<EquipmentSlot> predicate;