Class Confirmation
java.lang.Object
com.palmergames.bukkit.towny.confirmations.Confirmation
An object which stores information about confirmations. While this
object itself is immutable and threadsafe, async operations within
its handlers may not be thus, use async judiciously.
- Author:
- Suneet Tipirneni (Siris)
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConfirmation(ConfirmationBuilder builder) Internal use only. -
Method Summary
Modifier and TypeMethodDescriptionGets the handler that contains the code to run on completion.Gets the handler that contains the code to run on cancellation.intGets the duration (in seconds) of this confirmation.getEvent()getTitle()Gets the title of the confirmation message.Gets the ConfirmationTransaction.booleanhasCost()booleanisAsync()Whether the handers of this confirmation will run async or not.static ConfirmationBuilderrunOnAccept(Runnable acceptHandler) Creates a newConfirmationBuilderwith the supplied accept handler.static ConfirmationBuilderrunOnAcceptAsync(Runnable acceptHandler) Creates a newConfirmationBuilderwith the given accept handler.
-
Constructor Details
-
Confirmation
Internal use only.- Parameters:
builder- The builder to construct from.
-
-
Method Details
-
runOnAccept
Creates a newConfirmationBuilderwith the supplied accept handler.- Parameters:
acceptHandler- The runnable to run on accepting the confirmation.- Returns:
- A new confirmation builder with the given accept handler.
-
runOnAcceptAsync
Creates a newConfirmationBuilderwith the given accept handler.- Parameters:
acceptHandler- The runnable to run when the confirmation is accepted.- Returns:
- A new builder with the given accept handler.
-
getAcceptHandler
Gets the handler that contains the code to run on completion.- Returns:
- The handler
-
getCancelHandler
Gets the handler that contains the code to run on cancellation.- Returns:
- The handler.
-
getTitle
Gets the title of the confirmation message.- Returns:
- The title of the confirmation message.
-
getDuration
public int getDuration()Gets the duration (in seconds) of this confirmation.- Returns:
- The duration in seconds.
-
hasCost
public boolean hasCost()- Returns:
- True when there is a ConfirmationTransaction.
-
getTransaction
Gets the ConfirmationTransaction.- Returns:
- the transaction.
-
getConfirmCommand
-
getCancelCommand
-
getPluginPrefix
-
getEvent
-
isAsync
public boolean isAsync()Whether the handers of this confirmation will run async or not.- Returns:
- true if async, false otherwise.
-