Package com.andrei1058.spigot.sidebar
Class WrappedSidebar
java.lang.Object
com.andrei1058.spigot.sidebar.WrappedSidebar
- All Implemented Interfaces:
Sidebar
-
Constructor Summary
ConstructorDescriptionWrappedSidebar
(@NotNull SidebarLine title, @NotNull Collection<SidebarLine> lines, Collection<PlaceholderProvider> placeholderProvider) Create a new versioned 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.LinkedList<org.bukkit.entity.Player>
void
Hide players health previously shown withSidebar.showPlayersHealth(SidebarLine, boolean)
.int
void
Refresh bellow player-name animations (if making use ofSidebarLineAnimated
) and if health is displayed viaSidebar.showPlayersHealth(SidebarLine, boolean)
.playerTabCreate
(@NotNull 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 withSidebar.showPlayersHealth(SidebarLine, boolean)
.void
setTitle
(SidebarLine title) Set scoreboard title.void
showPlayersHealth
(SidebarLine displayName, boolean list) Show players name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.andrei1058.spigot.sidebar.Sidebar
playerTabCreate
-
Constructor Details
-
WrappedSidebar
public WrappedSidebar(@NotNull @NotNull SidebarLine title, @NotNull @NotNull Collection<SidebarLine> lines, Collection<PlaceholderProvider> placeholderProvider) Create a new versioned sidebar.- Parameters:
title
- sidebar title.lines
- sidebar content.placeholderProvider
- a list of your placeholders.
-
-
Method Details
-
setTitle
Description copied from interface:Sidebar
Set scoreboard title. It will send the update to players automatically. -
addPlaceholder
Description copied from interface:Sidebar
Add a new placeholder provider for sidebar lines.- Specified by:
addPlaceholder
in interfaceSidebar
- Parameters:
placeholderProvider
- placeholder.
-
addLine
Description copied from interface:Sidebar
Add a new line to the scoreboard. -
setLine
Description copied from interface:Sidebar
Set a line content. Ignored if not exists. It will send the update to players automatically. -
add
public void add(org.bukkit.entity.Player player) Description copied from interface:Sidebar
Apply scoreboard to a player. -
refreshPlaceholders
public void refreshPlaceholders()Description copied from interface:Sidebar
Refresh scoreboard placeholders where line is not animated. Can be used async. Does not refresh instances ofSidebarLineAnimated
, useSidebar.refreshAnimatedLines()
instead.- Specified by:
refreshPlaceholders
in interfaceSidebar
-
refreshTitle
public void refreshTitle()Description copied from interface:Sidebar
Refresh scoreboard title. Useful when you have an animated title. Can be used async.- Specified by:
refreshTitle
in interfaceSidebar
-
refreshAnimatedLines
public void refreshAnimatedLines()Description copied from interface:Sidebar
Refresh animated lines. Title excluded. Can be used async.- Specified by:
refreshAnimatedLines
in interfaceSidebar
-
removeLine
public void removeLine(int line) Description copied from interface:Sidebar
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.- Specified by:
removeLine
in interfaceSidebar
- Parameters:
line
- position. 0 is bottom.
-
clearLines
public void clearLines()- Specified by:
clearLines
in interfaceSidebar
-
lineCount
public int lineCount() -
removePlaceholder
Description copied from interface:Sidebar
Remove a placeholder.- Specified by:
removePlaceholder
in interfaceSidebar
- Parameters:
placeholder
- placeholder to be removed.
-
getPlaceholders
Description copied from interface:Sidebar
Get placeholder providers list.- Specified by:
getPlaceholders
in interfaceSidebar
- Returns:
- placeholder providers list.
-
remove
public void remove(org.bukkit.entity.Player player) Description copied from interface:Sidebar
It is very important to call this when a player logs out or before deleting a scoreboard. -
setPlayerHealth
public void setPlayerHealth(org.bukkit.entity.Player player, int health) Description copied from interface:Sidebar
Update player health if shown withSidebar.showPlayersHealth(SidebarLine, boolean)
.- Specified by:
setPlayerHealth
in interfaceSidebar
- Parameters:
player
- subject.health
- amount.
-
getHealthObjective
-
getReceivers
-
hidePlayersHealth
public void hidePlayersHealth()Description copied from interface:Sidebar
Hide players health previously shown withSidebar.showPlayersHealth(SidebarLine, boolean)
.- Specified by:
hidePlayersHealth
in interfaceSidebar
-
showPlayersHealth
Description copied from interface:Sidebar
Show players name.- Specified by:
showPlayersHealth
in interfaceSidebar
- Parameters:
displayName
- text under player name.list
- show health scale on tab.
-
playerTabCreate
public PlayerTab playerTabCreate(@NotNull @NotNull String identifier, @Nullable @Nullable org.bukkit.entity.Player player, SidebarLine prefix, SidebarLine suffix, PlayerTab.PushingRule pushingRule, @Nullable @Nullable Collection<PlaceholderProvider> placeholders) Description copied from interface:Sidebar
Create a new tab list layout group. Players added to this group will have the same prefix-suffix.- Specified by:
playerTabCreate
in interfaceSidebar
- Parameters:
identifier
- char limit is 16.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
Description copied from interface:Sidebar
Remove tab group form tab list by identifier. -
removeTabs
public void removeTabs()Description copied from interface:Sidebar
Remove all tab lists.- Specified by:
removeTabs
in interfaceSidebar
-
playerTabRefreshAnimation
public void playerTabRefreshAnimation()Description copied from interface:Sidebar
Refresh tab-list animations (if making use ofSidebarLineAnimated
).- Specified by:
playerTabRefreshAnimation
in interfaceSidebar
-
playerHealthRefreshAnimation
public void playerHealthRefreshAnimation()Description copied from interface:Sidebar
Refresh bellow player-name animations (if making use ofSidebarLineAnimated
) and if health is displayed viaSidebar.showPlayersHealth(SidebarLine, boolean)
.- Specified by:
playerHealthRefreshAnimation
in interfaceSidebar
-
getSidebarObjective
-