Class TreasuryEvent
java.lang.Object
org.bukkit.event.Event
com.olziedev.playertreasury.api.events.TreasuryEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
ExpansionEvent
Handles all the basic and common methods for events.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts the callback, this then lets the event continue.static <T extends TreasuryEvent>
voidCalls the event and runs the callback.boolean
boolean
void
Deprecated.Internal use only, do not use under any circumstances!void
This method is called when the event is finished without having to rely on waiting a tick.void
setCancelled
(boolean cancelled) void
setEventCallback
(Runnable runnable) Deprecated.Internal use only, do not use under any circumstances!void
waitForCallback
(boolean waitForCall) This method allows you to wait for the plugins event to continue after you callacceptCallback()
.Methods inherited from class org.bukkit.event.Event
getEventName, getHandlers, isAsynchronous
-
Constructor Details
-
TreasuryEvent
public TreasuryEvent() -
TreasuryEvent
public TreasuryEvent(boolean isAsync) - Parameters:
isAsync
- If the event is triggered as async.
-
-
Method Details
-
postEvent
This method is called when the event is finished without having to rely on waiting a tick.- Parameters:
runnable
- The runnable that is run when the event has finished.
-
postEvent
public void postEvent()Deprecated.Internal use only, do not use under any circumstances!Runs all the waiting post event callbacks. -
waitForCallback
public void waitForCallback(boolean waitForCall) This method allows you to wait for the plugins event to continue after you callacceptCallback()
. This is useful if you want your event to run async tasks and wait for them to finish before continuing the event.- Parameters:
waitForCall
- If the event should wait for the callback to be accepted.
-
isWaitingForCallback
public boolean isWaitingForCallback()- Returns:
- If the event is waiting for the callback to be accepted, check
waitForCallback(boolean)
.
-
acceptCallback
public void acceptCallback()Accepts the callback, this then lets the event continue. -
setEventCallback
Deprecated.Internal use only, do not use under any circumstances!- Parameters:
runnable
- The callback that is run whenacceptCallback()
is called.
-
getPlayerTreasuryAPI
- Returns:
- The API instance.
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelled
in interfaceCancellable
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceCancellable
-
callEvent
public static <T extends TreasuryEvent> void callEvent(T event, Consumer<T> callback, boolean runCallEvent) Calls the event and runs the callback.- Type Parameters:
T
- The event type.- Parameters:
event
- The event to call.callback
- The callback to run when the event is called.runCallEvent
- If the event should be called.
-