Package io.github.nacvark.hudengine.api
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 TypeMethodDescriptionbooleanRemoves a HUD from this player's set.booleanWhether the player is currently being shown a HUD at all.voidrefresh()Recomputes and sends now instead of waiting for the next tick.voidreset()Returns the player to the configured default set.voidsetVisible(boolean visible) The master switch.booleanAdds a HUD to this player's set, including one outside the configured defaults.booleanShows a HUD for a fixed number of ticks, then hides it again.booleantoggle()Flips the master switch.visible()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
Adds a HUD to this player's set, including one outside the configured defaults.- Returns:
- false if no such HUD was compiled
-
hide
Removes a HUD from this player's set.- Returns:
- false if no such HUD was compiled
-
showFor
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)andhide(java.lang.String)directly.- Returns:
- false if no such HUD was compiled
-
reset
void reset()Returns the player to the configured default set. -
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.
-