1
mirror of https://github.com/carm-outsource/TimeReward.git synced 2026-06-05 01:08:10 +08:00

feat(claim): 添加自动领取签到奖励的开关与手动领取指令。(#4)

This commit is contained in:
2023-02-23 01:41:28 +08:00
parent 77182148c5
commit ab922f0eaa
14 changed files with 376 additions and 171 deletions
@@ -19,14 +19,27 @@ public class PAPIExpansion extends EasyPlaceholder {
super(plugin, rootIdentifier);
handle("time", userHandler(UserData::getAllSeconds));
handle("reward",
rewardHandler(RewardContents::getDisplayName),
Collections.singletonList("<奖励ID>")
);
handle("claimed", userHandler((user, args) -> {
if (args.length < 1) return "请填写奖励ID";
else return user.isClaimed(args[0]);
}), Collections.singletonList("<奖励ID>"));
handle("claimable", (offlinePlayer, args) -> {
if (offlinePlayer == null || !offlinePlayer.isOnline()) return "加载中...";
if (args.length < 1) return "请填写奖励ID";
RewardContents reward = TimeRewardAPI.getRewardManager().getReward(args[0]);
if (reward == null) return "奖励不存在";
return TimeRewardAPI.getRewardManager().isClaimable((Player) offlinePlayer, reward);
}, Collections.singletonList("<奖励ID>"));
handle("version", (player, args) -> getVersion());
}