Developer API
The entry point, accessors and events another plugin uses to hook into NovaFFA
NovaFFA ships its own small API for another plugin to read state or react to what happens in a fight. Add NovaFFA as a dependency, soft or hard, and call FFAAPI.api().
Entry point
import cc.arrowtan.novaffa.api.FFAAPI;
FFAAPI api = FFAAPI.api();| Method | Returns |
|---|---|
arenas() | Every arena that exists |
arena(String name) | One arena by name, or null |
arenaOf(Player player) | The arena a player is currently in, or null |
kits() | Every kit that exists |
kit(String name) | One kit by name, or null |
data(UUID uuid) | That player's stats, creating a record if none exists yet |
Events
NovaFFA's events are not standard Bukkit events, they do not go through @EventHandler. Register a listener through api.listeners() instead:
api.listeners().register(FFAEnterEvent.class, event -> {
// handle it
});| Event | Fires | Effect of disallowing / cancelling / hiding |
|---|---|---|
FFAEnterEvent | Once a player has landed in an arena and been handed their kit | Nothing, informational only |
FFALeaveEvent | Before a player is moved out of an arena | Cancelling keeps them where they are |
FFACombatTagEvent | Just before a player is put in combat, on every hit | Disallowing leaves them free to walk away |
FFABlockedCommandEvent | When a blocked command is caught | Allowing lets the command through, blocked unless a listener says otherwise |
KitEditorListEvent | For each kit as the layout editor list is built | Hiding leaves that kit off the list for that player |
Every event exposes player() and playerData(). FFAEnterEvent and FFALeaveEvent also expose arena(), kit() and layout(). FFACombatTagEvent exposes attacker(), millis() and refresh(), see Combat Tag.
A listener that throws does not take the rest of the plugin down with it, the exception is caught and logged.
Coverage
Arena regeneration, kit creation and menu clicks are not currently events, only the paths above fire one.