MythicHUD features a rich API for enhanced integration and customization.
Dependency Information
GradleKts
repositories {
maven("https://mvn.lumine.io/repository/maven-releases/")
# For Snapshots
#maven("https://mvn.lumine.io/repository/maven-snapshots/")
}
dependencies {
compileOnly("io.limine.mythichud:api:$VERSION")
}
Maven
<dependency>
<groupId>io.lumine.mythichud</groupId>
<artifactId>api</artifactId>
<version>$VERSION</version>
<scope>provided</scope>
</dependency>
Events
MythicHUD contains a few events you can listen for.
HUDLayoutAddEvent
Fires whenever a layout is added to be shown to a player. Can be cancelled to make it not show to a player.
HUDLayoutRemoveEvent
Fires whenever a layout is removed from a player. Can be cancelled to make it still show to a player.
PlayerUpdateAttributeEvent
Fires whenever a player's attributes change
PlayerUpdateExperienceEvent
Fires whenever a player's experience points change
PlayerUpdateConsumableEvent
Fires whenever a player's health changes
HudHolder
A HudHolder is a class wrapped around a Player that handles updating, adding and removing various HudElements, amongst other things. You can get the HudHolder of a player by
MythicHUD.getInstance().holders().getPlayer(Player)
HudHolder.get(Player);
The HudHolder is primarily for modifying the HudLayouts for a Player.
public static void test(Player player) {
HudHolder holder = MythicHUD.getInstance().holders().getPlayer(player);
if (holder == null) return;
holder.addLayout(hudLayout);
holder.removeLayout(hudLayout);
Optional<ActiveLayout> activeLayout = holder.getActiveLayout("hudlayout");
if (activeLayout.isPresent()) {
}