Class ConfirmationBuilder
java.lang.Object
com.palmergames.bukkit.towny.confirmations.ConfirmationBuilder
A class responsible for assembling confirmations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new instance ofConfirmation
from this object's state.runOnCancel
(Runnable cancelHandler) The code to run on cancellation.void
sendTo
(org.bukkit.command.CommandSender sender) Builds and sends this confirmation to the given CommandSender.setAsync
(boolean runAsync) Sets whether the confirmation will run it's accept handler async or not.setCancelText
(String cancel) Sets the command which is displayed/run for the cancel command.setConfirmText
(String confirm) Sets the command which is displayed/run for the confirm command.setCost
(ConfirmationTransaction confirmationTransaction) Builds and sends this confirmation to the given CommandSender.setDuration
(int duration) Sets the duration the confirmation will run for.setPluginCommandPrefix
(String prefix) Sets the base plugin command used when the cancel or confirm commands are run.setTitle
(Translatable title) Sets the title of the confirmation to be sent.
-
Constructor Details
-
ConfirmationBuilder
public ConfirmationBuilder()
-
-
Method Details
-
runOnCancel
The code to run on cancellation.- Parameters:
cancelHandler
- The runnable to run on cancellation of the confirmation.- Returns:
- A builder reference of this object.
-
setTitle
Sets the title of the confirmation to be sent.- Parameters:
title
- The title of the confirmation.- Returns:
- A builder reference of this object.
-
setTitle
-
setDuration
Sets the duration the confirmation will run for.- Parameters:
duration
- The duration in second.- Returns:
- A builder reference of this object.
-
setCost
Builds and sends this confirmation to the given CommandSender.- Parameters:
confirmationTransaction
- The ConfirmationTransaction to apply to the confirmation.
-
setCancellableEvent
-
setAsync
Sets whether the confirmation will run it's accept handler async or not.- Parameters:
runAsync
- Whether to run async or not.- Returns:
- A builder reference of this object.
-
setConfirmText
Sets the command which is displayed/run for the confirm command.- Parameters:
confirm
- String command name.- Returns:
- ConfirmationBuilder with an overridden confirm text.
-
setCancelText
Sets the command which is displayed/run for the cancel command.- Parameters:
cancel
- String command name.- Returns:
- ConfirmationBuilder with an overriden cancel text.
-
setPluginCommandPrefix
Sets the base plugin command used when the cancel or confirm commands are run. ie: towny in /"towny":town spawn- Parameters:
prefix
- String plugin name sending this Confirmation.- Returns:
- ConfirmationBuilder with an overriden command prefix.
-
build
Builds a new instance ofConfirmation
from this object's state.- Returns:
- A new Confirmation object.
-
sendTo
public void sendTo(org.bukkit.command.CommandSender sender) Builds and sends this confirmation to the given CommandSender.- Parameters:
sender
- The sender to send the confirmation to.
-