Skip to main content

Rewards

rewards.yml defines playtime tiers and the actions that run when a player claims each tier.

Basic structure

playtime:
rewards:
1:
description:
- '<gray>- <white>100 Coins</white></gray>'
required:
playtime: 10m,10s
one-time: true
commands:
- '[ITEM] DIAMOND 1'
- '[CONSOLE] eco give %player_name% 100'
- '[MESSAGE] <green>You claimed Playtime %tier%.</green>'

Tier keys

Tier ids are stored under playtime.rewards.

playtime:
rewards:
1: {}
2: {}
3: {}

The bundled source sorts numeric tier keys in order, so 1 is processed before 2, 2 before 3, and so on.

description

description:
- '<gray>- <white>100 Coins</white></gray>'
- '<gray>- <white>1 Diamond</white></gray>'

Descriptions are rendered into menu lore through the {rewards} placeholder in PlaytimeMenu.yml.

required.playtime

required:
playtime: 1h,30m
one-time: true

Supported duration units:

UnitMeaning
sseconds
mminutes
hhours
ddays
wweeks
momonths, calculated as 30 days
yyears, calculated as 365 days

You can combine units with commas:

required:
playtime: 1d,2h,30m,10s

commands

commands is the reward action list. Actions run when the tier is claimed.

ActionFormatDescription
[ITEM][ITEM] [material] [amount]Gives an item directly to the player. Overflow drops naturally at the player's location.
[CONSOLE][CONSOLE] [command]Runs a command as console.
[PLAYER][PLAYER] [command]Runs a command as the claiming player.
[MESSAGE][MESSAGE] [message]Sends a colored message to the player.
[SOUND][SOUND] [sound] [volume] [pitch]Plays a Bukkit sound at the player location.
[TITLE][TITLE] [text]Sets the title text shown after the reward list finishes.
[SUBTITLE][SUBTITLE] [text]Sets the subtitle text shown with [TITLE].

Reward placeholders

Reward actions support:

PlaceholderValue
%player%Player name.
%player_name%Player name.
%uuid%Player UUID.
%tier%Claimed tier id.

Example tier

playtime:
rewards:
5:
description:
- '<gray>- <white>500 Coins</white></gray>'
- '<gray>- <white>2 Diamonds</white></gray>'
required:
playtime: 50m
one-time: true
commands:
- '[ITEM] DIAMOND 2'
- '[CONSOLE] eco give %player_name% 500'
- '[SOUND] UI_TOAST_CHALLENGE_COMPLETE 1 1'
- '[TITLE] <gold>Playtime %tier%</gold>'
- '[SUBTITLE] <yellow>Reward claimed!</yellow>'
Page note

Claim state is stored per player. A tier that is already in the player's unlocked tier list cannot be claimed again.