Class DynamicTitle.InteractionDynamicTitle
java.lang.Object
io.rhythmknights.coreapi.component.module.DynamicTitle.InteractionDynamicTitle
- All Implemented Interfaces:
DynamicTitle
- Enclosing interface:
DynamicTitle
Implementation for updating titles based on item interactions
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.rhythmknights.coreapi.component.module.DynamicTitle
DynamicTitle.DynamicTitleImpl, DynamicTitle.InteractionDynamicTitle, DynamicTitle.InteractionState, DynamicTitle.PaginatedDynamicTitle, DynamicTitle.PaginationState -
Constructor Summary
ConstructorsConstructorDescriptionInteractionDynamicTitle(@NotNull String baseTitle) Creates a dynamic title that updates on item interactionsInteractionDynamicTitle(@NotNull Function<DynamicTitle.InteractionState, net.kyori.adventure.text.Component> titleFunction, @NotNull String baseTitle) Creates a dynamic title with custom formatting -
Method Summary
Modifier and TypeMethodDescriptionGet the base title@NotNull net.kyori.adventure.text.ComponentGet the current dynamic title based on modal state@NotNull net.kyori.adventure.text.ComponentUpdate the dynamic title with a new state object@NotNull net.kyori.adventure.text.ComponentupdateOnClick(@Nullable ModalItem item, int slot, @Nullable org.bukkit.event.inventory.ClickType clickType, @Nullable org.bukkit.event.inventory.InventoryAction action) Update on item click
-
Constructor Details
-
InteractionDynamicTitle
Creates a dynamic title that updates on item interactions- Parameters:
baseTitle- Base title text
-
InteractionDynamicTitle
public InteractionDynamicTitle(@NotNull @NotNull Function<DynamicTitle.InteractionState, net.kyori.adventure.text.Component> titleFunction, @NotNull @NotNull String baseTitle) Creates a dynamic title with custom formatting- Parameters:
titleFunction- Function to create title from interaction statebaseTitle- Base title text
-
-
Method Details
-
getDynamicTitle
@NotNull public @NotNull net.kyori.adventure.text.Component getDynamicTitle()Description copied from interface:DynamicTitleGet the current dynamic title based on modal state- Specified by:
getDynamicTitlein interfaceDynamicTitle- Returns:
- Current component title
-
update
Description copied from interface:DynamicTitleUpdate the dynamic title with a new state object- Specified by:
updatein interfaceDynamicTitle- Parameters:
state- Object containing state information for the update- Returns:
- Updated component title
-
updateOnClick
@NotNull public @NotNull net.kyori.adventure.text.Component updateOnClick(@Nullable @Nullable ModalItem item, int slot, @Nullable @Nullable org.bukkit.event.inventory.ClickType clickType, @Nullable @Nullable org.bukkit.event.inventory.InventoryAction action) Update on item click- Parameters:
item- The clicked itemslot- The slot that was clickedclickType- The type of clickaction- The inventory action- Returns:
- Updated component title
-
getBaseTitle
Get the base title- Returns:
- Base title text
-