Interface Cancellable


public interface Cancellable
Alternative to Cancellable that aims to reduce boilerplate. If your event implements this interface instead, the ScalaPluginClassLoader will inject the following three members:
  • a field: private boolean $cancel;
  • a method: public boolean isCancelled() { return this.$cancel; }
  • a method: public void setCancelled(boolean cancel) { this.$cancel = cancel; }
You can think of it as having the same effect as extending the following trait:
     
      trait Cancellable extends org.bukkit.event.Cancellable { self: Event =>
          private var $cancel: Boolean

          override def isCancelled: Boolean = this.$cancel
          override def setCancelled(cancel: Boolean): Unit = this.$cancel = cancel;
      }
     
 
See Also:
API Note:
events that implement this interface are expected to either not override any methods at all, or implement both. If only one of the two methods is overridden, an EventError is thrown by the ScalaPluginClassLoader., JavaPlugins must not ever define events that implement this interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Tests whether this event is cancelled.
    default void
    setCancelled(boolean cancel)
    Set the cancel status of this event.
  • Method Details

    • isCancelled

      default boolean isCancelled()
      Tests whether this event is cancelled.
      Returns:
      true if the event is cancelled, otherwise false
      Implementation Note:
      if you override this method, you must also override setCancelled(boolean)
    • setCancelled

      default void setCancelled(boolean cancel)
      Set the cancel status of this event.
      Parameters:
      cancel - true if the event should be cancelled, false if the event is allowed to happen
      Implementation Note:
      if you override this method, you must also override isCancelled()