Class ScoreboardHandler

java.lang.Object
de.marcely.bedwars.api.game.scoreboard.ScoreboardHandler

public abstract class ScoreboardHandler extends Object
Manages the creation and termination of a scoreboard and what's getting displayed on the scoreboard
  • Constructor Details

    • ScoreboardHandler

      public ScoreboardHandler()
  • Method Details

    • getPlugin

      public abstract Plugin getPlugin()
      Returns the plugin that initiated this instance
      Returns:
      The plugin backed by this handler
    • display0

      protected abstract boolean display0(Player player, Arena arena, ScoreboardType type) throws Exception
      Displays the scoreboard to the player.

      Use Arena.updateScoreboard() to automatically do that for all players in an arena.

      Parameters:
      player - The target to whom the scoreboard shall be shown to
      arena - The arena in which the player is probably in. Will display the infos from that arena
      type - For what purpose the scorebord is getting displayed
      Returns:
      false if it failed or the scoreboard is disabled for the arena's current state
      Throws:
      Exception - MBedwars will handle occurring errors
    • hide0

      protected abstract boolean hide0(Player player) throws Exception
      Hides the scoreboard from a player who's seeing it
      Parameters:
      player - The player from whom it shall be hidden
      Returns:
      false if the player is already not seeing it. Otherwise true
      Throws:
      Exception - MBedwars will handle occurring errors
    • update0

      protected abstract void update0(ScoreboardUpdateCause cause, Arena arena, Object data) throws Exception
      Updates a specific part of the scoreboard
      Parameters:
      cause - What part shall be updated
      arena - The arena involved in the update
      data - Data that comes with it
      Throws:
      Exception - MBedwars will handle occurring errors
    • isActive

      public abstract boolean isActive(Player player)
      Returns whether or not the scoreboard is active for a given player. This does not mean that it's actually visible for him. It only means that the handler is processing the given player. Possibly an other plugin is overwritting the scoreboard or the handler just hasn't staerted yet.
      Parameters:
      player - The player for who the scoreboard is possibly active
      Returns:
      true when this handler is processing the given player
    • getActivePlayers

      public abstract Collection<Player> getActivePlayers()
      Similar to isActive(Player), but returns all players to whom this applies to.
      Returns:
      All players that get processed by this handler
    • hideAll

      public void hideAll(Arena arena)
      Similar to hide(Player), but does that for all players (including spectators) inside an arena
      Parameters:
      arena - The arena in which the players aren in
    • hideAll

      public void hideAll()
      Similar to hide(Player), but does that for all active players
    • display

      public final boolean display(Player player, Arena arena, ScoreboardType type)
      Displays the scoreboard to the player.

      Use Arena.updateScoreboard() to automatically do that for all players in an arena.

      Parameters:
      player - The target to whom the scoreboard shall be shown to
      arena - The arena in which the player is probably in. Will display the infos from that arena
      type - For what purpose the scorebord is getting displayed
      Returns:
      false if it failed or the scoreboard is disabled for the arena's current state
    • hide

      public final boolean hide(Player player)
      Hides the scoreboard from a player who's seeing it
      Parameters:
      player - The player from whom it shall be hidden
      Returns:
      false if the player is already not seeing it. Otherwise true
    • update

      public final void update(ScoreboardUpdateCause cause, Arena arena, Object data)
      Updates a specific part of the scoreboard
      Parameters:
      cause - What part shall be updated
      arena - The arena involved in the update
      data - Data that comes with it
    • isDefault

      public final boolean isDefault()
      Returns if it's the ScoreboardHandler provided by MBedwars
      Returns:
      true if it's the ScoreboardHandler provided by MBedwars