Class SlimefunItemSpawnEvent
java.lang.Object
org.bukkit.event.Event
io.github.thebusybiscuit.slimefun4.api.events.SlimefunItemSpawnEvent
- All Implemented Interfaces:
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
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionSlimefunItemSpawnEvent(Player player, Location location, ItemStack itemStack, ItemSpawnReason itemSpawnReason) SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnReason itemSpawnReason) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListThis returns theItemSpawnReasonwhy we dropped anItemStack.This returns theItemStackthat will be dropped.This returns theLocationwhere we will drop the item.Optionally returns thePlayerresponsible for this spawn reason.booleanvoidsetCancelled(boolean cancelled) voidsetItemStack(ItemStack itemStack) This method sets theItemStackthat should be dropped.voidsetLocation(Location location) This sets theLocationon where to drop this item.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
SlimefunItemSpawnEvent
@ParametersAreNonnullByDefault public SlimefunItemSpawnEvent(@Nullable Player player, Location location, ItemStack itemStack, ItemSpawnReason itemSpawnReason) -
SlimefunItemSpawnEvent
@ParametersAreNonnullByDefault public SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnReason itemSpawnReason)
-
-
Method Details
-
getPlayer
Optionally returns thePlayerresponsible for this spawn reason.- Returns:
- The player responsible if applicable.
-
getItemSpawnReason
This returns theItemSpawnReasonwhy we dropped anItemStack.- Returns:
- the
ItemSpawnReason.
-
getLocation
This returns theLocationwhere we will drop the item.- Returns:
- The
Locationwhere the item will be dropped
-
setLocation
This sets theLocationon where to drop this item. -
getItemStack
This returns theItemStackthat will be dropped.- Returns:
- The
ItemStackthat will be dropped
-
setItemStack
This method sets theItemStackthat should be dropped.- Parameters:
itemStack- TheItemStackto drop
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceCancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceCancellable
-
getHandlerList
-
getHandlers
- Specified by:
getHandlersin classEvent
-