Class SlimefunItemSpawnEvent

java.lang.Object
org.bukkit.event.Event
io.github.thebusybiscuit.slimefun4.api.events.SlimefunItemSpawnEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class SlimefunItemSpawnEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
This Event is fired whenever slimefun drops an ItemStack. Creating a custom Event for this allows other plugins to provide compatibility with auto-pickup options or similar.
Author:
TheBusyBiscuit
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    SlimefunItemSpawnEvent(org.bukkit.entity.Player player, org.bukkit.Location location, org.bukkit.inventory.ItemStack itemStack, ItemSpawnReason itemSpawnReason)
     
    SlimefunItemSpawnEvent(org.bukkit.Location location, org.bukkit.inventory.ItemStack itemStack, ItemSpawnReason itemSpawnReason)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.event.HandlerList
     
    org.bukkit.event.HandlerList
     
    This returns the ItemSpawnReason why we dropped an ItemStack.
    org.bukkit.inventory.ItemStack
    This returns the ItemStack that will be dropped.
    org.bukkit.Location
    This returns the Location where we will drop the item.
    Optional<org.bukkit.entity.Player>
    Optionally returns the Player responsible for this spawn reason.
    boolean
     
    void
    setCancelled(boolean cancelled)
     
    void
    setItemStack(org.bukkit.inventory.ItemStack itemStack)
    This method sets the ItemStack that should be dropped.
    void
    setLocation(org.bukkit.Location location)
    This sets the Location on where to drop this item.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SlimefunItemSpawnEvent

      @ParametersAreNonnullByDefault public SlimefunItemSpawnEvent(@Nullable org.bukkit.entity.Player player, org.bukkit.Location location, org.bukkit.inventory.ItemStack itemStack, ItemSpawnReason itemSpawnReason)
    • SlimefunItemSpawnEvent

      @ParametersAreNonnullByDefault public SlimefunItemSpawnEvent(org.bukkit.Location location, org.bukkit.inventory.ItemStack itemStack, ItemSpawnReason itemSpawnReason)
  • Method Details

    • getPlayer

      @Nonnull public Optional<org.bukkit.entity.Player> getPlayer()
      Optionally returns the Player responsible for this spawn reason.
      Returns:
      The player responsible if applicable.
    • getItemSpawnReason

      @Nonnull public ItemSpawnReason getItemSpawnReason()
      This returns the ItemSpawnReason why we dropped an ItemStack.
      Returns:
      the ItemSpawnReason.
    • getLocation

      @Nonnull public org.bukkit.Location getLocation()
      This returns the Location where we will drop the item.
      Returns:
      The Location where the item will be dropped
    • setLocation

      public void setLocation(@Nonnull org.bukkit.Location location)
      This sets the Location on where to drop this item.
      Parameters:
      location - The Location where to drop the ItemStack
    • getItemStack

      @Nonnull public org.bukkit.inventory.ItemStack getItemStack()
      This returns the ItemStack that will be dropped.
      Returns:
      The ItemStack that will be dropped
    • setItemStack

      public void setItemStack(@Nonnull org.bukkit.inventory.ItemStack itemStack)
      This method sets the ItemStack that should be dropped.
      Parameters:
      itemStack - The ItemStack to drop
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlerList

      @Nonnull public static org.bukkit.event.HandlerList getHandlerList()
    • getHandlers

      @Nonnull public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event