package dev.plex.rank.enums; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.minimessage.MiniMessage; import org.json.JSONObject; @Getter public enum Rank { IMPOSTOR(-1, "an Impostor", "Impostor", "[Imp]", NamedTextColor.YELLOW), NONOP(0, "a Non-Op", "Non-Op", "", NamedTextColor.WHITE), OP(1, "an Op", "Operator", "[OP]", NamedTextColor.GREEN), ADMIN(2, "an Admin", "Admin", "[Admin]", NamedTextColor.DARK_GREEN), SENIOR_ADMIN(3, "a Senior Admin", "Senior Admin", "[SrA]", NamedTextColor.GOLD), EXECUTIVE(4, "an Executive", "Executive", "[Exec]", NamedTextColor.RED); private final int level; @Setter private String loginMessage; @Setter private String readable; @Setter private String prefix; @Getter private NamedTextColor color; Rank(int level, String loginMessage, String readable, String prefix, NamedTextColor color) { this.level = level; this.loginMessage = loginMessage; this.readable = readable; this.prefix = prefix; this.color = color; } public boolean isAtLeast(Rank rank) { return this.level >= rank.getLevel(); } public Component getPrefix() { return MiniMessage.miniMessage().deserialize(this.prefix); } public JSONObject toJSON() { JSONObject object = new JSONObject(); object.put("prefix", this.prefix); object.put("loginMessage", this.loginMessage); return new JSONObject().put(this.name(), object); } }