Class ToolUserManager

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.api.restartable.Restartable
nl.pim16aap2.animatedarchitecture.core.managers.ToolUserManager
All Implemented Interfaces:
IRestartable

@Singleton public final class ToolUserManager extends Restartable
Represents a class that manages ToolUsers.
  • Method Details

    • registerToolUser

      public void registerToolUser(ToolUser toolUser)
      Registers a ToolUser for a player.
      Parameters:
      toolUser - The ToolUser to register.
    • isToolUser

      public boolean isToolUser(IPlayer player)
      Checks if a player is currently a tool user. See isToolUser(UUID).
      Parameters:
      player - The player to check.
      Returns:
      True if the player is a tool user.
    • isToolUser

      public boolean isToolUser(UUID uuid)
      Checks if a player is currently a tool user. A player is a tool user if they have an active ToolUser process.
      Parameters:
      uuid - The UUID of the player to check.
      Returns:
      True if the player is a tool user.
    • getToolUser

      public Optional<ToolUser> getToolUser(IPlayer player)
      Gets the ToolUser for a player. See getToolUser(UUID).
      Parameters:
      player - The player to get the ToolUser for.
      Returns:
      The ToolUser for the player, if they are a tool user. Otherwise, an empty Optional.
    • getToolUser

      public Optional<ToolUser> getToolUser(UUID uuid)
      Gets the ToolUser for a player.
      Parameters:
      uuid - The UUID of the player.
      Returns:
      The ToolUser for the player, if they are a tool user. Otherwise, an empty Optional.
    • cancelToolUser

      public boolean cancelToolUser(IPlayer player)
      Cancels an active tool user process for a player.
      Parameters:
      player - The player whose tool user process to cancel.
      Returns:
      True if a process was cancelled.
    • cancelToolUser

      public boolean cancelToolUser(UUID uuid)
      Cancels an active tool user process for a player.
      Parameters:
      uuid - The UUID of the player whose tool user process to cancel.
      Returns:
      True if a process was cancelled.
    • shutDown

      public void shutDown()
      Description copied from interface: IRestartable
      Handles a shutdown.
    • startToolUser

      public void startToolUser(ToolUser toolUser, int time)
      Starts a timer for a ToolUser. After the provided number of seconds have passed, the ToolUser will be aborted if this h
      Parameters:
      toolUser - The ToolUser for which to start the timer.
      time - The amount of time (in milliseconds).
    • abortToolUser

      public void abortToolUser(UUID playerUUID)
      Stops and removes a player (defined by their UUID) if it is currently active. "Stop" here means that it will make sure to properly clean up the ToolUser.

      If no ToolUser is active for the given player, nothing happens.

      Parameters:
      playerUUID - The UUID of the player whose ToolUser to stop and remove.
    • abortToolUser

      public void abortToolUser(ToolUser toolUser)
      Stops and removes a ToolUser. "Stop" here means that it will make sure to properly clean up the ToolUser.
      Parameters:
      toolUser - The ToolUser to stop and remove.