Class ActionbarManager

java.lang.Object
me.remigio07.chatplugin.api.server.actionbar.ActionbarManager
All Implemented Interfaces:
Runnable, ChatPluginManager

public abstract class ActionbarManager extends Object implements ChatPluginManager, Runnable
Manager that handles Actionbars.
See Also:
  • Field Details

  • Constructor Details

    • ActionbarManager

      public ActionbarManager()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Checks if this manager is enabled.

      Found at: "actionbars.settings.enabled" in ConfigurationType.ACTIONBARS

      Specified by:
      isEnabled in interface ChatPluginManager
      Returns:
      Whether this manager is enabled
    • isRandomOrder

      public boolean isRandomOrder()
      Checks if the actionbars should be sent in a random order.

      Found at: "actionbars.settings.random-order" in ConfigurationType.ACTIONBARS

      Returns:
      Whether to use a random order
    • hasPrefix

      public boolean hasPrefix()
      Checks if getPrefix() should be applied to actionbars.

      Found at: "actionbars.settings.prefix.enabled" in ConfigurationType.ACTIONBARS

      Returns:
      Whether to use prefixes
    • getPrefix

      public String getPrefix()
      Gets the actionbars' prefix.

      Found at: "actionbars.settings.prefix.format" in ConfigurationType.ACTIONBARS

      Returns:
      Actionbars' prefix
      See Also:
    • getSendingTimeout

      public long getSendingTimeout()
      Gets the timeout between sendings, in milliseconds.

      Found at: "actionbars.settings.sending-timeout-ms" in ConfigurationType.ACTIONBARS

      Returns:
      Time between sendings
    • getPlaceholderTypes

      public List<PlaceholderType> getPlaceholderTypes()
      Gets the list of placeholder types used to translate Actionbar.getTexts().

      Found at: "actionbars.settings.placeholder-types" in ConfigurationType.ACTIONBARS

      Returns:
      Placeholders used to translate texts
    • getActionbars

      public List<Actionbar> getActionbars()
      Gets the list of loaded actionbars.

      You may modify the returned list.

      Returns:
      Loaded actionbars' list
    • getActionbar

      public Actionbar getActionbar(String id)
      Gets an actionbar from getActionbars() by its ID.

      Will return null if the actionbar is not loaded.

      Parameters:
      id - Actionbar's ID, case insensitive
      Returns:
      Loaded actionbar
    • getTimerTaskID

      public long getTimerTaskID()
      Gets the run()'s timer's task's ID.

      You can interact with it using TaskManager's methods.

      Returns:
      Sending task's ID
    • getTimerIndex

      public int getTimerIndex()
      Gets the run()'s timer's index of getActionbars().
      Returns:
      Timer's index
    • isValidActionbarID

      public boolean isValidActionbarID(String actionbarID)
      Checks if the specified String is a valid actionbar ID.
      Parameters:
      actionbarID - Actionbar ID to check
      Returns:
      Whether the specified actionbar ID is valid
      See Also:
    • getInstance

      public static ActionbarManager getInstance()
      Gets this manager's instance.
      Returns:
      Manager's instance
    • run

      public abstract void run()
      Automatic actionbar sender, called once every getSendingTimeout() ms.
      Specified by:
      run in interface Runnable
    • sendActionbar

      public abstract void sendActionbar(Actionbar actionbar, ChatPluginServerPlayer player)
      Sends an actionbar to a loaded player.

      It will not be sent if Actionbar.isHidden() or !ChatPluginServerPlayer.hasActionbarEnabled().

      Parameters:
      actionbar - Actionbar to send
      player - Player to send the actionbar to
      See Also: