NovaFFA

Kit Prices and Rewards

Sell kits through Vault, and pay players for kills with money, commands and streak rewards

NovaFFA keeps no currency of its own. Prices and money rewards go through Vault to whatever economy plugin the server already runs, EssentialsX, CMI or any other. If that plugin calls its money coins, NovaFFA's menus and messages say coins too.

Kill rewards that run commands need no economy at all, they work on every server.

Kit prices

Any kit can have a price. A kit with a price is locked until the player buys it, and then it is theirs for good. Prices work in link mode and in one arena mode alike. In link mode a locked kit means its arena is locked behind it.

Install Vault and an economy plugin

Drop in Vault and an economy plugin and restart. Without them, prices are saved but never charged, and every kit stays free.

Give a kit a price

/ffa kit edit axe price 1000

0 makes it free again. /ffa kit info axe shows the price.

Let players buy it

That is all. In the fight menu a kit the player has not bought is drawn from locked_kit_button, which shows the price and their balance. Clicking it, or joining it any other way, opens the confirm screen. Nothing is taken until they click confirm, and once they have bought it they go straight into the fight.

/ffa buy <kit> opens the same confirm screen from chat.

Handing kits over without payment

HowWhat it is for
/ffa kit grant <kit> <player>Gives the kit for good, as if bought. Works for an offline player who has joined before, so a store delivery can run it from the console
/ffa kit revoke <kit> <player>Takes a bought or granted kit away again
novaffa.kit.<kit>Unlocks a kit for as long as the player holds the permission, for ranks. It only counts when your permissions plugin actually sets it, so an operator does not get every kit for free

Bought and granted kits are kept in the player's own file, players/<uuid>.yml, under kits.owned.

The menus

The fight menu has a locked_kit_button section beside kit_button. It is used for any kit with a price the player has not bought. {price}, {balance}, {missing} and {currency} work in it, along with everything kit_button takes.

The confirm screen is menus/kit_buy.yml, with a kit item, a confirm_button and a cancel_button. join_after_buying decides whether buying sends the player straight in, and cancel_button.back_to_fight_menu whether cancelling goes back to the fight menu. One arena mode reads its own copy from menus/one_arena/kit_buy.yml.

Turning prices off

economy.enabled: false in config.yml makes every kit free without touching any prices, so they are all still there when you turn it back on.

Kill rewards

Everything about what a kill pays lives in two places in config.yml. A kill always counts towards statistics, these only decide what it pays.

Money

economy:
  enabled: true
  # Money paid to the killer on every kill through Vault. 0 pays nothing
  kill_reward: 10

The killer is told above the hotbar, with the economy plugin's own formatting.

Commands

on_kill:
  rewards:
    enabled: true
    # Run for the killer on every kill
    commands:
      - 'crate key give {killer} vote 1'
      - 'player: me just took out {victim}'
    # Run only when the killer's streak lands exactly on that number
    streaks:
      5:
        - 'broadcast {killer} is on a 5 kill streak'
      10:
        - 'eco give {killer} 100'
    # Run for the victim, for a death penalty
    victim_commands: []

A reward line runs as the console unless it starts with player:. That is the opposite of menu items, where a line runs as the player unless it starts with console:. Nearly every reward command, eco give, lp, crate keys, only works from the console, which is why the default is turned around here. In victim_commands, player: runs the line as the victim.

PlaceholderFilled with
{killer}The killer's name
{victim}The victim's name
{arena}The arena the kill happened in
{kit}The kit the killer was using
{streak}The killer's streak, counting this kill

Any PlaceholderAPI placeholder works too, filled in for the killer on a killer line and for the victim on a victim line.

Stopping reward farming

Money for kills gets farmed with a friend or a second account. Both of these stop the reward, money and commands alike, and never the kill itself:

KeyWhat it does
on_kill.rewards.same_victim_cooldownSeconds before killing the same player pays again. 0 turns it off
on_kill.rewards.same_ipPays nothing when the killer and the victim are on the same IP address. Leave it off behind a BungeeCord or Velocity proxy that does not forward player addresses, where every player looks like the proxy and nobody would ever be paid
on_kill.rewards.on_combat_logWhether a kill credited because the victim logged out mid fight pays out. Turn it off so players cannot trade rewards by logging out

Reference

Commands

CommandWhoWhat it does
/ffa buy <kit>playersOpens the confirm screen for a kit with a price
/ffa kit edit <kit> price <amount>adminSets what the kit costs. 0 makes it free
/ffa kit grant <kit> <player>admin, consoleUnlocks the kit for a player without payment
/ffa kit revoke <kit> <player>admin, consoleTakes the kit away again

Placeholders

PlaceholderReturns
%ffa_owns_<kit>%true when the player can use that kit, bought, granted, by permission or because it is free
%ffa_price_<kit>%What the kit costs, in the economy plugin's format
%ffa_kits_owned%How many priced kits the player has unlocked

Messages

Under economy in the language file: bought, not_enough, unavailable, failed, free, already_owned, buy_usage and kill_reward. Under kit: price_updated, price_cleared, price_no_economy, granted, revoked, grant_already and revoke_missing.

API

FFAKillRewardEvent fires before a kill pays out. Its command lists and its money can be changed, and cancelling it stops the reward without touching the kill. See Developer API.

On this page