Package com.andrei1058.spigot.sidebar
Interface Sidebar
- All Known Implementing Classes:
WrappedSidebar
public interface Sidebar
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(org.bukkit.entity.Player player) Apply scoreboard to a player.void
addLine
(SidebarLine sidebarLine) Add a new line to the scoreboard.void
addPlaceholder
(PlaceholderProvider placeholderProvider) Add a new placeholder provider for sidebar lines.void
Get placeholder providers list.void
Hide players health previously shown withshowPlayersHealth(SidebarLine, boolean)
.int
void
Refresh bellow player-name animations (if making use ofSidebarLineAnimated
) and if health is displayed viashowPlayersHealth(SidebarLine, boolean)
.default PlayerTab
playerTabCreate
(String identifier, @Nullable org.bukkit.entity.Player player, SidebarLine prefix, SidebarLine suffix, PlayerTab.PushingRule pushingRule) Create a new tab list layout group.playerTabCreate
(String identifier, @Nullable org.bukkit.entity.Player player, SidebarLine prefix, SidebarLine suffix, PlayerTab.PushingRule pushingRule, @Nullable Collection<PlaceholderProvider> placeholders) Create a new tab list layout group.void
Refresh tab-list animations (if making use ofSidebarLineAnimated
).void
Refresh animated lines.void
Refresh scoreboard placeholders where line is not animated.void
Refresh scoreboard title.void
remove
(org.bukkit.entity.Player player) It is very important to call this when a player logs out or before deleting a scoreboard.void
removeLine
(int line) Remove a line from the scoreboard.void
removePlaceholder
(String placeholder) Remove a placeholder.void
Remove tab group form tab list by identifier.void
Remove all tab lists.void
setLine
(SidebarLine sidebarLine, int line) Set a line content.void
setPlayerHealth
(org.bukkit.entity.Player player, int health) Update player health if shown withshowPlayersHealth(SidebarLine, boolean)
.void
setTitle
(SidebarLine title) Set scoreboard title.void
showPlayersHealth
(SidebarLine displayName, boolean list) Show players name.
-
Method Details
-
addLine
Add a new line to the scoreboard.- Parameters:
sidebarLine
- content.
-
setLine
Set a line content. Ignored if not exists. It will send the update to players automatically.- Parameters:
sidebarLine
- content.line
- position. 0 bottom.
-
setTitle
Set scoreboard title. It will send the update to players automatically.- Parameters:
title
- content.
-
refreshPlaceholders
void refreshPlaceholders()Refresh scoreboard placeholders where line is not animated. Can be used async. Does not refresh instances ofSidebarLineAnimated
, userefreshAnimatedLines()
instead. -
refreshTitle
void refreshTitle()Refresh scoreboard title. Useful when you have an animated title. Can be used async. -
remove
void remove(org.bukkit.entity.Player player) It is very important to call this when a player logs out or before deleting a scoreboard.- Parameters:
player
- uuid.
-
add
void add(org.bukkit.entity.Player player) Apply scoreboard to a player.- Parameters:
player
- user.
-
refreshAnimatedLines
void refreshAnimatedLines()Refresh animated lines. Title excluded. Can be used async. -
removeLine
void removeLine(int line) Remove a line from the scoreboard. Ignored if line does not exist. Line 0 is the first from bottom. It will send the update to players automatically.- Parameters:
line
- position. 0 is bottom.
-
clearLines
void clearLines() -
lineCount
int lineCount()- Returns:
- lines amount.
-
getPlaceholders
Collection<PlaceholderProvider> getPlaceholders()Get placeholder providers list.- Returns:
- placeholder providers list.
-
setPlayerHealth
void setPlayerHealth(org.bukkit.entity.Player player, int health) Update player health if shown withshowPlayersHealth(SidebarLine, boolean)
.- Parameters:
player
- subject.health
- amount.
-
hidePlayersHealth
void hidePlayersHealth()Hide players health previously shown withshowPlayersHealth(SidebarLine, boolean)
. -
showPlayersHealth
Show players name.- Parameters:
displayName
- text under player name.list
- show health scale on tab.
-
playerTabCreate
default PlayerTab playerTabCreate(String identifier, @Nullable @Nullable org.bukkit.entity.Player player, SidebarLine prefix, SidebarLine suffix, PlayerTab.PushingRule pushingRule) Create a new tab list layout group. Players added to this group will have the same prefix-suffix.- Parameters:
identifier
- group identifier.player
- initial member. PAPI subject.prefix
- prefix text or animation.suffix
- suffix text or animation.pushingRule
- how to manage pushing.- Returns:
- tab group instance.
-
playerTabCreate
PlayerTab playerTabCreate(String identifier, @Nullable @Nullable org.bukkit.entity.Player player, SidebarLine prefix, SidebarLine suffix, PlayerTab.PushingRule pushingRule, @Nullable @Nullable Collection<PlaceholderProvider> placeholders) Create a new tab list layout group. Players added to this group will have the same prefix-suffix.- Parameters:
identifier
- group identifier.player
- initial member. PAPI subject.prefix
- prefix text or animation.suffix
- suffix text or animation.pushingRule
- how to manage pushing.placeholders
- placeholders.- Returns:
- tab group instance.
-
removeTab
Remove tab group form tab list by identifier.- Parameters:
identifier
- name.
-
removeTabs
void removeTabs()Remove all tab lists. -
playerTabRefreshAnimation
void playerTabRefreshAnimation()Refresh tab-list animations (if making use ofSidebarLineAnimated
). -
playerHealthRefreshAnimation
void playerHealthRefreshAnimation()Refresh bellow player-name animations (if making use ofSidebarLineAnimated
) and if health is displayed viashowPlayersHealth(SidebarLine, boolean)
. -
addPlaceholder
Add a new placeholder provider for sidebar lines.- Parameters:
placeholderProvider
- placeholder.
-
removePlaceholder
Remove a placeholder.- Parameters:
placeholder
- placeholder to be removed.
-