Class MarketEvent
java.lang.Object
org.bukkit.event.Event
com.olziedev.nightmarket.api.events.MarketEvent
- All Implemented Interfaces:
Cancellable
- Direct Known Subclasses:
ExpansionEvent,NightMarketBuyItemEvent,NightMarketCloseEvent,NightMarketItemEvent,NightMarketMenuEvent,NightMarketOpenEvent
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts the callback, this then lets the event continue.static <T extends MarketEvent>
TCalls the event and runs the callback.booleanbooleanvoidDeprecated.Internal use only, do not use under any circumstances!voidThis method is called when the event is finished without having to rely on waiting a tick.voidsetCancelled(boolean cancelled) voidsetEventCallback(Runnable runnable) Deprecated.Internal use only, do not use under any circumstances!voidwaitForCallback(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
-
MarketEvent
public MarketEvent() -
MarketEvent
public MarketEvent(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.
-
getNightMarketAPI
- Returns:
- The API instance.
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceCancellable
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceCancellable
-
callEvent
public static <T extends MarketEvent> T 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.- Returns:
- The event that was called.
-