|
|
MythicHUD features a rich API for enhanced integration and customization.
|
|
|
|
|
|
## GradleKts
|
|
|
# Dependency Information
|
|
|
### GradleKts
|
|
|
```kt
|
|
|
repositories {
|
|
|
maven("https://mvn.lumine.io/repository/maven-releases/")
|
... | ... | @@ -13,7 +14,7 @@ dependencies { |
|
|
}
|
|
|
```
|
|
|
|
|
|
## Maven
|
|
|
### Maven
|
|
|
```html
|
|
|
<dependency>
|
|
|
<groupId>io.lumine.mythichud</groupId>
|
... | ... | @@ -21,4 +22,45 @@ dependencies { |
|
|
<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
|
|
|
```java
|
|
|
MythicHUD.getInstance().holders().getPlayer(Player)
|
|
|
HudHolder.get(Player);
|
|
|
```
|
|
|
|
|
|
The HudHolder is primarily for modifying the HudLayouts for a Player.
|
|
|
```java
|
|
|
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()) {
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |