Class WrappedSidebar

java.lang.Object
com.andrei1058.spigot.sidebar.WrappedSidebar
All Implemented Interfaces:
Sidebar

public class WrappedSidebar extends Object implements Sidebar
  • 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

      public void setTitle(SidebarLine title)
      Description copied from interface: Sidebar
      Set scoreboard title. It will send the update to players automatically.
      Specified by:
      setTitle in interface Sidebar
      Parameters:
      title - content.
    • addPlaceholder

      public void addPlaceholder(PlaceholderProvider placeholderProvider)
      Description copied from interface: Sidebar
      Add a new placeholder provider for sidebar lines.
      Specified by:
      addPlaceholder in interface Sidebar
      Parameters:
      placeholderProvider - placeholder.
    • addLine

      public void addLine(SidebarLine sidebarLine)
      Description copied from interface: Sidebar
      Add a new line to the scoreboard.
      Specified by:
      addLine in interface Sidebar
      Parameters:
      sidebarLine - content.
    • setLine

      public void setLine(SidebarLine sidebarLine, int line)
      Description copied from interface: Sidebar
      Set a line content. Ignored if not exists. It will send the update to players automatically.
      Specified by:
      setLine in interface Sidebar
      Parameters:
      sidebarLine - content.
      line - position. 0 bottom.
    • add

      public void add(org.bukkit.entity.Player player)
      Description copied from interface: Sidebar
      Apply scoreboard to a player.
      Specified by:
      add in interface Sidebar
      Parameters:
      player - user.
    • 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 of SidebarLineAnimated, use Sidebar.refreshAnimatedLines() instead.
      Specified by:
      refreshPlaceholders in interface Sidebar
    • 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 interface Sidebar
    • refreshAnimatedLines

      public void refreshAnimatedLines()
      Description copied from interface: Sidebar
      Refresh animated lines. Title excluded. Can be used async.
      Specified by:
      refreshAnimatedLines in interface Sidebar
    • 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 interface Sidebar
      Parameters:
      line - position. 0 is bottom.
    • clearLines

      public void clearLines()
      Specified by:
      clearLines in interface Sidebar
    • lineCount

      public int lineCount()
      Specified by:
      lineCount in interface Sidebar
      Returns:
      lines amount.
    • removePlaceholder

      public void removePlaceholder(String placeholder)
      Description copied from interface: Sidebar
      Remove a placeholder.
      Specified by:
      removePlaceholder in interface Sidebar
      Parameters:
      placeholder - placeholder to be removed.
    • getPlaceholders

      public Collection<PlaceholderProvider> getPlaceholders()
      Description copied from interface: Sidebar
      Get placeholder providers list.
      Specified by:
      getPlaceholders in interface Sidebar
      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.
      Specified by:
      remove in interface Sidebar
      Parameters:
      player - uuid.
    • setPlayerHealth

      public void setPlayerHealth(org.bukkit.entity.Player player, int health)
      Description copied from interface: Sidebar
      Update player health if shown with Sidebar.showPlayersHealth(SidebarLine, boolean).
      Specified by:
      setPlayerHealth in interface Sidebar
      Parameters:
      player - subject.
      health - amount.
    • getHealthObjective

      public SidebarObjective getHealthObjective()
    • getReceivers

      public LinkedList<org.bukkit.entity.Player> getReceivers()
    • hidePlayersHealth

      public void hidePlayersHealth()
      Description copied from interface: Sidebar
      Hide players health previously shown with Sidebar.showPlayersHealth(SidebarLine, boolean).
      Specified by:
      hidePlayersHealth in interface Sidebar
    • showPlayersHealth

      public void showPlayersHealth(SidebarLine displayName, boolean list)
      Description copied from interface: Sidebar
      Show players name.
      Specified by:
      showPlayersHealth in interface Sidebar
      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 interface Sidebar
      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

      public void removeTab(String identifier)
      Description copied from interface: Sidebar
      Remove tab group form tab list by identifier.
      Specified by:
      removeTab in interface Sidebar
      Parameters:
      identifier - name.
    • removeTabs

      public void removeTabs()
      Description copied from interface: Sidebar
      Remove all tab lists.
      Specified by:
      removeTabs in interface Sidebar
    • playerTabRefreshAnimation

      public void playerTabRefreshAnimation()
      Description copied from interface: Sidebar
      Refresh tab-list animations (if making use of SidebarLineAnimated).
      Specified by:
      playerTabRefreshAnimation in interface Sidebar
    • playerHealthRefreshAnimation

      public void playerHealthRefreshAnimation()
      Description copied from interface: Sidebar
      Refresh bellow player-name animations (if making use of SidebarLineAnimated) and if health is displayed via Sidebar.showPlayersHealth(SidebarLine, boolean).
      Specified by:
      playerHealthRefreshAnimation in interface Sidebar
    • getSidebarObjective

      public SidebarObjective getSidebarObjective()