Class LeaderboardHologram
java.lang.Object
com.maximde.hologramlib.hologram.custom.LeaderboardHologram
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for detecting bedrock players.static enumDeprecated.Head mode is no longer configurable.static classConfiguration options for customizing the leaderboard display.static enumstatic final recordRepresents a player's score entry.static enumstatic enum -
Constructor Summary
ConstructorsConstructorDescriptionCreates a leaderboard with the specified options and ID. -
Method Summary
Modifier and TypeMethodDescriptionGets all text holograms used by this leaderboard.Deprecated.The refactored version uses a single text hologram.static LeaderboardHologramgetLeaderboardByTextHologramId(String textHologramId) Gets the LeaderboardHologram associated with a specific text hologram ID.org.bukkit.LocationGets the leaderboard's current location.voidhide(org.bukkit.entity.Player player) Hides the leaderboard from a specific player.booleanisDead()Checks if the leaderboard is dead (not spawned or has been killed).voidkill()Deprecated.Use HologramManager.remove() instead for proper cleanupvoidremovePlayer(UUID uuid) Removes a player from the leaderboard.rotate(float x, float y) Rotates the leaderboard.voidReplaces all scores with the provided data.Sets the leaderboard to fixed rotation mode.voidsetPlayerScore(UUID uuid, String name, double score) Sets or updates the score for a player.voidsetPlayerScore(UUID uuid, String name, long score) Sets or updates the score for a player.voidshow(org.bukkit.entity.Player player) Shows the leaderboard to a specific player.spawn(org.bukkit.Location location) Spawns the leaderboard at the specified location.spawn(org.bukkit.Location location, boolean ignorePitchYaw) Spawns the leaderboard at the specified location.teleport(org.bukkit.Location location) Teleports the leaderboard to a new location.voidupdate()Updates the leaderboard display with current player data.protected voidvalidateId(String id)
-
Constructor Details
-
LeaderboardHologram
Creates a leaderboard with the specified options and ID.- Parameters:
options- Configuration options for the leaderboardid- Unique identifier (cannot contain spaces)
-
-
Method Details
-
getLeaderboardByTextHologramId
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
-
setPlayerScore
Sets or updates the score for a player.- Parameters:
uuid- Player's UUIDname- Player's display namescore- Player's score (double)
-
setPlayerScore
Sets or updates the score for a player.- Parameters:
uuid- Player's UUIDname- Player's display namescore- Player's score (long)
-
setAllScores
Replaces all scores with the provided data.- Parameters:
data- Map of UUID to PlayerScore
-
removePlayer
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
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
Spawns the leaderboard at the specified location.- Parameters:
location- The spawn locationignorePitchYaw- If true, ignores the pitch and yaw of the location- Returns:
- This leaderboard for chaining
-
teleport
Teleports the leaderboard to a new location. If not yet spawned, this will spawn it first. Automatically callsupdate()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
Rotates the leaderboard.- Parameters:
x- Yaw rotationy- Pitch rotation- Returns:
- This leaderboard for chaining
-
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.Use HologramManager.remove() instead for proper cleanupKills the leaderboard and all its entities. -
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.The refactored version uses a single text hologram. This method returns an empty list for backward compatibility.Gets individual entry holograms.- Returns:
- Empty list
-