Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Tasks only start earning activity credit once revealed, giving players a reason

- **Personal daily task menus** — a fresh selection of activities, with progress displays and descriptions for revealed tasks.
- **Weekly reward milestones** — activity points unlock claimable rewards from weighted reward pools.
- **Week-locked rewards** — each week pays from the reward pools it started with; reward edits apply at the next weekly reset, or right away with `/activity rewards apply`.
- **Daily reveal rewards** — players can claim a separate reward after revealing all of their daily tasks.
- **Activities across the server** — supported integrations track actions such as voting, cooking, archaeology, instrument playing, market sales, and vehicle building.
- **Varied progression limits** — daily caps and a voting share of the daily allowance shape how points are earned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
public class ActivityCommand implements CommandExecutor, TabCompleter {

private static final List<String> SUBCOMMANDS =
Arrays.asList("reload", "check", "reset", "givereroll", "add", "addpoints");
Arrays.asList("reload", "rewards", "check", "reset", "givereroll", "add", "addpoints");

private static final String APPLY = "apply";

private static final List<String> READ_ONLY_SUBCOMMANDS = List.of("check");

Expand Down Expand Up @@ -80,8 +82,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
case "reload":
manager.reload();
sender.sendMessage(messages().get("admin.reloaded"));
rewardStatus(sender);
audit(sender, "action=reload result=done");
return true;
case "rewards":
handleRewards(sender, args);
return true;
case "check":
handleCheck(sender, args);
return true;
Expand All @@ -103,6 +109,40 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}
}

private void handleRewards(CommandSender sender, String[] args) {
if (args.length == 1) {
rewardStatus(sender);
return;
}
if (args.length != 2 || !args[1].equalsIgnoreCase(APPLY)) {
usage(sender);
audit(sender, "action=rewards-apply result=usage");
return;
}

manager.reload();
ActivityConfiguration config = manager.getConfiguration();
if (!config.applyRewardsNow()) {
sender.sendMessage(messages().get("admin.rewards-apply-failed"));
audit(sender, "action=rewards-apply week=" + config.rewardWeek() + " result=save-failed");
return;
}
sender.sendMessage(messages().get("admin.rewards-applied", "%week%", config.rewardWeek()));
audit(sender, "action=rewards-apply week=" + config.rewardWeek() + " result=done");
}

private void rewardStatus(CommandSender sender) {
ActivityConfiguration config = manager.getConfiguration();
String week = config.rewardWeek();
if (week == null) {
return;
}
sender.sendMessage(messages().get("admin.rewards-locked", "%week%", week));
sender.sendMessage(config.rewardsPending()
? messages().get("admin.rewards-pending", "%reset%", config.nextReset(week))
: messages().get("admin.rewards-in-sync"));
}

private void usage(CommandSender sender) {
sender.sendMessage(messages().get("admin.usage"));
sender.sendMessage(messages().get("admin.usage-addpoints"));
Expand Down Expand Up @@ -428,6 +468,10 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
return filter(onlineNames(), args[1]);
}

if (args.length == 2 && sub.equals("rewards")) {
return filter(List.of(APPLY), args[1]);
}

if (args.length == 5 && sub.equals("add")) {
return filter(List.of(FORCE), args[4]);
}
Expand Down
Loading