Class CustomDiscEjectEvent
java.lang.Object
org.bukkit.event.Event
space.subkek.customdiscs.api.event.CustomDiscEjectEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class CustomDiscEjectEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
Fired when a custom disc is ejected from a jukebox.
This event is cancellable. If cancelled, the disc remains inside the jukebox, and no item is dropped.
Note: Since this event is synchronous and linked to world state changes, it is safe to perform direct block or inventory modifications here.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionCustomDiscEjectEvent(org.bukkit.block.Block block, org.bukkit.entity.Player player, DiscEntry discEntry) -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.block.BlockgetBlock()Returns the jukebox block involved in the ejection.@NotNull DiscEntryReturns the metadata of the custom disc being ejected.static @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerList@Nullable org.bukkit.entity.PlayerReturns the player who initiated the ejection.booleanvoidsetCancelled(boolean cancel) Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
CustomDiscEjectEvent
public CustomDiscEjectEvent(org.bukkit.block.Block block, org.bukkit.entity.Player player, DiscEntry discEntry)
-
-
Method Details
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList() -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancel) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getBlock
@NotNull public @NotNull org.bukkit.block.Block getBlock()Returns the jukebox block involved in the ejection.Because this event is synchronous, it is safe to call any methods on the returned block without additional scheduling.
- Returns:
- The jukebox
Block.
-
getPlayer
@Nullable public @Nullable org.bukkit.entity.Player getPlayer()Returns the player who initiated the ejection.- Returns:
- The
Playerinvolved, ornullif triggered by automation (e.g., hoppers or redstone).
-
getDiscEntry
Returns the metadata of the custom disc being ejected.- Returns:
- The
DiscEntrycontaining track and item data.
-