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

完成奖励配置读取与奖励判断

This commit is contained in:
2022-02-28 17:55:42 +08:00
parent ca5859e5bc
commit b15a7a71fc
8 changed files with 171 additions and 21 deletions
@@ -1,5 +1,7 @@
package cc.carm.plugin.timereward.data;
import cc.carm.lib.easyplugin.utils.ColorParser;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,6 +40,10 @@ public class RewardContents {
return name;
}
public @NotNull String getDisplayName() {
return ColorParser.parseColor(getName() == null ? getRewardID() : getName());
}
public @Nullable String getPermission() {
return permission;
}
@@ -46,6 +52,14 @@ public class RewardContents {
return commands;
}
public boolean checkPermission(@NotNull Player player) {
return permission == null || player.hasPermission(permission);
}
public boolean isTimeEnough(long requireSeconds) {
return getTime() >= requireSeconds;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;