Further clarify functionality of damageItemStack methods (#8878)

This commit is contained in:
Jake Potrebic 2023-02-21 09:35:25 -08:00
parent 7d56ee5d45
commit 37d171544a

View File

@ -38,21 +38,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ void broadcastSlotBreak(org.bukkit.inventory.@NotNull EquipmentSlot slot, @NotNull Collection<Player> players);
+
+ /**
+ * Damages this itemstack by the specified amount. This
+ * runs all logic associated with damaging an itemstack like
+ * events and stat changes.
+ * Damages the itemstack in this slot by the specified amount.
+ * <p>
+ * This runs all logic associated with damaging an itemstack like
+ * gamemode and enchantment checks, events, stat changes, and advancement
+ * triggers.
+ *
+ * @param stack the itemstack to damage
+ * @param amount the amount of damage to do
+ * @return the damaged itemstack, or an empty stack if it broke. It may be the same instance as the stack passed it, but it may not.
+ * @return the damaged itemstack, or an empty stack if it broke. There are no
+ * guarantees the returned itemstack is the same instance
+ */
+ @NotNull ItemStack damageItemStack(@NotNull ItemStack stack, int amount);
+
+ /**
+ * Damages the itemstack in this slot by the specified amount.
+ * <p>
+ * This runs all logic associated with damaging an itemstack like
+ * events, stat changes, and notifying clients to play
+ * break animations.
+ * gamemode and enchantment checks, events, stat changes, advancement
+ * triggers, and notifying clients to play break animations.
+ *
+ * @param slot the slot of the stack to damage
+ * @param amount the amount of damage to do