- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getCustomHud(String)
- getCustomHuds()
- getVisibleHudComponents()
- setVisibleHudComponents(PlayerRef, HudComponent...)
- setVisibleHudComponents(PlayerRef, Set)
- showHudComponents(PlayerRef, HudComponent...)
- showHudComponents(PlayerRef, Set)
- hideHudComponents(PlayerRef, HudComponent...)
- addCustomHud(PlayerRef, CustomUIHud)
- removeCustomHud(PlayerRef, String)
- dev_registerWidget(PlayerRef, UIHudWidget)
- dev_unregisterWidget(PlayerRef, String)
- dev_unregisterWidget(PlayerRef, UIHudWidget)
- dev_setWidgetVisible(PlayerRef, String, boolean)
- dev_setWidgetVisible(PlayerRef, UIHudWidget, boolean)
- dev_handleWidgetCommand(PlayerRef, Ref, Store, ExecuteServersideHudCommand)
- dev_isWidgetVisible(String)
- getWidgets()
- resetVisibleHudComponents(PlayerRef)
- resetHud(PlayerRef)
- resetUserInterface(PlayerRef)
- sendVisibleHudComponents(PacketHandler)
- toString()
Class HudManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCustomHud(PlayerRef ref, CustomUIHud hud) Adds or replaces a custom HUD layer.voiddev_handleWidgetCommand(PlayerRef playerRef, Ref<EntityStore> ref, Store<EntityStore> store, ExecuteServersideHudCommand packet) Routes an incoming execute-command packet from the client to the matching widget.booleanPart of an upcoming feature that is still in development and not yet ready for production use.voiddev_registerWidget(PlayerRef playerRef, UIHudWidget widget) Registers a serverside HUD widget.voiddev_setWidgetVisible(PlayerRef playerRef, UIHudWidget widget, boolean visible) Shows or hides the HUD widget with the given ID.voiddev_setWidgetVisible(PlayerRef playerRef, String id, boolean visible) Shows or hides the HUD widget with the given ID.voiddev_unregisterWidget(PlayerRef ref, UIHudWidget widget) Unregisters the HUD widget with the given ID.voiddev_unregisterWidget(PlayerRef ref, String id) Unregisters the HUD widget with the given ID.getCustomHud(String key) voidhideHudComponents(PlayerRef ref, HudComponent... hudComponents) voidremoveCustomHud(PlayerRef ref, String key) Removes a custom HUD layer by key.voidvoidvoidRestores the default visible HUD component set, leaving custom HUD layers untouched.voidsendVisibleHudComponents(PacketHandler packetHandler) voidsetVisibleHudComponents(PlayerRef ref, HudComponent... hudComponents) voidsetVisibleHudComponents(PlayerRef ref, Set<HudComponent> hudComponents) voidshowHudComponents(PlayerRef ref, HudComponent... hudComponents) voidshowHudComponents(PlayerRef ref, Set<HudComponent> hudComponents) toString()
-
Constructor Details
-
HudManager
public HudManager()
-
-
Method Details
-
getCustomHud
- Returns:
- the custom HUD registered under the given key, or null if none
-
getCustomHuds
- Returns:
- an unmodifiable view of all registered custom HUDs, keyed by their identifier
-
getVisibleHudComponents
-
setVisibleHudComponents
-
setVisibleHudComponents
public void setVisibleHudComponents(@Nonnull PlayerRef ref, @Nonnull Set<HudComponent> hudComponents) -
showHudComponents
-
showHudComponents
-
hideHudComponents
-
addCustomHud
Adds or replaces a custom HUD layer. The HUD is keyed byCustomUIHud.getKey(). If a HUD already exists at this key, it is removed first (sending a clear packet to the client).- Parameters:
ref- The player referencehud- The custom HUD to add
-
removeCustomHud
-
dev_registerWidget
Registers a serverside HUD widget. If a widget with the same ID is already active, the new widget won't be registered and a warning will be logged.Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.
- Parameters:
playerRef- The owning player reference.widget- The widget to register.
-
dev_unregisterWidget
Unregisters the HUD widget with the given ID. No-op if the widget is not registered. If you want to hide the widget instead, use setWidgetVisible() instead.Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.
- Parameters:
ref- The player reference used to send packets.id- The widget ID to remove.
-
dev_unregisterWidget
Unregisters the HUD widget with the given ID. No-op if the widget is not registered. If you want to hide the widget instead, use setWidgetVisible() instead.Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.
- Parameters:
ref- The player reference used to send packets.widget- The widget to remove.
-
dev_setWidgetVisible
Shows or hides the HUD widget with the given ID. No-op if not registered or already in the requested state.Calls
UISurface.onShow(Ref, Store)/UISurface.onHide(Ref, Store)at the correct point in the lifecycle: commands emitted by the callback are batched with the visibility packet.Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.
- Parameters:
playerRef- The player reference used to send packets.id- The widget ID.visible-trueto show,falseto hide.
-
dev_setWidgetVisible
public void dev_setWidgetVisible(@Nonnull PlayerRef playerRef, @Nonnull UIHudWidget widget, boolean visible) Shows or hides the HUD widget with the given ID. No-op if not registered or already in the requested state.Calls
UISurface.onShow(Ref, Store)/UISurface.onHide(Ref, Store)at the correct point in the lifecycle: commands emitted by the callback are batched with the visibility packet.Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.
- Parameters:
playerRef- The player reference used to send packets.widget- The widget to show or hide.visible-trueto show,falseto hide.
-
dev_handleWidgetCommand
public void dev_handleWidgetCommand(@Nonnull PlayerRef playerRef, @Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store, @Nonnull ExecuteServersideHudCommand packet) Routes an incoming execute-command packet from the client to the matching widget. Dispatch requires only that the widget is registered. A hidden widget still receives commands, so do not treat hide as access control. Enforce that in the command handler if the action must stay unavailable while the widget is hidden.Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.
- Parameters:
playerRef- The player that owns the widget.ref- The entity reference of the player entity.store- The entity store for component access.packet- The packet received from the client.
-
dev_isWidgetVisible
Part of an upcoming feature that is still in development and not yet ready for production use. Do not use. The API is not final and may change.- Returns:
trueif the serverside widget with the given ID is currently visible.
-
getWidgets
- Returns:
- an unmodifiable view of all registered serverside HUD widgets, keyed by their ID.
-
resetVisibleHudComponents
Restores the default visible HUD component set, leaving custom HUD layers untouched. -
resetHud
-
resetUserInterface
-
sendVisibleHudComponents
-
toString
-