Package de.craftsblock.craftsnet.events
Class EventWithCancelReason
java.lang.Object
de.craftsblock.craftscore.event.Event
de.craftsblock.craftscore.event.CancellableEvent
de.craftsblock.craftsnet.events.EventWithCancelReason
- All Implemented Interfaces:
de.craftsblock.craftscore.event.Cancellable
- Direct Known Subclasses:
ClientConnectEvent,RouteRequestEvent,ShareRequestEvent
public abstract class EventWithCancelReason
extends de.craftsblock.craftscore.event.CancellableEvent
An abstract class extending
CancellableEvent, providing the ability to set and retrieve
a custom cancellation reason. It can be used by listeners to communicate why an event was canceled.- Since:
- 3.1.0-SNAPSHOT
- See Also:
-
CancellableEvent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the custom cancel reason which was set by one of the listeners.booleanChecks and returns whether a custom cancel reason was set by one of the listeners.voidsetCancelReason(String cancelReason) Sets a custom cancel reason which is printed to the consoleMethods inherited from class de.craftsblock.craftscore.event.CancellableEvent
isCancelled, setCancelled
-
Constructor Details
-
EventWithCancelReason
public EventWithCancelReason()
-
-
Method Details
-
setCancelReason
Sets a custom cancel reason which is printed to the console- Parameters:
cancelReason- The cancel reason which is printed to the console
-
getCancelReason
Gets the custom cancel reason which was set by one of the listeners.- Returns:
- The cancel reason
-
hasCancelReason
public boolean hasCancelReason()Checks and returns whether a custom cancel reason was set by one of the listeners.- Returns:
- true if a custom cancel reason was set, false otherwise.
-