Repository navigation
Dynamic Title Update
Natan Vieira edited this page Aug 14, 2023
·
36 revisions
The Dynamic Title Update feature allows the developer to change the title of the current view being displayed to the player to be changed without requiring an immediate close and reopen of it.
Dynamic Title Update is a Protocol-Level Integration so its behavior is based on the current version and software of the server it is running on and may be inconsistent. See the Versions Compatibility table to know if it will work on your server.
| Server version | Minimum IF version | Status |
|---|---|---|
| 1.8 | v1.0 | ✅ Supported |
| 1.9-1.16 | v2.4.0 | ✅ Supported |
| 1.17–1.18 | v3.0.0 | ✅ Supported |
| 1.19-1.20 | v3.0.0-rc.2 | ✅ Supported |
// Updates the title for all players in the context
public void Context.updateTitleForEveryone(String title);
// Updates the title for the subject player of the context
public void Context.updateTitleForPlayer(String title);
// Updates the title for a specific player in the context
public void Context.updateTitleForPlayer(String title, T player);
// Resets the title to the initial title of the context for all players in the context
public void Context.resetTitleForEveryone();
// Resets the title to the initial title of the context for a specific player
public void Context.resetTitleForPlayer(T player);updateTitleForPlayer and resetTitleForPlayer the "player" is the subject of the context, if it's used in a click context the title will be updated only to the player that clicked on something.
This examples creates a counter state with initial value of 0 and schedules the view to update every 20 ticks (1 second) and on each update increments the counter state by 1.
private final MutableIntState counter = mutableIntState(0);
@Override
public void onInit(ViewConfigBuilder config) {
config.title("Initial title")
.scheduleUpdate(20L);
}
@Override
public void onUpdate(UpdateContext update) {
update.updateTitleForEveryone("Updated title: " + counter.increment(update));
}Welcome to the Inventory Framework documentation.
- Pagination — Display large collections of items across multiple pages.
- Layouts (a.k.a. Masks or Patterns) — Define visual patterns for item placement.
- Scheduled Updates
- Anvil Input — Capture text input from players using an anvil GUI.
- Dynamic Title Update — Update the inventory’s title in real time.
- IntelliJ Tooling Plugin — Live inventory preview and API inspections in the IDE.
You can find practical examples in the examples directory.