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-03-18 01:18:35 +00:00
|
|
|
import net.kyori.adventure.text.Component;
|
|
|
|
import net.kyori.adventure.text.format.NamedTextColor;
|
2022-02-25 08:59:48 +00:00
|
|
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
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-03-18 01:18:35 +00:00
|
|
|
IMPOSTOR(-1, "<aqua>an <yellow>Impostor", "Impostor", "<dark_gray>[<yellow>Imp<dark_gray>]", NamedTextColor.YELLOW),
|
|
|
|
NONOP(0, "a <white>Non-Op", "Non-Op", "", NamedTextColor.WHITE),
|
|
|
|
OP(1, "an <green>Op", "Operator", "<dark_gray>[<green>OP<dark_gray>]", NamedTextColor.GREEN),
|
|
|
|
ADMIN(2, "an <dark_green>Admin", "Admin", "<dark_gray>[<green>Admin<dark_gray>]", NamedTextColor.DARK_GREEN),
|
|
|
|
SENIOR_ADMIN(3, "a <gold>Senior Admin", "Senior Admin", "<dark_gray>[<gold>SrA<dark_gray>]", NamedTextColor.GOLD),
|
|
|
|
EXECUTIVE(4, "an <red>Executive", "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
|
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-03-18 01:18:35 +00:00
|
|
|
@Getter
|
|
|
|
private NamedTextColor color;
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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-03-18 01:18:35 +00:00
|
|
|
public Component getPrefix()
|
2022-02-25 08:59:48 +00:00
|
|
|
{
|
2022-03-18 01:18:35 +00:00
|
|
|
return MiniMessage.miniMessage().deserialize(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
|
|
|
}
|