Commits

Parker Hawke authored and md_5 committed 6f9fe1d936f
#562: Add API to set equipment silently
No tags

src/main/java/org/bukkit/inventory/EntityEquipment.java

Modified
10 10 public interface EntityEquipment {
11 11
12 12 /**
13 13 * Stores the ItemStack at the given equipment slot in the inventory.
14 14 *
15 15 * @param slot the slot to put the ItemStack
16 16 * @param item the ItemStack to set
17 17 */
18 18 public void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack item);
19 19
20 + /**
21 + * Stores the ItemStack at the given equipment slot in the inventory.
22 + *
23 + * @param slot the slot to put the ItemStack
24 + * @param item the ItemStack to set
25 + * @param silent whether or not the equip sound should be silenced
26 + */
27 + public void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack item, boolean silent);
28 +
20 29 /**
21 30 * Gets the ItemStack at the given equipment slot in the inventory.
22 31 *
23 32 * @param slot the slot to get the ItemStack
24 33 * @return the ItemStack in the given slot
25 34 */
26 35 @NotNull
27 36 public ItemStack getItem(@NotNull EquipmentSlot slot);
28 37
29 38 /**
35 44 @NotNull
36 45 ItemStack getItemInMainHand();
37 46
38 47 /**
39 48 * Sets the item the entity is holding in their main hand.
40 49 *
41 50 * @param item The item to put into the entities hand
42 51 */
43 52 void setItemInMainHand(@Nullable ItemStack item);
44 53
54 + /**
55 + * Sets the item the entity is holding in their main hand.
56 + *
57 + * @param item The item to put into the entities hand
58 + * @param silent whether or not the equip sound should be silenced
59 + */
60 + void setItemInMainHand(@Nullable ItemStack item, boolean silent);
61 +
45 62 /**
46 63 * Gets a copy of the item the entity is currently holding
47 64 * in their off hand.
48 65 *
49 66 * @return the currently held item
50 67 */
51 68 @NotNull
52 69 ItemStack getItemInOffHand();
53 70
54 71 /**
55 72 * Sets the item the entity is holding in their off hand.
56 73 *
57 74 * @param item The item to put into the entities hand
58 75 */
59 76 void setItemInOffHand(@Nullable ItemStack item);
60 77
78 + /**
79 + * Sets the item the entity is holding in their off hand.
80 + *
81 + * @param item The item to put into the entities hand
82 + * @param silent whether or not the equip sound should be silenced
83 + */
84 + void setItemInOffHand(@Nullable ItemStack item, boolean silent);
85 +
61 86 /**
62 87 * Gets a copy of the item the entity is currently holding
63 88 *
64 89 * @deprecated entities can duel wield now use the methods for the
65 90 * specific hand instead
66 91 * @see #getItemInMainHand()
67 92 * @see #getItemInOffHand()
68 93 * @return the currently held item
69 94 */
70 95 @Deprecated
91 116 @Nullable
92 117 ItemStack getHelmet();
93 118
94 119 /**
95 120 * Sets the helmet worn by the entity
96 121 *
97 122 * @param helmet The helmet to put on the entity
98 123 */
99 124 void setHelmet(@Nullable ItemStack helmet);
100 125
126 + /**
127 + * Sets the helmet worn by the entity
128 + *
129 + * @param helmet The helmet to put on the entity
130 + * @param silent whether or not the equip sound should be silenced
131 + */
132 + void setHelmet(@Nullable ItemStack helmet, boolean silent);
133 +
101 134 /**
102 135 * Gets a copy of the chest plate currently being worn by the entity
103 136 *
104 137 * @return The chest plate being worn
105 138 */
106 139 @Nullable
107 140 ItemStack getChestplate();
108 141
109 142 /**
110 143 * Sets the chest plate worn by the entity
111 144 *
112 145 * @param chestplate The chest plate to put on the entity
113 146 */
114 147 void setChestplate(@Nullable ItemStack chestplate);
115 148
149 + /**
150 + * Sets the chest plate worn by the entity
151 + *
152 + * @param chestplate The chest plate to put on the entity
153 + * @param silent whether or not the equip sound should be silenced
154 + */
155 + void setChestplate(@Nullable ItemStack chestplate, boolean silent);
156 +
116 157 /**
117 158 * Gets a copy of the leggings currently being worn by the entity
118 159 *
119 160 * @return The leggings being worn
120 161 */
121 162 @Nullable
122 163 ItemStack getLeggings();
123 164
124 165 /**
125 166 * Sets the leggings worn by the entity
126 167 *
127 168 * @param leggings The leggings to put on the entity
128 169 */
129 170 void setLeggings(@Nullable ItemStack leggings);
130 171
172 + /**
173 + * Sets the leggings worn by the entity
174 + *
175 + * @param leggings The leggings to put on the entity
176 + * @param silent whether or not the equip sound should be silenced
177 + */
178 + void setLeggings(@Nullable ItemStack leggings, boolean silent);
179 +
131 180 /**
132 181 * Gets a copy of the boots currently being worn by the entity
133 182 *
134 183 * @return The boots being worn
135 184 */
136 185 @Nullable
137 186 ItemStack getBoots();
138 187
139 188 /**
140 189 * Sets the boots worn by the entity
141 190 *
142 191 * @param boots The boots to put on the entity
143 192 */
144 193 void setBoots(@Nullable ItemStack boots);
145 194
195 + /**
196 + * Sets the boots worn by the entity
197 + *
198 + * @param boots The boots to put on the entity
199 + * @param silent whether or not the equip sound should be silenced
200 + */
201 + void setBoots(@Nullable ItemStack boots, boolean silent);
202 +
146 203 /**
147 204 * Gets a copy of all worn armor
148 205 *
149 206 * @return The array of worn armor. Individual items may be null.
150 207 */
151 208 @NotNull
152 209 ItemStack[] getArmorContents();
153 210
154 211 /**
155 212 * Sets the entities armor to the provided array of ItemStacks

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut