Class ActionbarManager
java.lang.Object
me.remigio07.chatplugin.api.server.actionbar.ActionbarManager
- All Implemented Interfaces:
Runnable
,ChatPluginManager
Manager that handles
Actionbar
s.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pattern
Pattern representing the allowed actionbar IDs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetActionbar
(String id) Gets an actionbar fromgetActionbars()
by its ID.Gets the list of loaded actionbars.static ActionbarManager
Gets this manager's instance.Gets the list of placeholder types used to translateActionbar.getTexts()
.Gets the actionbars' prefix.long
Gets the timeout between sendings, in milliseconds.int
Gets therun()
's timer's index ofgetActionbars()
.long
Gets therun()
's timer's task's ID.boolean
Checks ifgetPrefix()
should be applied to actionbars.boolean
Checks if this manager is enabled.boolean
Checks if the actionbars should be sent in a random order.boolean
isValidActionbarID
(String actionbarID) Checks if the specified String is a valid actionbar ID.abstract void
run()
Automatic actionbar sender, called once everygetSendingTimeout()
ms.abstract void
sendActionbar
(Actionbar actionbar, ChatPluginServerPlayer player) Sends an actionbar to a loaded player.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.remigio07.chatplugin.api.common.util.manager.ChatPluginManager
checkAvailability, isReloadable, load, reload, unload
-
Field Details
-
ACTIONBAR_ID_PATTERN
Pattern representing the allowed actionbar IDs.Regex:
^[a-zA-Z0-9-_]{2,36}$
- See Also:
-
-
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 interfaceChatPluginManager
- 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 ifgetPrefix()
should be applied to actionbars.Found at: "actionbars.settings.prefix.enabled" in
ConfigurationType.ACTIONBARS
- Returns:
- Whether to use prefixes
-
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
Gets the list of placeholder types used to translateActionbar.getTexts()
.Found at: "actionbars.settings.placeholder-types" in
ConfigurationType.ACTIONBARS
- Returns:
- Placeholders used to translate texts
-
getActionbars
Gets the list of loaded actionbars.You may modify the returned list.
- Returns:
- Loaded actionbars' list
-
getActionbar
Gets an actionbar fromgetActionbars()
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 therun()
'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 therun()
's timer's index ofgetActionbars()
.- Returns:
- Timer's index
-
isValidActionbarID
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
Gets this manager's instance.- Returns:
- Manager's instance
-
run
public abstract void run()Automatic actionbar sender, called once everygetSendingTimeout()
ms. -
sendActionbar
Sends an actionbar to a loaded player.It will not be sent if
Actionbar.isHidden()
or!
ChatPluginServerPlayer.hasActionbarEnabled()
.- Parameters:
actionbar
- Actionbar to sendplayer
- Player to send the actionbar to- See Also:
-