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

    Constructors
    Constructor
    Description
    CustomDiscEjectEvent(org.bukkit.block.Block block, org.bukkit.entity.Player player, DiscEntry discEntry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull org.bukkit.block.Block
    Returns the jukebox block involved in the ejection.
    @NotNull DiscEntry
    Returns the metadata of the custom disc being ejected.
    static @NotNull org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
     
    @Nullable org.bukkit.entity.Player
    Returns the player who initiated the ejection.
    boolean
     
    void
    setCancelled(boolean cancel)
     

    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

    • 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:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
    • isCancelled

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

      public void setCancelled(boolean cancel)
      Specified by:
      setCancelled in interface org.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 Player involved, or null if triggered by automation (e.g., hoppers or redstone).
    • getDiscEntry

      @NotNull public @NotNull DiscEntry getDiscEntry()
      Returns the metadata of the custom disc being ejected.
      Returns:
      The DiscEntry containing track and item data.