2021-01-03 07:21:15 +00:00
|
|
|
package dev.plex.rank.enums;
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2022-04-24 04:16:14 +00:00
|
|
|
import dev.plex.api.rank.IRank;
|
2022-04-10 01:53:27 +00:00
|
|
|
import dev.plex.util.PlexUtils;
|
2022-02-22 04:51:05 +00:00
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.Setter;
|
2022-03-18 01:18:35 +00:00
|
|
|
import net.kyori.adventure.text.Component;
|
|
|
|
import net.kyori.adventure.text.format.NamedTextColor;
|
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
|
2022-04-24 04:16:14 +00:00
|
|
|
public enum Rank implements IRank
|
2020-10-27 20:12:38 +00:00
|
|
|
{
|
2022-03-19 19:37:11 +00:00
|
|
|
IMPOSTOR(-1, "<aqua>an <yellow>Impostor<reset>", "Impostor", "<dark_gray>[<yellow>Imp<dark_gray>]", NamedTextColor.YELLOW),
|
|
|
|
NONOP(0, "a <white>Non-Op<reset>", "Non-Op", "", NamedTextColor.WHITE),
|
|
|
|
OP(1, "an <green>Op<reset>", "Operator", "<dark_gray>[<green>OP<dark_gray>]", NamedTextColor.GREEN),
|
|
|
|
ADMIN(2, "an <dark_green>Admin<reset>", "Admin", "<dark_gray>[<green>Admin<dark_gray>]", NamedTextColor.DARK_GREEN),
|
|
|
|
SENIOR_ADMIN(3, "a <gold>Senior Admin<reset>", "Senior Admin", "<dark_gray>[<gold>SrA<dark_gray>]", NamedTextColor.GOLD),
|
|
|
|
EXECUTIVE(4, "an <red>Executive<reset>", "Executive", "<dark_gray>[<red>Exec<dark_gray>]", NamedTextColor.RED);
|
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
|
2022-03-25 05:54:21 +00:00
|
|
|
private String loginMessage;
|
2022-02-22 04:51:05 +00:00
|
|
|
|
|
|
|
@Setter
|
2022-03-25 05:54:21 +00:00
|
|
|
private String readable;
|
2022-02-22 04:51:05 +00:00
|
|
|
|
|
|
|
@Setter
|
2022-03-25 05:54:21 +00:00
|
|
|
private String prefix;
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2022-03-18 01:18:35 +00:00
|
|
|
@Getter
|
2022-05-10 05:08:45 +00:00
|
|
|
private final NamedTextColor color;
|
2022-03-18 01:18:35 +00:00
|
|
|
|
|
|
|
Rank(int level, String loginMessage, String readable, String prefix, NamedTextColor color)
|
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-03-18 01:18:35 +00:00
|
|
|
this.color = color;
|
2022-02-04 04:49:05 +00:00
|
|
|
}
|
|
|
|
|
2022-04-24 04:16:14 +00:00
|
|
|
public boolean isAtLeast(IRank 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-04-24 20:35:48 +00:00
|
|
|
public boolean isAtLeast(Rank rank)
|
|
|
|
{
|
|
|
|
return this.level >= rank.getLevel();
|
|
|
|
}
|
|
|
|
|
2022-03-18 01:18:35 +00:00
|
|
|
public Component getPrefix()
|
2022-02-25 08:59:48 +00:00
|
|
|
{
|
2022-04-10 01:53:27 +00:00
|
|
|
return PlexUtils.mmDeserialize(this.prefix);
|
2022-02-25 08:59:48 +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
|
|
|
}
|