mirror of
https://github.com/carm-outsource/TimeReward.git
synced 2024-09-19 19:25:49 +00:00
feat(time): 新增秒、分、小时、天数的变量。
This commit is contained in:
parent
1078c7e03d
commit
52f8f7bd3a
2
pom.xml
2
pom.xml
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<groupId>cc.carm.plugin</groupId>
|
<groupId>cc.carm.plugin</groupId>
|
||||||
<artifactId>timereward</artifactId>
|
<artifactId>timereward</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.1.1</version>
|
||||||
|
|
||||||
<name>TimeReward</name>
|
<name>TimeReward</name>
|
||||||
<description>在线时长自动领奖插件,通过指令发放奖励,基于EasyPlugin实现。</description>
|
<description>在线时长自动领奖插件,通过指令发放奖励,基于EasyPlugin实现。</description>
|
||||||
|
@ -19,13 +19,40 @@ public class PAPIExpansion extends EasyPlaceholder {
|
|||||||
public PAPIExpansion(@NotNull JavaPlugin plugin, @NotNull String rootIdentifier) {
|
public PAPIExpansion(@NotNull JavaPlugin plugin, @NotNull String rootIdentifier) {
|
||||||
super(plugin, rootIdentifier);
|
super(plugin, rootIdentifier);
|
||||||
|
|
||||||
handle("time", userHandler((user, args) -> {
|
handle("seconds", userHandler((user, args) -> {
|
||||||
if (args.length < 1) return "请填写时间类型";
|
if (args.length < 1) return "请填写时间类型";
|
||||||
IntervalType type = IntervalType.parse(args[0]);
|
IntervalType type = IntervalType.parse(args[0]);
|
||||||
|
|
||||||
if (type == null) return "时间类型不存在";
|
if (type == null) return "时间类型不存在";
|
||||||
|
|
||||||
return user.getOnlineDuration(type).getSeconds();
|
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("<时间类型>"));
|
}), Collections.singletonList("<时间类型>"));
|
||||||
|
|
||||||
handle("reward",
|
handle("reward",
|
||||||
|
Loading…
Reference in New Issue
Block a user