Interface PlayerHuds


public interface PlayerHuds
One player's view of the HUD.

There are two independent switches. setVisible(boolean) is the master one and hides everything; show(String) and hide(String) pick which HUDs are in the player's set. A player whose master switch is off sees nothing regardless of their set.

Both survive a reconnect. A player who turned their HUD off does not expect it back the moment they log in again.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    hide(String hudKey)
    Removes a HUD from this player's set.
    boolean
    Whether the player is currently being shown a HUD at all.
    void
    Recomputes and sends now instead of waiting for the next tick.
    void
    Returns the player to the configured default set.
    void
    setVisible(boolean visible)
    The master switch.
    boolean
    show(String hudKey)
    Adds a HUD to this player's set, including one outside the configured defaults.
    boolean
    showFor(String hudKey, int ticks)
    Shows a HUD for a fixed number of ticks, then hides it again.
    boolean
    Flips the master switch.
    This player's HUDs, in compile order.
  • Method Details

    • isVisible

      boolean isVisible()
      Whether the player is currently being shown a HUD at all.
    • setVisible

      void setVisible(boolean visible)
      The master switch.
    • toggle

      boolean toggle()
      Flips the master switch.
      Returns:
      true if the HUD is now shown
    • show

      boolean show(String hudKey)
      Adds a HUD to this player's set, including one outside the configured defaults.
      Returns:
      false if no such HUD was compiled
    • hide

      boolean hide(String hudKey)
      Removes a HUD from this player's set.
      Returns:
      false if no such HUD was compiled
    • showFor

      boolean showFor(String hudKey, int ticks)
      Shows a HUD for a fixed number of ticks, then hides it again. Calling this again before the timer expires extends it rather than stacking.

      For something whose duration is not known up front, such as a dialogue, use show(java.lang.String) and hide(java.lang.String) directly.

      Returns:
      false if no such HUD was compiled
    • reset

      void reset()
      Returns the player to the configured default set.
    • visible

      List<String> visible()
      This player's HUDs, in compile order. Empty when the master switch is off.
    • refresh

      void refresh()
      Recomputes and sends now instead of waiting for the next tick.