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

InventoryClickEvent cancel event item disappearing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Java 8

      Windows 7 

       

    • 1.13-RO-1 snapshot

      When cancelling the InventoryClickEvent then item does not return to the player inventory the problem is the inventory is not updating or not sync. with the server data. So you have to call player.updateInventory() to fixed this. This behavior was not present in the past versions.

       

      Attached a plugin that contains this code which I used to test the issue which contains this code

      package testPackage;import org.bukkit.event.EventHandler;
      import org.bukkit.event.Listener;
      import org.bukkit.event.inventory.InventoryClickEvent;
      import org.bukkit.plugin.java.JavaPlugin;public class TestClass extends JavaPlugin implements Listener {
          @Override
          public void onEnable() {
              this.getServer().getPluginManager().registerEvents(this, this);
          }    @EventHandler
          public void onInventoryClick(InventoryClickEvent event) {
              event.setCancelled(true);
          }
      }
      
      

       

       

       

            Unassigned Unassigned
            RAZERMC andy leonor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: