Class LeaderboardHologram

java.lang.Object
com.maximde.hologramlib.hologram.custom.LeaderboardHologram

@Experimental public class LeaderboardHologram extends Object
  • Constructor Details

    • LeaderboardHologram

      public LeaderboardHologram(LeaderboardHologram.LeaderboardOptions options, String id)
      Creates a leaderboard with the specified options and ID.
      Parameters:
      options - Configuration options for the leaderboard
      id - Unique identifier (cannot contain spaces)
  • Method Details

    • getLeaderboardByTextHologramId

      public static LeaderboardHologram getLeaderboardByTextHologramId(String textHologramId)
      Gets the LeaderboardHologram associated with a specific text hologram ID. Used internally for bedrock player filtering.
      Parameters:
      textHologramId - The ID of the text hologram
      Returns:
      The associated LeaderboardHologram, or null if not found
    • validateId

      protected void validateId(String id)
    • setPlayerScore

      public void setPlayerScore(UUID uuid, String name, double score)
      Sets or updates the score for a player.
      Parameters:
      uuid - Player's UUID
      name - Player's display name
      score - Player's score (double)
    • setPlayerScore

      public void setPlayerScore(UUID uuid, String name, long score)
      Sets or updates the score for a player.
      Parameters:
      uuid - Player's UUID
      name - Player's display name
      score - Player's score (long)
    • setAllScores

      public void setAllScores(Map<UUID,LeaderboardHologram.PlayerScore> data)
      Replaces all scores with the provided data.
      Parameters:
      data - Map of UUID to PlayerScore
    • removePlayer

      public void removePlayer(UUID uuid)
      Removes a player from the leaderboard.
      Parameters:
      uuid - Player's UUID to remove
    • update

      public void update()
      Updates the leaderboard display with current player data. Call this after modifying scores to refresh the visual display.
    • spawn

      public LeaderboardHologram spawn(org.bukkit.Location location)
      Spawns the leaderboard at the specified location. This is the initial spawn - creates the hologram entities.
      Parameters:
      location - The spawn location
      Returns:
      This leaderboard for chaining
    • spawn

      public LeaderboardHologram spawn(org.bukkit.Location location, boolean ignorePitchYaw)
      Spawns the leaderboard at the specified location.
      Parameters:
      location - The spawn location
      ignorePitchYaw - If true, ignores the pitch and yaw of the location
      Returns:
      This leaderboard for chaining
    • teleport

      public LeaderboardHologram teleport(org.bukkit.Location location)
      Teleports the leaderboard to a new location. If not yet spawned, this will spawn it first. Automatically calls update() to refresh the display.
      Parameters:
      location - The new location
      Returns:
      This leaderboard for chaining
    • show

      public void show(org.bukkit.entity.Player player)
      Shows the leaderboard to a specific player.
      Parameters:
      player - The player to show the leaderboard to
    • hide

      public void hide(org.bukkit.entity.Player player)
      Hides the leaderboard from a specific player.
      Parameters:
      player - The player to hide the leaderboard from
    • rotate

      @Experimental public LeaderboardHologram rotate(float x, float y)
      Rotates the leaderboard.
      Parameters:
      x - Yaw rotation
      y - Pitch rotation
      Returns:
      This leaderboard for chaining
    • setFixedRotation

      public LeaderboardHologram setFixedRotation()
      Sets the leaderboard to fixed rotation mode. The leaderboard will not rotate to face players.
      Returns:
      This leaderboard for chaining
    • getLocation

      public org.bukkit.Location getLocation()
      Gets the leaderboard's current location.
      Returns:
      A clone of the base location, or null if not yet positioned
    • isDead

      public boolean isDead()
      Checks if the leaderboard is dead (not spawned or has been killed).
      Returns:
      true if the leaderboard is dead
    • kill

      @Deprecated public void kill()
      Deprecated.
      Use HologramManager.remove() instead for proper cleanup
      Kills the leaderboard and all its entities.
    • getAllTextHolograms

      public List<TextHologram> getAllTextHolograms()
      Gets all text holograms used by this leaderboard. In the refactored version, this returns a single-element list.
      Returns:
      List containing the main text hologram
    • getEntryHolograms

      @Deprecated public List<TextHologram> getEntryHolograms()
      Deprecated.
      The refactored version uses a single text hologram. This method returns an empty list for backward compatibility.
      Gets individual entry holograms.
      Returns:
      Empty list