mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-02 07:56:42 +00:00
- Fix world permissions handling and add more customization
This commit is contained in:
@ -1,23 +1,36 @@
|
||||
package dev.plex.rank.enums;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@Getter
|
||||
public enum Rank
|
||||
{
|
||||
IMPOSTOR(-1, ChatColor.AQUA + "an " + ChatColor.YELLOW + "Impostor", "Impostor", ChatColor.YELLOW + "[Imp]"),
|
||||
NONOP(0, "a " + ChatColor.WHITE + "Non-Op", "Non-Op", ChatColor.WHITE + ""),
|
||||
OP(1, "an " + ChatColor.GREEN + "Operator", "Operator", ChatColor.GREEN + "[OP]"),
|
||||
ADMIN(2, "an " + ChatColor.DARK_GREEN + "Admin", "Admin", ChatColor.DARK_GREEN + "[Admin]"),
|
||||
SENIOR_ADMIN(3, "a " + ChatColor.GOLD + "Senior Admin", "Senior Admin", ChatColor.GOLD + "[SrA]"),
|
||||
EXECUTIVE(4, "an " + ChatColor.RED + "Executive", "Executive", ChatColor.RED + "[Exec]");
|
||||
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
|
||||
private String prefix;
|
||||
private List<String> permissions;
|
||||
|
||||
Rank(int level, String loginMessage, String readable, String prefix)
|
||||
{
|
||||
@ -25,56 +38,18 @@ public enum Rank
|
||||
this.loginMessage = loginMessage;
|
||||
this.readable = readable;
|
||||
this.prefix = prefix;
|
||||
this.permissions = Lists.newArrayList();
|
||||
}
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
return ChatColor.translateAlternateColorCodes('&', prefix);
|
||||
}
|
||||
|
||||
public String getLoginMSG()
|
||||
{
|
||||
return ChatColor.translateAlternateColorCodes('&', loginMessage);
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
|
||||
public String getReadableString()
|
||||
{
|
||||
return readable;
|
||||
}
|
||||
|
||||
public void setLoginMessage(String msg)
|
||||
{
|
||||
this.loginMessage = msg;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix)
|
||||
{
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public void setHumanReadableString(String readable)
|
||||
{
|
||||
this.readable = readable;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Rank rank)
|
||||
{
|
||||
return getLevel() >= rank.getLevel();
|
||||
return this.level >= rank.getLevel();
|
||||
}
|
||||
|
||||
public List<String> getPermissions()
|
||||
public JSONObject toJSON()
|
||||
{
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(List<String> permissions)
|
||||
{
|
||||
this.permissions = permissions;
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("prefix", this.prefix);
|
||||
object.put("loginMessage", this.loginMessage);
|
||||
return new JSONObject().put(this.name(), object);
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,41 @@
|
||||
package dev.plex.rank.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@Getter
|
||||
public enum Title
|
||||
{
|
||||
MASTER_BUILDER(0, ChatColor.AQUA + "a " + ChatColor.DARK_AQUA + "Master Builder", "Master Builder", ChatColor.DARK_AQUA + "[MB]"),
|
||||
DEV(1, ChatColor.AQUA + "a " + ChatColor.DARK_PURPLE + "Developer", "Developer", ChatColor.DARK_PURPLE + "[DEV]"),
|
||||
OWNER(2, ChatColor.AQUA + "an " + ChatColor.BLUE + "Owner", "Owner", ChatColor.BLUE + "[Owner]");
|
||||
MASTER_BUILDER(0, ChatColor.AQUA + "a " + ChatColor.DARK_AQUA + "Master Builder", "Master Builder", "&8[&3Master Builder&8]"),
|
||||
DEV(1, ChatColor.AQUA + "a " + ChatColor.DARK_PURPLE + "Developer", "Developer", "&8[&5Developer&8]"),
|
||||
OWNER(2, ChatColor.AQUA + "an " + ChatColor.BLUE + "Owner", "Owner", "&8[&9Owner&8]");
|
||||
|
||||
private int level;
|
||||
private String loginMSG;
|
||||
private final int level;
|
||||
|
||||
@Setter
|
||||
private String loginMessage;
|
||||
|
||||
@Setter
|
||||
private String readable;
|
||||
|
||||
@Setter
|
||||
private String prefix;
|
||||
|
||||
Title(int level, String loginMSG, String readable, String prefix)
|
||||
Title(int level, String loginMessage, String readable, String prefix)
|
||||
{
|
||||
this.level = level;
|
||||
this.loginMSG = loginMSG;
|
||||
this.loginMessage = loginMessage;
|
||||
this.readable = readable;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public JSONObject toJSON()
|
||||
{
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("prefix", this.prefix);
|
||||
object.put("loginMessage", this.loginMessage);
|
||||
return new JSONObject().put(this.name(), object);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user