Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6229

Clarify PlayerItemBreakEvent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • N/A
    • Yes

      On the Javadocs this event says

      "The item that's breaking will exist in the inventory with a stack size of 0. After the event, the item's durability will be reset to 0."

      but this isn't exactly accurate and I suggest it should say something like

      "After this event, the item's amount will be set to (item amount)-1 and its durability will be reset to 0"

       

      The current text sounds like in the event the amount of the items is 0 and you should be able to set its amount to 1 to cancel this event but this is not the case and you need to do event.getBrokenItem().setAmount(2); since after the event it takes 1 away from the amount.

            Unassigned Unassigned
            HexedHero HexedHero
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: