Class CancellablePetEvent

java.lang.Object
org.bukkit.event.Event
de.Keyle.MyPet.api.event.PetEvent
de.Keyle.MyPet.api.event.CancellablePetEvent
All Implemented Interfaces:
Cancellable
Direct Known Subclasses:
PetCallEvent, PetDamageEvent, PetExhaustionEvent, PetExpEvent, PetInteractEvent, PetInventoryActionEvent, PetNameEvent, PetOnHitSkillEvent, PetPickupItemEvent, PetSendAwayEvent

public abstract class CancellablePetEvent extends PetEvent implements Cancellable
Base of every PetEvent that listeners may veto. It owns the cancellation flag and the Cancellable contract so that concrete events do not each carry their own copy.

What cancelling means is defined by each concrete event; see its own documentation. As with PetEvent, this class has no handler list and is not a valid @EventHandler parameter type on its own.

  • Constructor Details

    • CancellablePetEvent

      protected CancellablePetEvent()
      Creates a synchronous, not-yet-cancelled pet event.
  • Method Details

    • isCancelled

      public boolean isCancelled()
      Returns whether a listener has vetoed this event.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the event has been cancelled
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets whether this event is vetoed.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to cancel the event, false to lift an earlier cancellation