Class ActionBarHandler

java.lang.Object
me.fami6xx.rpuniverse.core.misc.basichandlers.ActionBarHandler

public class ActionBarHandler extends Object
The ActionBarHandler is the main class for handling the action bars. It is responsible for adding, removing, and updating the action bars.

The ActionBarHandler is a singleton class, so only one instance of it should be created.

The ActionBarHandler is also a listener for the PlayerJoinEvent and PlayerQuitEvent. This means that the ActionBarHandler will also listen for these events and update the action bars accordingly.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addMessage​(org.bukkit.entity.Player player, String message)
    Add a message to the player's action bar.
    void
    addMessage​(org.bukkit.entity.Player player, String message, boolean force)
    Add a message to the player's action bar.
    void
    addPlayer​(org.bukkit.entity.Player player, List<String> messages)
    Add a player to the playerMessages map and start cycling messages for that player.
    getMessages​(org.bukkit.entity.Player player)
    Get queued messages for the player.
    void
    removeMessage​(org.bukkit.entity.Player player, String message)
    Remove a message from the player's action bar.
    void
    removePlayer​(org.bukkit.entity.Player player)
    Remove a player from the playerMessages map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ActionBarHandler

      public ActionBarHandler()
  • Method Details

    • addPlayer

      public void addPlayer(org.bukkit.entity.Player player, List<String> messages)
      Add a player to the playerMessages map and start cycling messages for that player.
      Parameters:
      player - The player to add.
      messages - The list of messages for the player.
    • removePlayer

      public void removePlayer(org.bukkit.entity.Player player)
      Remove a player from the playerMessages map.
      Parameters:
      player - The player to be removed.
    • addMessage

      public void addMessage(org.bukkit.entity.Player player, String message, boolean force)
      Add a message to the player's action bar. This method will add the given message to the action bar of the specified player. If the player is not currently displaying any messages, the action bar will start cycling through the messages periodically.
      Parameters:
      player - The player to add the message for.
      message - The message to add.
      force - Whether to immediately display the message on the action bar.
    • addMessage

      public void addMessage(org.bukkit.entity.Player player, String message)
      Add a message to the player's action bar. This method will add the given message to the action bar of the specified player. If the player is not currently displaying any messages, the action bar will start cycling through the messages periodically.
      Parameters:
      player - The player to add the message for.
      message - The message to add.
    • getMessages

      public Queue<String> getMessages(org.bukkit.entity.Player player)
      Get queued messages for the player.
      Parameters:
      player - The player to get the messages for.
      Returns:
      The messages for the player.
    • removeMessage

      public void removeMessage(org.bukkit.entity.Player player, String message)
      Remove a message from the player's action bar.
      Parameters:
      player - The player to remove the message from.
      message - The message to remove.