HumanEntity.setCooldown(ItemStack item, int ticks) applies by Material rather than ItemStack

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:

      IDE: IntelliJ IDEA

      Build System: Maven

      MC Plugin Library: spigot-api version 1.21.5-R0.1-SNAPSHOT

    • This server is running CraftBukkit version 4503-Spigot-2700123-9119da2 (MC: 1.21.5) (Implementing API version 1.21.5-60.1-SNAPSHOT) Checking version, please wait... You are running the latest version
    • Yes

       
      setCooldown(ItemStack item, int ticks) 
      specifies that it applies to the "specified item", but on use applies to all items of the same Material.

      Part of what makes this especially confusing is that the current CraftBukkit implementation of setCooldown(Material material, int ticks) actually uses it in its own implementation in the codebase:
      ```java

      @Override
      public void setCooldown(Material material, int ticks)

      {   setCooldown(new ItemStack(material), ticks); }

      ```

      This means that either:
      1. The documentation should be corrected to the reflect the fact that it will apply to all items sharing the same material as that of the ItemStack specified.

      2. Apply to only the ItemStack specified.

       

      P.S. I'd be happy to send a PR if this is decided to be a bug once it's decided whether the issue's #1 or #2.
       

            Assignee:
            Doc
            Reporter:
            Ethan Chen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: