NovaFFA

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();
MethodReturns
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
});
EventFiresEffect of disallowing / cancelling / hiding
FFAEnterEventOnce a player has landed in an arena and been handed their kitNothing, informational only
FFALeaveEventBefore a player is moved out of an arenaCancelling keeps them where they are
FFACombatTagEventJust before a player is put in combat, on every hitDisallowing leaves them free to walk away
FFABlockedCommandEventWhen a blocked command is caughtAllowing lets the command through, blocked unless a listener says otherwise
KitEditorListEventFor each kit as the layout editor list is builtHiding leaves that kit off the list for that player
FFAKillRewardEventBefore a kill pays out, see belowCancelling stops the reward, the kill still counts

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.

Kill rewards

FFAKillRewardEvent carries everything a kill is about to pay, and all of it can be changed before it runs. player() and killer() are the killer, beside victim(), arena(), kit() (the kit the killer was using, can be null), streak() counting this kill, and combatLog(), true when the kill came from the victim logging out mid fight.

api.listeners().register(FFAKillRewardEvent.class, event -> {
    // Double the money on a weekend
    event.money(event.money() * 2);

    // Add a line of your own, run as the console
    event.commands().add("say " + event.killer().getName() + " is on " + event.streak());
});

commands() and victimCommands() are the lines about to run, streak lines included, and money() is what is about to be paid through Vault. It only fires when there is something to pay. See Kit Prices and Rewards.

Coverage

Arena regeneration, kit creation and menu clicks are not currently events, only the paths above fire one.

On this page