DriftRewards
Every reason to log in, behind one menu.
Rewards for Paper and Folia 26.3: a daily login calendar with streaks, playtime rewards that don't count AFK time, voting through NuVotifier with vote streaks, a vote party and top voters, referrals, redeem codes and a claim box for anything that doesn't fit. Part of DriftSuite.
Features
- Rewards menu:
/rewardshas a button for every feature that's turned on, and the claim box. - Daily login calendar:
/dailyshows this month as a calendar. Every day of the month (1 to 31) has its own reward in daily.yml, and players claim today's once a day. Special days can have their own icon. - Streaks: claiming on days in a row builds a streak with bonus rewards, once at a number (
30) or every so many days (every-7). One missed day is forgiven by default (grace-days). - Playtime rewards: repeating rewards (every hour) and one-off milestones (after 10 hours), with optional
permissions. Given automatically or claimed in
/playtimerewards. - AFK time doesn't count: DriftEssentials AFK, EssentialsX AFK, any
afkmetadata, or simply not looking around, chatting, running commands, clicking or building for a few minutes all stop the clock. Being pushed by water or riding something doesn't count as active, so AFK machines earn nothing. Spectator time is left out too unless turned on. - Voting: votes from NuVotifier give the vote reward plus any per-site reward.
/votelists the sites with how long until each can be voted on again and a clickable link./vote linkssends the links in chat. - Vote streaks: voting at least once a day, days in a row, with bonus rewards like daily streaks.
- Offline votes: a vote for a player who isn't online is kept and counted when they join.
- Vote party: every vote adds one; at
votes-neededa countdown starts and everyone online gets the party reward. Players are told as it gets close, and/voteshows the progress. - Top voters:
/vote toplists the top voters this month or of all time. - Referrals: a new player types
/referral <player>within a few hours of first joining. Once they've played long enough (active time), both get a reward, once. - Redeem codes: staff make codes with a number of uses and an optional expiry, and set the rewards in a menu
(the item in hand, money, crate keys, commands, XP, messages). Players use
/redeem <code>, once each. - Claim box: items that don't fit and money that can't be paid wait in the claim box in
/rewards, never on the ground. - Offline rewards: a reward for a player who isn't online (a referrer, say) is given when they next join.
- Staff tools: reset any part of a player's rewards, give a test vote, start or fill the vote party.
Requirements
- Paper or Folia 26.3 (Leaf works), Java 25.
- Optional: NuVotifier (for votes), PlaceholderAPI, Vault (or DriftEconomy) for money rewards, DriftCrates for key rewards, DriftEssentials or EssentialsX for AFK, Nexo / ItemsAdder / Oraxen for custom item rewards.
- Storage is H2 (
data/database.mv.dbin the plugin folder) unless you set MySQL or MariaDB. Use MySQL or MariaDB to share rewards between servers.
DriftEconomy has its own small vote reward (features.vote-rewards, off by default). Leave it off when
DriftRewards handles votes, or players get paid twice.
Getting started
- Put
DriftRewards-<version>.jarinplugins/and start the server. It works without any changes: its files are written toplugins/DriftRewards/and its own data toplugins/DriftRewards/data/(see Folder layout). /dailyopens this month's calendar; change the rewards indaily.yml. Playtime rewards are inplaytime.yml, referrals inreferrals.yml.- For votes, install NuVotifier, set it up with each voting site and put the sites in
votes.yml(check the NuVotifier log after a test vote for each site's service name)./driftrewards givevote <you>tries it out. - Make a code with
/rewardcode create SUMMER 100 7dand set what it gives in the menu that opens.
Commands
| Command | What it does | Permission |
|---|---|---|
/rewards (/reward) | The rewards menu | none |
/daily [claim] (/dailyreward) | This month's calendar, or claim today's reward | none |
/playtimerewards (/ptrewards) | Your playtime rewards | none |
/vote [links|top] (/votes) | Voting sites, links in chat, or top voters | none |
/referral [player] (/refer) | Name who brought you, or see your referrals | none |
/redeem <code> | Use a reward code | none |
/rewardcode create <code> <uses|unlimited> [expiry] | Make a code (expiry like 7d) and open its editor | driftrewards.codes |
/rewardcode edit|info|delete <code>, /rewardcode list | Edit, look at or delete codes | driftrewards.codes |
/driftrewards reload | Reload every file and say how many problems were found | driftrewards.admin |
/driftrewards reset <player> <daily|playtime|votes|referral|codes|all> | Wipe part of a player's rewards | driftrewards.admin |
/driftrewards givevote <player> [site] | Count a vote as if it came from a site | driftrewards.admin |
/driftrewards voteparty [start|add <n>|status] | The vote party | driftrewards.admin |
/driftrewards version | Show the version | driftrewards.admin |
/driftrewards help, /rewardcode help | The staff commands (click one to fill it in) | driftrewards.admin, driftrewards.codes |
/playtime belongs to DriftEssentials, so playtime rewards use /playtimerewards. Every name, alias and
permission can be changed in commands.yml.
Permissions
| Permission | Default | What it allows |
|---|---|---|
driftrewards.admin | op | /driftrewards |
driftrewards.codes | op | /rewardcode |
| any permission you put on a playtime reward | - | that reward (the default playtime.yml uses driftrewards.playtime.vip) |
Rewards
Every reward in daily.yml, playtime.yml, votes.yml and referrals.yml is a list of lines:
rewards:
- "item: DIAMOND 3" # any Minecraft item
- "item: nexo:ruby_sword" # a Nexo, ItemsAdder or Oraxen item
- "money: 500" # money in config.yml economy
- "money: 25 gems" # money in another economy (a DriftEconomy currency)
- "key: vote 1" # a DriftCrates key (crate, amount)
- "xp: 100" # experience points
- "levels: 5" # experience levels
- "command: lp user {player} permission set fly.use"
- "message: <gray>Thanks!"
- "broadcast: <white>{player} <gray>voted!"
- "title: <gold>Day 7!|<gray>Streak bonus"
- "actionbar: <gray>+1 vote"
- "sound: entity.player.levelup:1:1"
A reward can also be a section with rewards: and display: (lines shown in menus instead of the ones made
from the rewards). key: runs crate-key-command from config.yml, which gives DriftCrates keys by default.
Old & and section sign colour codes are turned into MiniMessage automatically.
Turning features on and off
At the top of config.yml (a restart applies them):
| Switch | What it turns on |
|---|---|
daily | The daily calendar and streaks |
playtime | Playtime rewards |
voting | Voting, vote streaks and top voters |
vote-party | The vote party (needs voting) |
referrals | Referrals |
codes | Redeem codes |
placeholders | PlaceholderAPI placeholders |
The claim box is always on, so nothing is ever lost.
Settings
config.yml:
time-zone: where midnight is for daily rewards and vote streaks (empty means the server's own).economy: whatmoney:pays in:vault,xpor a DriftEconomy currency.crate-key-command: the console command akey:reward runs.playtime.idle-minutes: how long without activity counts as AFK (0 leaves it to DriftEssentials/EssentialsX).playtime.count-spectator: count spectator time.codes.wrong-guesses-per-minute: wrong codes allowed a minute before a player has to wait.storage: H2, MySQL or MariaDB, and the table prefix.
daily.yml: grace-days, remind-on-join, open-on-join, default, days (1 to 31, each with rewards,
optional display and icon) and streak-bonuses.
playtime.yml: auto-claim, catch-up, repeating (with every) and milestones (with after), each with
name, icon, optional permission, rewards and display. Playtime is counted from when DriftRewards is
installed.
votes.yml: the reward for every vote, broadcast, remind-on-join, duplicate-seconds, offline
(keep-votes, keep-days), sites (each with the service name NuVotifier sends, name, url,
cooldown, icon and optional rewards), streak-bonuses, party (votes-needed, announce-at,
countdown-seconds, countdown-announce, include-spectators, rewards) and top.size.
referrals.yml: window-hours, required-playtime, block-same-ip, max-per-player, tell-new-players,
new-player-rewards and referrer-rewards.
Can't be exploited
- Daily rewards: claiming inserts (player, day) under a primary key in the same transaction that moves the streak, so a day can only be claimed once however fast or often it's clicked, on any number of servers.
- Playtime rewards: how many times each reward was given is moved forward with a conditional UPDATE
(
WHERE times = <what it was>), or a primary-key insert the first time, so each one is given once. - Votes: a vote is saved (log, totals, party counter) in one transaction before its reward is given. A kept
offline vote is deleted before it's counted, so only one server counts it. Repeats from the same site within
duplicate-secondsare ignored. - Vote party: started with one conditional UPDATE (
SET votes = votes - needed WHERE votes >= needed), so each party starts once. - Referrals: the referred player is the primary key (referred once), never yourself, never someone you referred, never a newer player, not from the same address (kept only as a hash), and paying out is a conditional UPDATE from "not rewarded" to "rewarded".
- Codes: one transaction: a primary-key insert of (code, player), then
UPDATE ... SET used = used + 1 WHERE max_uses = 0 OR used < max_uses. If either fails nothing is saved. Wrong guesses are limited per minute. - Claim box and offline rewards: the row is deleted before the item or money is handed over; anything that can't be handed over goes back in. Items only come out when the whole stack fits.
- One action per player at a time: a second click while the first is still saving is ignored.
- Menus are locked: nothing can be taken out of or put into any menu. The code editor copies the item in your hand and never takes it.
- Leaving mid-claim loses nothing: a reward that's already been saved as claimed is kept for the player's next join if they leave before it's given.
PlaceholderAPI
| Placeholder | Value |
|---|---|
%driftrewards_daily_streak%, _daily_best%, _daily_total%, _daily_claimed% | Daily streak, best, days claimed, claimed today (true/false) |
%driftrewards_playtime%, _playtime_hours%, _playtime_seconds% | Active playtime |
%driftrewards_votes%, _votes_month%, _vote_streak%, _vote_best%, _voted_today% | Votes |
%driftrewards_voteparty_votes%, _voteparty_needed%, _voteparty_left% | Vote party progress |
%driftrewards_referrals%, _referred_by% | Referrals |
%driftrewards_claims% | Rewards waiting in the claim box |
%driftrewards_top_voter_<n>%, _top_voter_<n>_votes% | Top voters this month |
%driftrewards_top_voter_all_<n>%, _top_voter_all_<n>_votes% | Top voters of all time |
Configuration files
| File | What's in it |
|---|---|
config.yml | Feature switches, the time zone, AFK, codes, money, crate keys and storage (and the list of reward line types) |
daily.yml | The daily calendar, streak settings and streak bonuses |
playtime.yml | Repeating playtime rewards and one-time milestones |
votes.yml | Voting sites, vote rewards, offline votes, vote streaks, the vote party and top voters |
referrals.yml | Referral rules and rewards |
commands.yml | Names, aliases, permissions and on/off for each command |
messages.yml | Every message (MiniMessage), the prefix and prefix-enabled |
menus.yml | Every menu's title, size, slots and items |
Redeem codes live in the database, not in a file.
Every file starts with a boxed header saying how to apply changes, is split into sections, and has a note above
every option saying what it does, its unit and the values it takes. The prefix is DRIFTREWARDS in bold solid
fuchsia (#d946ef), followed by a dark grey ».
When you update, new options are added with their notes and everything you changed is kept. When the notes
themselves change, each file is rebuilt once with the new notes and your values written back in; the old file is
kept in data/backups/. Messages you never changed get the new default wording. Your days, streak bonuses, sites
and playtime rewards are kept exactly as you wrote them.
Mistakes in the files
A value DriftRewards can't use never stops the plugin. The console says which file and option, what was wrong and what is used instead. Reward lines are checked when the files load, so a typo shows up straight away instead of when someone should get the reward:
[DriftRewards] daily.yml: days.7.rewards "item: DIAMNOD 2" names an item that doesn't exist, so that line is skipped
[DriftRewards] votes.yml: sites.planetminecraft.cooldown "tomorrow" isn't a time (like 12h or 24h), using "24h"
/driftrewards reload tells you how many problems it found, so you know to look.
Folder layout
plugins/DriftRewards/
config.yml settings, starting with the features: switches
daily.yml the daily calendar and streak bonuses
playtime.yml playtime rewards
votes.yml voting sites, vote rewards and the vote party
referrals.yml referral rewards
messages.yml every message
menus.yml every menu
commands.yml command names, aliases and permissions
data/ the plugin's own files, no need to open them
database.mv.db claims, streaks, playtime, votes, referrals and codes (H2 storage)
backups/ old copies of files DriftRewards replaced
*.version which version of each file you have
Older versions kept data.mv.db and the .version markers next to config.yml. They are moved into data/
the first time the new version starts (one console line per file), and nothing is overwritten or deleted.