Interface ItemConsumptionHandler

All Superinterfaces:
ItemHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ItemConsumptionHandler extends ItemHandler
This ItemHandler is triggered when the SlimefunItem it was assigned to has been consumed. This ItemHandler only works for food or potions.
Author:
TheBusyBiscuit
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default Class<? extends ItemHandler>
    This method returns the identifier for this ItemHandler.
    void
    onConsume(org.bukkit.event.player.PlayerItemConsumeEvent e, org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack item)
    This method gets fired whenever a PlayerItemConsumeEvent involving this SlimefunItem has been triggered.

    Methods inherited from interface io.github.thebusybiscuit.slimefun4.api.items.ItemHandler

    validate
  • Method Details

    • onConsume

      void onConsume(org.bukkit.event.player.PlayerItemConsumeEvent e, org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack item)
      This method gets fired whenever a PlayerItemConsumeEvent involving this SlimefunItem has been triggered.
      Parameters:
      e - The PlayerItemConsumeEvent that was fired
      p - The Player who consumed the given ItemStack
      item - The ItemStack that was consumed
    • getIdentifier

      default Class<? extends ItemHandler> getIdentifier()
      Description copied from interface: ItemHandler
      This method returns the identifier for this ItemHandler. We use a Class identifier to group Item Handlers together.
      Specified by:
      getIdentifier in interface ItemHandler
      Returns:
      The Class identifier for this ItemHandler