mirror of
https://github.com/carm-outsource/TimeReward.git
synced 2026-06-05 01:08:10 +08:00
refactor(update): 适配最新依赖版本 (#5)
* refactor(update): 适配最新依赖版本 * feat(update): 更新 README,添加更多自定义语言文本。
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class RewardContents {
|
||||
|
||||
public final @NotNull String id;
|
||||
|
||||
private final long time;
|
||||
private final @Nullable String name;
|
||||
private final @Nullable String permission;
|
||||
private final @NotNull List<String> commands;
|
||||
|
||||
|
||||
public RewardContents(@NotNull String id, long time,
|
||||
@Nullable String name, @Nullable String permission,
|
||||
@NotNull List<String> commands) {
|
||||
this.id = id;
|
||||
this.time = time;
|
||||
this.name = name;
|
||||
this.permission = permission;
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
public String getRewardID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public @Nullable String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public @NotNull String getDisplayName() {
|
||||
return ColorParser.parseColor(getName() == null ? getRewardID() : getName());
|
||||
}
|
||||
|
||||
public @Nullable String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public @NotNull List<String> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public boolean checkPermission(@NotNull Player player) {
|
||||
return permission == null || player.hasPermission(permission);
|
||||
}
|
||||
|
||||
public boolean isTimeEnough(long requireSeconds) {
|
||||
return requireSeconds >= getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
RewardContents that = (RewardContents) o;
|
||||
return id.equals(that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user