Skip to main content

Rewards

Rewards turn a leaderboard into a competition. When a day, week, month or year ends, the plugin looks at the final ranking of that period and gives the top players whatever you set up: money, items, a rank, crate keys, a title. Players who are offline get theirs when they come back.

Rewards are commands, run from the console. Anything your server can do with a console command can be a reward, so it works with your economy, permissions, crates and cosmetics plugins without any extra setup.

Setting up a reward in the menu​

  1. /lb admin → Leaderboards → pick a leaderboard → Rewards.

  2. You see one chest per calendar period (daily, weekly, monthly...). The lore says when it pays out next and how many ranks have rewards. Click the period.

  3. Click Add Ranks and type a rank in chat: 1 for the winner, or a range such as 2-3 or 4-10.

  4. Type the command, without the /:

    eco give %player% 10000

    (Leave out the / on purpose: in chat, a line starting with / would run as your own command instead.)

  5. The screen opens again with a block for that rank: gold for #1, iron for the others. Its lore lists the commands.

To give a rank more than one command (money and a crate key), left click its block and type the next command. Right click removes the last command, shift right click removes the whole rank.

The How Rewards Work book on the same screen lists the placeholders, so you do not need this page open while you set it up.

What you can use in a command​

PlaceholderBecomesExample
%player%The winner's nameSteve
%uuid%The winner's UUID, for plugins that want one069a79f4-...
%rank%Their rank in the period1
%value%What they gained, in the leaderboard's number format75K
%period%The period's nameThis Week
%placeholder%The leaderboard's placeholdervault_eco_balance
%name%The leaderboard's display name, as written in display-namesRichest

Ideas to copy: Reward ideas.

The same thing in config.yml​

The menu writes to the rewards section of config.yml. You can also write it yourself; it applies as soon as you save the file:

rewards:
vault_eco_balance: # the leaderboard
weekly: # a calendar period
"1": # a rank
- "eco give %player% 10000"
- "crate key give %player% legendary 1" # your crate plugin's command
"2-3": # a range of ranks
- "eco give %player% 5000"
"4-10":
- "eco give %player% 1000"
monthly:
"1":
- "lp user %player% parent addtemp champion 30d"

Put the rank keys in quotes. A rank range that cannot be read, a period that does not exist, or a rolling period is skipped, and the console says why.

When rewards are paid​

  • The plugin checks every minute. So a weekly reward is paid within a minute after the week ends (Monday 00:00 in the plugin's time zone).
  • The ranking used is the final ranking of the period that just ended, worked out from the score history. It does not matter if the check runs a few seconds late or the server was busy: the result is the same.
  • It follows the leaderboard's ranking order, and players who are kept off the leaderboards never win.
  • Only players who are actually ranked in the period can win. If only two players gained anything this week, rank 3 gets nothing.
  • A score of nothing wins nothing. On a leaderboard that ranks the highest first, a player needs a score above 0 for the period (a stat that was rolled back gives a negative one). On any leaderboard, a score that is written as 0 is skipped too: under a second of play time shows as 0s. Skipped players get no commands, no message and are not announced, and the others keep their ranks.
  • If ranges overlap (1 and 1-3), rank 1 gets the commands of both.

A reward you add now​

A reward is first paid at the end of the period you add it in. If you set up a weekly reward on Wednesday, it is paid next Monday for this week, not for weeks that ended before. This keeps the plugin from suddenly paying out for old weeks the moment you add a reward.

Offline winners​

A winner who is offline when the period ends is not forgotten. Their commands are stored, with the placeholders already filled in, and run a couple of seconds after they next join, followed by a message:

✔ You finished #1 on Richest for This Week (75K). Here is your reward!

The message shows the leaderboard's display name, or its placeholder when it has none.

They get it even if they come back weeks later, and even if you changed the rewards since. A command that needs the player online (such as giving an item) therefore works for them too.

Restarts and downtime​

Every payout is recorded in storage. A restart, a crash or a reload never pays the same week twice. If a week ended while the server was down, it is paid as soon as the server starts again. If several ended (a server down for three weeks), only the last one is paid.

The winner announcement​

When a period's rewards are paid, everyone online sees who won:

        This Week - Richest winners

#1 Alex - 75K
#2 Steve - 20K
#3 Sam - 4.5K

Turn it off or on in /lb admin → Configuration → Announce Winners. The text is reward-broadcast-header and reward-broadcast-entry in messages.yml; the entry uses %winner% for the name. Only players who got a reward are listed.

Checking that it worked​

  • The console logs every payout: Paid the This Week rewards of vault_eco_balance to 3 player(s).
  • A failing command is logged with the player's name and the command.
  • Test a command before the week ends by running it yourself in the console with a real name in place of %player%.
  • Try the whole thing quickly with a daily period: add a reward today, and it is paid at midnight.

Something went wrong? See the table in Run a weekly competition.