Item Effects

Discussion in 'Plugin Development' started by saladhat, Aug 7, 2022.

  1. Offline

    saladhat

    I am making a plugin obviously and would like to check if a player has an itemstack item in their inventory and apply a potion effect. And when it is removed potion effect would go away so the potion effect has to have a short duration. I have tried many solutions and cannot find one to satisfy my requirements. I have got it to work when I right-click using an event but I can't find an event for checking the inventory. I need it to check each tick for the item and apply the effect.
     
    Last edited: Aug 7, 2022
  2. Offline

    KarimAKL

    @saladhat Use a BukkitRunnable. You can schedule it to run once every tick.
     
  3. Offline

    Smeary_Subset

    Just give them the potion for infinite time, listen for when a an item is moved out of an inventory, then remove the potion effect
     

Share This Page