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

PlayerItemDamageEvent fires, but nothing can prevent the damage.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Environment A:
      Latest Spigot (git-Spigot-db6de12-3f3c65f MC: 1.8.8)
      Windows 10 Home (64 bit) Intel

      Environment B:
      Latest Spigot (git-Spigot-db6de12-3f3c65f MC: 1.8.8)
      Remote Hosted Linux Xeon Server

      Both environments produce the same result (obviously). The event is firing, and sends me a message, however none of the following lines cancel the item from being damaged, individually or even all together.

      @EventHandler
      public void onItemDmg(PlayerItemDamageEvent e)
      {
      	e.getPlayer().sendMessage("Damaged");
      	e.getItem().setDurability((short) 0);
      	e.getPlayer().getItemInHand().setDurability((short) 0);
      	e.setDamage(0);
      	e.setCancelled(true);
      }
      

      1. The message "Damage" IS being sent to the player when the item is damaged
      2. This is the only event and only plugin on the server running.
      3. Changing the event priority, or ignoring cancelled to false changes nothing.

            Unassigned Unassigned
            cyberpwn Daniel Mills
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: