2021-01-03 07:21:15 +00:00
|
|
|
package dev.plex.rank.enums;
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2022-02-22 04:51:05 +00:00
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.Setter;
|
2022-01-27 21:23:01 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2022-02-22 04:51:05 +00:00
|
|
|
import org.json.JSONObject;
|
2022-01-04 03:04:39 +00:00
|
|
|
|
2022-02-22 04:51:05 +00:00
|
|
|
@Getter
|
2020-10-27 20:12:38 +00:00
|
|
|
public enum Rank
|
|
|
|
{
|
2022-02-22 04:51:05 +00:00
|
|
|
IMPOSTOR(-1, ChatColor.AQUA + "an " + ChatColor.YELLOW + "Impostor", "Impostor", "&8[&eImp&8]"),
|
|
|
|
NONOP(0, "a " + ChatColor.WHITE + "Non-Op", "Non-Op", ""),
|
2022-02-22 06:51:46 +00:00
|
|
|
OP(1, "an " + ChatColor.GREEN + "Operator", "Operator", "&8[&aOP&8]"),
|
2022-02-22 04:51:05 +00:00
|
|
|
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]");
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2022-02-04 04:49:05 +00:00
|
|
|
private final int level;
|
2022-02-22 04:51:05 +00:00
|
|
|
|
|
|
|
@Setter
|
2020-10-28 19:07:02 +00:00
|
|
|
private String loginMessage;
|
2022-02-22 04:51:05 +00:00
|
|
|
|
|
|
|
@Setter
|
2022-02-04 04:49:05 +00:00
|
|
|
private String readable;
|
2022-02-22 04:51:05 +00:00
|
|
|
|
|
|
|
@Setter
|
2020-11-06 01:29:38 +00:00
|
|
|
private String prefix;
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2022-02-04 04:49:05 +00:00
|
|
|
Rank(int level, String loginMessage, String readable, String prefix)
|
2020-10-27 20:12:38 +00:00
|
|
|
{
|
2020-10-28 19:07:02 +00:00
|
|
|
this.level = level;
|
2020-10-28 03:49:56 +00:00
|
|
|
this.loginMessage = loginMessage;
|
2022-02-04 04:49:05 +00:00
|
|
|
this.readable = readable;
|
2020-10-27 20:12:38 +00:00
|
|
|
this.prefix = prefix;
|
2022-02-04 04:49:05 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 00:06:08 +00:00
|
|
|
public boolean isAtLeast(Rank rank)
|
2020-10-28 19:07:02 +00:00
|
|
|
{
|
2022-02-22 04:51:05 +00:00
|
|
|
return this.level >= rank.getLevel();
|
2020-10-28 19:07:02 +00:00
|
|
|
}
|
|
|
|
|
2022-02-22 04:51:05 +00:00
|
|
|
public JSONObject toJSON()
|
2020-11-06 01:29:38 +00:00
|
|
|
{
|
2022-02-22 04:51:05 +00:00
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("prefix", this.prefix);
|
|
|
|
object.put("loginMessage", this.loginMessage);
|
|
|
|
return new JSONObject().put(this.name(), object);
|
2020-10-28 19:07:02 +00:00
|
|
|
}
|
2020-10-27 20:12:38 +00:00
|
|
|
}
|