Class ScoreboardState

java.lang.Object
wbs.utils.util.entities.state.tracker.ScoreboardState
All Implemented Interfaces:
EntityState<org.bukkit.entity.Player>

public class ScoreboardState extends Object implements EntityState<org.bukkit.entity.Player>
An EntityState that captures which Scoreboard a Player is currently viewing.
See Also:
  • Player.getScoreboard()
  • Constructor Details

    • ScoreboardState

      public ScoreboardState()
      Creates the state with no scoreboard configured.
    • ScoreboardState

      public ScoreboardState(@Nullable @Nullable org.bukkit.scoreboard.Scoreboard scoreboard)
      Parameters:
      scoreboard - The scoreboard shown to the player.
  • Method Details

    • captureState

      public void captureState(org.bukkit.entity.Player target)
      Description copied from interface: EntityState
      Capture the state of an instance of EntityState according to the implementation, and store it until EntityState.restoreState(T) is called.
      Specified by:
      captureState in interface EntityState<org.bukkit.entity.Player>
      Parameters:
      target - The EntityState from which to capture.
    • restoreState

      public void restoreState(org.bukkit.entity.Player target)
      Description copied from interface: EntityState
      Restore the state of an instance of EntityState according to the implementation.
      Specified by:
      restoreState in interface EntityState<org.bukkit.entity.Player>
      Parameters:
      target - The EntityState for which to the stored state.
    • getScoreboard

      @Nullable public @Nullable org.bukkit.scoreboard.Scoreboard getScoreboard()
      Returns:
      The scoreboard shown to the player.
    • setScoreboard

      public void setScoreboard(@Nullable @Nullable org.bukkit.scoreboard.Scoreboard scoreboard)
      Parameters:
      scoreboard - The scoreboard shown to the player.
    • restoreAfter

      @NotNull public @NotNull Set<Class<? extends EntityState<?>>> restoreAfter()
      Description copied from interface: EntityState
      Used to build a graph of captured states, allowing states to be restored in the appropriate order, such as restoring AllowFlightState after GameModeState, to prevent a change to GameMode.SURVIVAL from overriding the Player.getAllowFlight() state.
      Specified by:
      restoreAfter in interface EntityState<org.bukkit.entity.Player>
      Returns:
      A set of classes to restore after, if present in a given SavedEntityState.