How do I check if InventoryClickEvent is a specific ItemStack

Discussion in 'Spigot Plugin Help' started by 2Hex, Jul 15, 2021.

  1. title
    what i have rn:
    Code (Java):
    public class onUse implements Listener {

        @EventHandler

        public void onEquip(InventoryClickEvent e) {

            if (e.getSlotType() == InventoryType.SlotType.ARMOR){

    (thats the only part youll need i guess)
    i wanna check if this armor is the specific ItemStack that I have created.
    Your Help is greatly appreciated
     
  2. ignore conventions..etc and please answer to my question, thanks!
     
  3. Code (Java):
    if (e.getCurrentItem() == ITEMSTACK)
     
    • Like Like x 2
  4. You don't want to check the SlotType, you want to check for an itemstack, for instance you could set it to only use your itemstack and cancel the event for any other Item
     
    • Like Like x 1