2021-01-03 07:21:15 +00:00
|
|
|
package dev.plex.rank.enums;
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2020-10-28 19:07:02 +00:00
|
|
|
import com.google.common.collect.Lists;
|
2020-11-06 01:29:38 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2020-10-28 19:07:02 +00:00
|
|
|
|
2022-01-04 03:04:39 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2020-10-27 20:12:38 +00:00
|
|
|
public enum Rank
|
|
|
|
{
|
2020-10-31 04:51:22 +00:00
|
|
|
IMPOSTOR(-1, ChatColor.AQUA + "an " + ChatColor.YELLOW + "Impostor", ChatColor.YELLOW + "[Imp]"),
|
2020-11-06 03:50:16 +00:00
|
|
|
NONOP(0, "a " + ChatColor.WHITE + "Non-Op", ChatColor.WHITE + ""),
|
|
|
|
OP(1, "an " + ChatColor.GREEN + "Operator", ChatColor.GREEN + "[OP]"),
|
|
|
|
ADMIN(2, "an " + ChatColor.DARK_GREEN + "Admin", ChatColor.DARK_GREEN + "[Admin]"),
|
|
|
|
SENIOR_ADMIN(3, "a " + ChatColor.GOLD + "Senior Admin", ChatColor.GOLD + "[SrA]"),
|
|
|
|
EXECUTIVE(4, "an " + ChatColor.RED + "Executive", ChatColor.RED + "[Exec]");
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2020-10-28 19:07:02 +00:00
|
|
|
private String loginMessage;
|
2020-11-06 01:29:38 +00:00
|
|
|
private String prefix;
|
2020-10-28 19:07:02 +00:00
|
|
|
private int level;
|
|
|
|
private List<String> permissions;
|
2020-10-27 20:12:38 +00:00
|
|
|
|
2020-10-28 03:49:56 +00:00
|
|
|
Rank(int level, String loginMessage, 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;
|
2020-10-27 20:12:38 +00:00
|
|
|
this.prefix = prefix;
|
2020-10-28 19:07:02 +00:00
|
|
|
this.permissions = Lists.newArrayList();
|
2020-10-27 20:12:38 +00:00
|
|
|
}
|
|
|
|
|
2020-10-28 03:49:56 +00:00
|
|
|
public String getPrefix()
|
|
|
|
{
|
2020-10-28 19:14:44 +00:00
|
|
|
return ChatColor.translateAlternateColorCodes('&', prefix);
|
2020-10-27 21:56:05 +00:00
|
|
|
}
|
|
|
|
|
2020-10-28 03:49:56 +00:00
|
|
|
public String getLoginMSG()
|
|
|
|
{
|
2020-10-28 19:14:44 +00:00
|
|
|
return ChatColor.translateAlternateColorCodes('&', loginMessage);
|
2020-10-27 21:56:05 +00:00
|
|
|
}
|
2020-10-28 19:07:02 +00:00
|
|
|
|
2020-11-06 01:29:38 +00:00
|
|
|
public int getLevel()
|
|
|
|
{
|
2020-10-28 19:07:02 +00:00
|
|
|
return level;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLoginMessage(String msg)
|
|
|
|
{
|
|
|
|
this.loginMessage = msg;
|
|
|
|
}
|
|
|
|
|
2020-11-06 01:29:38 +00:00
|
|
|
public void setPrefix(String prefix)
|
|
|
|
{
|
2020-10-28 19:07:02 +00:00
|
|
|
this.prefix = prefix;
|
|
|
|
}
|
|
|
|
|
2020-11-02 00:06:08 +00:00
|
|
|
public boolean isAtLeast(Rank rank)
|
2020-10-28 19:07:02 +00:00
|
|
|
{
|
|
|
|
return getLevel() >= rank.getLevel();
|
|
|
|
}
|
|
|
|
|
2020-11-06 01:29:38 +00:00
|
|
|
public List<String> getPermissions()
|
|
|
|
{
|
2020-10-28 19:07:02 +00:00
|
|
|
return permissions;
|
|
|
|
}
|
|
|
|
|
2020-11-06 01:29:38 +00:00
|
|
|
public void setPermissions(List<String> permissions)
|
|
|
|
{
|
2020-10-28 19:07:02 +00:00
|
|
|
this.permissions = permissions;
|
|
|
|
}
|
2020-10-27 20:12:38 +00:00
|
|
|
}
|