Developer API

Public API for integrating mineHud with external plugins.

Overview

mineHud exposes a small public API (HudApi) for toggling player HUDs and reloading configuration. The API is registered with the Bukkit Services Manager at plugin enable.

Accessing the API

import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import pl.minecodes.hud.api.HudApi;

RegisteredServiceProvider<HudApi> registration =
    Bukkit.getServicesManager().getRegistration(HudApi.class);

if (registration != null) {
    HudApi hudApi = registration.getProvider();
}

Maven Dependency

<dependency>
    <groupId>pl.minecodes.hud</groupId>
    <artifactId>plugin-api</artifactId>
    <version>1.0.0</version>
    <scope>provided</scope>
</dependency>

Repository (mineCodes):

<repository>
    <id>minecodes-releases</id>
    <url>https://maven.minecodes.pl/releases/</url>
</repository>

HudApi

public interface HudApi {

    boolean isHudEnabled(Player player);

    boolean isHudEnabled(UUID playerId);

    void setHudEnabled(Player player, boolean enabled);

    void toggleHud(Player player);

    boolean reload();

    SoftReloadResult softReload();
}
MethodDescription
isHudEnabled(Player)Whether the player currently has the HUD enabled
isHudEnabled(UUID)Same for an online player UUID (false if offline)
setHudEnabled(Player, boolean)Enable or disable the HUD for a player
toggleHud(Player)Flip the player’s HUD visibility
reload()Full config reload; regenerates the pack when the signature changes. Returns whether the previous pack was preserved
softReload()Soft reload without pack regeneration

SoftReloadResult

public enum SoftReloadResult {
    OK,
    PACK_CHANGE_REQUIRED,
    NO_BASELINE
}
ValueMeaning
OKConfig applied without regenerating the resource pack
PACK_CHANGE_REQUIREDChanges require a full reload()
NO_BASELINENo pack signature available yet β€” call reload() first

Examples

Disable HUD during a cinematic

HudApi hudApi = Bukkit.getServicesManager().load(HudApi.class);
if (hudApi != null) {
    hudApi.setHudEnabled(player, false);
}

Soft reload after external config edit

HudApi hudApi = Bukkit.getServicesManager().load(HudApi.class);
if (hudApi == null) {
    return;
}

SoftReloadResult result = hudApi.softReload();
switch (result) {
    case OK -> { /* applied */ }
    case PACK_CHANGE_REQUIRED, NO_BASELINE -> hudApi.reload();
}

Check if HUD is on

HudApi hudApi = Bukkit.getServicesManager().load(HudApi.class);
boolean enabled = hudApi != null && hudApi.isHudEnabled(player);

paper-plugin.yml / plugin.yml

Soft-depend on mineHud if integration is optional:

# paper-plugin.yml
dependencies:
  server:
    mineHud:
      load: BEFORE
      required: false
# classic plugin.yml
softdepend: [mineHud]

Or hard-depend if the API is required:

depend: [mineHud]

Notes

  • The API module artifact is plugin-api; the runtime plugin is the shadowed plugin-core jar (mineHud-…jar)
  • isHudEnabled(UUID) only resolves online players
  • Full reload may trigger resource pack re-send for online players when assets change
  • There is no event bus in the public API β€” use Bukkit Services + the methods above