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
ConstructorDescriptionSlimefunItemSpawnEvent
(Player player, Location location, ItemStack itemStack, ItemSpawnReason itemSpawnReason) SlimefunItemSpawnEvent
(Location location, ItemStack itemStack, ItemSpawnReason itemSpawnReason) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerList
This returns theItemSpawnReason
why we dropped anItemStack
.This returns theItemStack
that will be dropped.This returns theLocation
where we will drop the item.Optionally returns thePlayer
responsible for this spawn reason.boolean
void
setCancelled
(boolean cancelled) void
setItemStack
(ItemStack itemStack) This method sets theItemStack
that should be dropped.void
setLocation
(Location location) This sets theLocation
on 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 thePlayer
responsible for this spawn reason.- Returns:
- The player responsible if applicable.
-
getItemSpawnReason
This returns theItemSpawnReason
why we dropped anItemStack
.- Returns:
- the
ItemSpawnReason
.
-
getLocation
This returns theLocation
where we will drop the item.- Returns:
- The
Location
where the item will be dropped
-
setLocation
This sets theLocation
on where to drop this item. -
getItemStack
This returns theItemStack
that will be dropped.- Returns:
- The
ItemStack
that will be dropped
-
setItemStack
This method sets theItemStack
that should be dropped.- Parameters:
itemStack
- TheItemStack
to drop
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceCancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelled
in interfaceCancellable
-
getHandlerList
-
getHandlers
- Specified by:
getHandlers
in classEvent
-