Class Confirmation

java.lang.Object
com.palmergames.bukkit.towny.confirmations.Confirmation

public class Confirmation extends Object
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 Details

    • Confirmation

      protected Confirmation(ConfirmationBuilder builder)
      Internal use only.
      Parameters:
      builder - The builder to construct from.
  • Method Details

    • runOnAccept

      public static ConfirmationBuilder runOnAccept(Runnable acceptHandler)
      Creates a new ConfirmationBuilder with 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

      public static ConfirmationBuilder runOnAcceptAsync(Runnable acceptHandler)
      Creates a new ConfirmationBuilder with 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

      public Runnable getAcceptHandler()
      Gets the handler that contains the code to run on completion.
      Returns:
      The handler
    • getCancelHandler

      public Runnable getCancelHandler()
      Gets the handler that contains the code to run on cancellation.
      Returns:
      The handler.
    • getTitle

      public Translatable 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

      public ConfirmationTransaction getTransaction()
      Gets the ConfirmationTransaction.
      Returns:
      the transaction.
    • getConfirmCommand

      public String getConfirmCommand()
    • getCancelCommand

      public String getCancelCommand()
    • getPluginPrefix

      public String getPluginPrefix()
    • getEvent

      public CancellableTownyEvent getEvent()
    • isAsync

      public boolean isAsync()
      Whether the handers of this confirmation will run async or not.
      Returns:
      true if async, false otherwise.