Add plural to Displayables

This commit is contained in:
Allink 2022-05-25 19:41:58 +01:00
parent 6c426644f6
commit 47c30c3283
No known key found for this signature in database
GPG Key ID: 7F1F1B98F0FAAD13
3 changed files with 30 additions and 14 deletions

View File

@ -13,6 +13,8 @@ public interface Displayable
String getAbbr(); String getAbbr();
String getPlural();
ChatColor getColor(); ChatColor getColor();
org.bukkit.ChatColor getTeamColor(); org.bukkit.ChatColor getTeamColor();

View File

@ -4,19 +4,19 @@ import net.md_5.bungee.api.ChatColor;
public enum Rank implements Displayable public enum Rank implements Displayable
{ {
NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.WHITE, null, false, false), NON_OP("a", "Non-Op", Type.PLAYER, "", "Non-Ops", ChatColor.WHITE, null, false, false),
OP("an", "Operator", Type.PLAYER, "OP", ChatColor.GREEN, null, false, false), OP("an", "Operator", Type.PLAYER, "OP", "Operators", ChatColor.GREEN, null, false, false),
ADMIN("an", "Admin", Type.ADMIN, "Admin", ChatColor.DARK_GREEN, org.bukkit.ChatColor.DARK_GREEN, true, true), ADMIN("an", "Admin", Type.ADMIN, "Admin", "Administrators", ChatColor.DARK_GREEN, org.bukkit.ChatColor.DARK_GREEN, true, true),
SENIOR_ADMIN("a", "Senior Admin", Type.ADMIN, "SrA", ChatColor.GOLD, org.bukkit.ChatColor.GOLD, true, true), SENIOR_ADMIN("a", "Senior Admin", Type.ADMIN, "SrA", "Senior Administrators", ChatColor.GOLD, org.bukkit.ChatColor.GOLD, true, true),
ADMIN_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false), ADMIN_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", "Administrator Consoles", ChatColor.DARK_PURPLE, null, false, false),
SENIOR_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false); SENIOR_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", "Senior Consoles", ChatColor.DARK_PURPLE, null, false, false);
private final Type type; private final Type type;
private final String name; private final String name;
private final String abbr; private final String abbr;
private final String plural;
private final String article; private final String article;
private final String tag; private final String tag;
@ -31,11 +31,12 @@ public enum Rank implements Displayable
private final boolean hasDefaultLoginMessage; private final boolean hasDefaultLoginMessage;
Rank(String article, String name, Type type, String abbr, ChatColor color, org.bukkit.ChatColor teamColor, Boolean hasTeam, Boolean hasDefaultLoginMessage) Rank(String article, String name, Type type, String abbr, String plural, ChatColor color, org.bukkit.ChatColor teamColor, Boolean hasTeam, Boolean hasDefaultLoginMessage)
{ {
this.type = type; this.type = type;
this.name = name; this.name = name;
this.abbr = abbr; this.abbr = abbr;
this.plural = plural;
this.article = article; this.article = article;
this.tag = abbr.isEmpty() ? "" : "[" + abbr + "]"; this.tag = abbr.isEmpty() ? "" : "[" + abbr + "]";
this.coloredTag = abbr.isEmpty() ? "" : ChatColor.DARK_GRAY + "[" + color + abbr + ChatColor.DARK_GRAY + "]" + color; this.coloredTag = abbr.isEmpty() ? "" : ChatColor.DARK_GRAY + "[" + color + abbr + ChatColor.DARK_GRAY + "]" + color;
@ -88,6 +89,11 @@ public enum Rank implements Displayable
return abbr; return abbr;
} }
public String getPlural()
{
return plural;
}
public boolean isConsole() public boolean isConsole()
{ {
return getType() == Type.ADMIN_CONSOLE; return getType() == Type.ADMIN_CONSOLE;

View File

@ -5,11 +5,11 @@ import net.md_5.bungee.api.ChatColor;
public enum Title implements Displayable public enum Title implements Displayable
{ {
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true), MASTER_BUILDER("a", "Master Builder", "Master Builders", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true),
EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true), EXECUTIVE("an", "Executive", "Executives", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true),
ASSTEXEC("an", "Assistant Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true, true), ASSTEXEC("an", "Assistant Executive", "Assistant Executives", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true, true),
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true), DEVELOPER("a", "Developer", "Developers", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true),
OWNER("the", "Owner", ChatColor.DARK_RED, org.bukkit.ChatColor.DARK_RED, "Owner", true, true); OWNER("the", "Owner", "Owners", ChatColor.DARK_RED, org.bukkit.ChatColor.DARK_RED, "Owner", true, true);
private final String article; private final String article;
@ -17,6 +17,7 @@ public enum Title implements Displayable
private final String name; private final String name;
private final String abbr; private final String abbr;
private final String plural;
private final String tag; private final String tag;
@ -29,10 +30,11 @@ public enum Title implements Displayable
private final boolean hasTeam; private final boolean hasTeam;
private final boolean hasDefaultLoginMessage; private final boolean hasDefaultLoginMessage;
Title(String article, String name, ChatColor color, org.bukkit.ChatColor teamColor, String tag, Boolean hasTeam, Boolean hasDefaultLoginMessage) Title(String article, String name, String plural, ChatColor color, org.bukkit.ChatColor teamColor, String tag, Boolean hasTeam, Boolean hasDefaultLoginMessage)
{ {
this.article = article; this.article = article;
this.name = name; this.name = name;
this.plural = plural;
this.coloredTag = ChatColor.DARK_GRAY + "[" + color + tag + ChatColor.DARK_GRAY + "]" + color; this.coloredTag = ChatColor.DARK_GRAY + "[" + color + tag + ChatColor.DARK_GRAY + "]" + color;
this.abbr = tag; this.abbr = tag;
this.tag = "[" + tag + "]"; this.tag = "[" + tag + "]";
@ -84,6 +86,12 @@ public enum Title implements Displayable
return abbr; return abbr;
} }
@Override
public String getPlural()
{
return plural;
}
@Override @Override
public String getTag() public String getTag()
{ {