Package io.github.nacvark.hudengine.api
Interface HudValues
public interface HudValues
Where a plugin publishes values for HUD patterns.
A key registered here is what goes between brackets in a config, so registering
"myplugin:mana" makes [myplugin:mana] draw. Prefix keys with your plugin's name:
the namespace is flat and two plugins claiming mana would silently fight over it.
A provider runs once per HUD tick per player, on that player's own thread. Keep it to a lookup. If a value is expensive, compute it on your own schedule and have the provider return the cached result — a slow provider shows up directly as server tick time.
Returning null is treated as an empty string, so a value that does not apply to a player does not need a special case.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisRegistered(String key) Whether anything is registered under this key.Publishes a value.voidunregister(String key) Withdraws a value.
-
Method Details
-
register
Function<org.bukkit.entity.Player,String> register(String key, Function<org.bukkit.entity.Player, String> provider) Publishes a value.- Returns:
- the provider this replaced, or null if the key was free. A non-null return means another plugin already owned that key and you have just taken it from them.
-
unregister
Withdraws a value. Patterns using it fall back to whatever else resolves the key. -
isRegistered
Whether anything is registered under this key.
-