Class InteractiveUI
java.lang.Object
fr.hytale.loader.api.ui.InteractiveUI
Simplified interactive UI wrapper that handles codec complexity
automatically.
This class provides a simple API for creating interactive UIs with buttons, without needing to understand Hytale's codec system.
Example Usage:
InteractiveUI ui = new InteractiveUI("Pages/MyMenu.ui");
ui.onButtonClick("saveButton", (player, data) -> {
player.sendMessage("Save button clicked!");
});
player.openInteractiveUI(ui);
- Since:
- 1.0.5
- Version:
- 1.0.6
- Author:
- HytaleLoader
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSimple event data structure.static enumUI lifetime options. -
Constructor Summary
ConstructorsConstructorDescriptionInteractiveUI(String uiFilePath) Creates a new interactive UI with CAN_DISMISS lifetime.InteractiveUI(String uiFilePath, InteractiveUI.UILifetime lifetime) Creates a new interactive UI. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage<InteractiveUI.SimpleEventData> createNativePage(com.hypixel.hytale.server.core.universe.PlayerRef playerRef, Player player) Creates the native interactive UI page.Gets the UI lifetime.Gets the UI file path.onButtonClick(String buttonId, BiConsumer<Player, InteractiveUI.SimpleEventData> handler) Registers a button click handler.
-
Constructor Details
-
InteractiveUI
Creates a new interactive UI.- Parameters:
uiFilePath- Path to the UI file (e.g., "Pages/MyUI.ui")lifetime- UI lifetime behavior
-
InteractiveUI
Creates a new interactive UI with CAN_DISMISS lifetime.- Parameters:
uiFilePath- Path to the UI file
-
-
Method Details
-
onButtonClick
public InteractiveUI onButtonClick(@Nonnull String buttonId, @Nonnull BiConsumer<Player, InteractiveUI.SimpleEventData> handler) Registers a button click handler.- Parameters:
buttonId- The button ID from the UI file (e.g., "saveButton" for "#SaveButton")handler- Consumer that receives (Player, eventData)- Returns:
- This InteractiveUI for chaining
-
getUiFilePath
-
getLifetime
-
createNativePage
public com.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage<InteractiveUI.SimpleEventData> createNativePage(@Nonnull com.hypixel.hytale.server.core.universe.PlayerRef playerRef, @Nonnull Player player) Creates the native interactive UI page.- Parameters:
playerRef- The player referenceplayer- The player wrapper- Returns:
- The native interactive UI page
-