diff --git a/pom.xml b/pom.xml index 4fad6c3..c5a3dcd 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ cc.carm.plugin timereward - 3.1.0 + 3.1.1 TimeReward 在线时长自动领奖插件,通过指令发放奖励,基于EasyPlugin实现。 diff --git a/src/main/java/cc/carm/plugin/timereward/hooker/PAPIExpansion.java b/src/main/java/cc/carm/plugin/timereward/hooker/PAPIExpansion.java index 280f117..6c0fdf2 100644 --- a/src/main/java/cc/carm/plugin/timereward/hooker/PAPIExpansion.java +++ b/src/main/java/cc/carm/plugin/timereward/hooker/PAPIExpansion.java @@ -19,13 +19,40 @@ public class PAPIExpansion extends EasyPlaceholder { public PAPIExpansion(@NotNull JavaPlugin plugin, @NotNull String rootIdentifier) { super(plugin, rootIdentifier); - handle("time", userHandler((user, args) -> { + handle("seconds", userHandler((user, args) -> { if (args.length < 1) return "请填写时间类型"; IntervalType type = IntervalType.parse(args[0]); if (type == null) return "时间类型不存在"; return user.getOnlineDuration(type).getSeconds(); + }), Collections.singletonList("<时间类型>"), "time"); + + handle("minutes", userHandler((user, args) -> { + if (args.length < 1) return "请填写时间类型"; + IntervalType type = IntervalType.parse(args[0]); + + if (type == null) return "时间类型不存在"; + + return user.getOnlineDuration(type).toMinutes(); + }), Collections.singletonList("<时间类型>")); + + handle("hours", userHandler((user, args) -> { + if (args.length < 1) return "请填写时间类型"; + IntervalType type = IntervalType.parse(args[0]); + + if (type == null) return "时间类型不存在"; + + return user.getOnlineDuration(type).toHours(); + }), Collections.singletonList("<时间类型>")); + + handle("days", userHandler((user, args) -> { + if (args.length < 1) return "请填写时间类型"; + IntervalType type = IntervalType.parse(args[0]); + + if (type == null) return "时间类型不存在"; + + return user.getOnlineDuration(type).toDays(); }), Collections.singletonList("<时间类型>")); handle("reward",