Remove item in cursor after clicking in an inventory?

Discussion in 'Spigot Plugin Development' started by kinukin, Jun 9, 2017.

  1. Code (Text):
           if(e.getCursor() != null)
                                if(e.getCursor().getItemMeta() != null)
                            if(e.getCursor().getItemMeta().getLore().contains("yrdy")) {
                                ItemStack air = new ItemStack(Material.AIR);

    I want to remove the item in the cursor after the cursor has been clicked in a slot. At the moment the cursor is being immediately set to air. I want the cursor to set to air after it is clicked in a slot.
    #1 kinukin, Jun 9, 2017
    Last edited: Jun 9, 2017
  2. I think what will be more use for you is just cancelling the event, which does what you are trying to do.
  3. I think you mean is to cancel the event.