Plex/src/main/java/dev/plex/rank/enums/Rank.java

56 lines
1.5 KiB
Java
Raw Normal View History

2021-01-03 07:21:15 +00:00
package dev.plex.rank.enums;
import com.google.common.collect.Lists;
import java.util.Arrays;
2022-01-04 03:04:39 +00:00
import java.util.List;
import com.google.gson.Gson;
import lombok.Getter;
import lombok.Setter;
2022-01-27 21:23:01 +00:00
import org.bukkit.ChatColor;
import org.json.JSONObject;
2022-01-04 03:04:39 +00:00
@Getter
public enum Rank
{
IMPOSTOR(-1, ChatColor.AQUA + "an " + ChatColor.YELLOW + "Impostor", "Impostor", "&8[&eImp&8]"),
NONOP(0, "a " + ChatColor.WHITE + "Non-Op", "Non-Op", ""),
OP(1, "an " + ChatColor.GREEN + "Operator", "Operator", "&8[&aOp&8]"),
ADMIN(2, "an " + ChatColor.DARK_GREEN + "Admin", "Admin", "&8[&2Admin&8]"),
SENIOR_ADMIN(3, "a " + ChatColor.GOLD + "Senior Admin", "Senior Admin", "&8[&6SrA&8]"),
EXECUTIVE(4, "an " + ChatColor.RED + "Executive", "Executive", "&8[&cExec&8]");
private final int level;
@Setter
private String loginMessage;
@Setter
private String readable;
@Setter
2020-11-06 01:29:38 +00:00
private String prefix;
Rank(int level, String loginMessage, String readable, String prefix)
{
this.level = level;
2020-10-28 03:49:56 +00:00
this.loginMessage = loginMessage;
this.readable = readable;
this.prefix = prefix;
}
public boolean isAtLeast(Rank rank)
{
return this.level >= rank.getLevel();
}
public JSONObject toJSON()
2020-11-06 01:29:38 +00:00
{
JSONObject object = new JSONObject();
object.put("prefix", this.prefix);
object.put("loginMessage", this.loginMessage);
return new JSONObject().put(this.name(), object);
}
}