Interface HudEngine


public interface HudEngine
Entry point for plugins building on HUDEngine.

Obtain it through HudEngineProvider.get(), which resolves it from the services manager, and hold onto the interface rather than the implementation:


 HudEngine hud = HudEngineProvider.get();
 hud.values().register("myplugin:mana", player -> String.valueOf(mana.of(player)));
 hud.player(player).show("quest_tracker");
 

Everything here runs on the calling thread and does no I/O, so it is safe to call from an event handler. The exception is reload(), which recompiles the whole pack.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    The outcome of a reload.
  • Method Summary

    Modifier and Type
    Method
    Description
    Where a plugin publishes points for compasses to point at.
    boolean
    hasHud(String hudKey)
    Whether a HUD with this key was compiled.
    Every compiled HUD, in the order the configuration defined them.
    boolean
    Whether the engine compiled successfully and is currently rendering.
    Pixel measurement against a HUD's real fonts.
    player(org.bukkit.entity.Player player)
    What one player currently sees, and how to change it.
    Recompiles the configuration and swaps the model in.
    Where a plugin publishes values for HUD patterns to draw.
  • Method Details

    • huds

      List<String> huds()
      Every compiled HUD, in the order the configuration defined them.
    • hasHud

      boolean hasHud(String hudKey)
      Whether a HUD with this key was compiled.
    • player

      PlayerHuds player(org.bukkit.entity.Player player)
      What one player currently sees, and how to change it.
    • values

      HudValues values()
      Where a plugin publishes values for HUD patterns to draw.
    • compass

      HudCompass compass()
      Where a plugin publishes points for compasses to point at.
    • metrics

      HudMetrics metrics()
      Pixel measurement against a HUD's real fonts.
    • reload

      Recompiles the configuration and swaps the model in.

      Text and positions change at once. Clients only see new textures, fonts or glyph positions once they receive the pack again, which in practice means a reconnect.

    • isRunning

      boolean isRunning()
      Whether the engine compiled successfully and is currently rendering.