From 47c30c32839a4229992c200172e7843d88407392 Mon Sep 17 00:00:00 2001 From: Allink Date: Wed, 25 May 2022 19:41:58 +0100 Subject: [PATCH] Add plural to Displayables --- .../totalfreedommod/rank/Displayable.java | 2 ++ .../totalfreedommod/rank/Rank.java | 22 ++++++++++++------- .../totalfreedommod/rank/Title.java | 20 ++++++++++++----- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/Displayable.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/Displayable.java index 55cc2fc1..2b2f2e49 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/Displayable.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/Displayable.java @@ -13,6 +13,8 @@ public interface Displayable String getAbbr(); + String getPlural(); + ChatColor getColor(); org.bukkit.ChatColor getTeamColor(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/Rank.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/Rank.java index 98eaf217..0c04dbbe 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/Rank.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/Rank.java @@ -4,19 +4,19 @@ import net.md_5.bungee.api.ChatColor; public enum Rank implements Displayable { - NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.WHITE, null, false, false), - OP("an", "Operator", Type.PLAYER, "OP", ChatColor.GREEN, null, false, false), - ADMIN("an", "Admin", Type.ADMIN, "Admin", 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), - ADMIN_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false), - SENIOR_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false); + NON_OP("a", "Non-Op", Type.PLAYER, "", "Non-Ops", ChatColor.WHITE, null, false, false), + OP("an", "Operator", Type.PLAYER, "OP", "Operators", ChatColor.GREEN, null, false, false), + 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", "Senior Administrators", ChatColor.GOLD, org.bukkit.ChatColor.GOLD, true, true), + ADMIN_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", "Administrator Consoles", 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 String name; private final String abbr; - + private final String plural; private final String article; private final String tag; @@ -31,11 +31,12 @@ public enum Rank implements Displayable 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.name = name; this.abbr = abbr; + this.plural = plural; this.article = article; this.tag = abbr.isEmpty() ? "" : "[" + abbr + "]"; this.coloredTag = abbr.isEmpty() ? "" : ChatColor.DARK_GRAY + "[" + color + abbr + ChatColor.DARK_GRAY + "]" + color; @@ -88,6 +89,11 @@ public enum Rank implements Displayable return abbr; } + public String getPlural() + { + return plural; + } + public boolean isConsole() { return getType() == Type.ADMIN_CONSOLE; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java index c21d9f79..8cdd0118 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java @@ -5,11 +5,11 @@ import net.md_5.bungee.api.ChatColor; public enum Title implements Displayable { - MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true), - EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true), - ASSTEXEC("an", "Assistant Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true, true), - DEVELOPER("a", "Developer", 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); + MASTER_BUILDER("a", "Master Builder", "Master Builders", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true), + EXECUTIVE("an", "Executive", "Executives", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true), + ASSTEXEC("an", "Assistant Executive", "Assistant Executives", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true, true), + DEVELOPER("a", "Developer", "Developers", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true), + OWNER("the", "Owner", "Owners", ChatColor.DARK_RED, org.bukkit.ChatColor.DARK_RED, "Owner", true, true); private final String article; @@ -17,6 +17,7 @@ public enum Title implements Displayable private final String name; private final String abbr; + private final String plural; private final String tag; @@ -29,10 +30,11 @@ public enum Title implements Displayable private final boolean hasTeam; 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.name = name; + this.plural = plural; this.coloredTag = ChatColor.DARK_GRAY + "[" + color + tag + ChatColor.DARK_GRAY + "]" + color; this.abbr = tag; this.tag = "[" + tag + "]"; @@ -84,6 +86,12 @@ public enum Title implements Displayable return abbr; } + @Override + public String getPlural() + { + return plural; + } + @Override public String getTag() {