From 1371e23d5941ae50800b856d648319c4db01d6d5 Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Fri, 11 May 2018 20:09:23 -0700 Subject: [PATCH] Master builder title, resolves #36 --- nb-configuration.xml | 18 ------------------ .../totalfreedommod/config/ConfigEntry.java | 1 + .../totalfreedommod/rank/RankManager.java | 8 +++++++- .../totalfreedommod/rank/Title.java | 7 +------ src/main/resources/config.yml | 3 +++ 5 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 nb-configuration.xml diff --git a/nb-configuration.xml b/nb-configuration.xml deleted file mode 100644 index 35e184b2..00000000 --- a/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - true - - diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index 7c296ba8..4c37e0c8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -43,6 +43,7 @@ public enum ConfigEntry SERVER_ADDRESS(String.class, "server.address"), SERVER_MOTD(String.class, "server.motd"), SERVER_OWNERS(List.class, "server.owners"), + MASTER_BUILDERS(List.class, "server.master_builders"), SERVER_BAN_URL(String.class, "server.ban_url"), SERVER_PERMBAN_URL(String.class, "server.permban_url"), // diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java index 1cdad1fd..6c466d99 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java @@ -49,6 +49,12 @@ public class RankManager extends FreedomService return Rank.IMPOSTOR; } + // Master builders show up if they are not admins + if (ConfigEntry.MASTER_BUILDERS.getList().contains(player.getName()) && !plugin.al.isAdmin(player)) + { + return Title.MASTER_BUILDER; + } + // Developers always show up if (FUtil.DEVELOPERS.contains(player.getName())) { @@ -177,7 +183,7 @@ public class RankManager extends FreedomService } // Set display - if (isAdmin || FUtil.DEVELOPERS.contains(player.getName())) + if (isAdmin || FUtil.DEVELOPERS.contains(player.getName()) || ConfigEntry.MASTER_BUILDERS.getList().contains(player.getName().toLowerCase())) { final Displayable display = getDisplay(player); String loginMsg = display.getColoredLoginMessage(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java index ec1aa5a3..53255ea5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java @@ -6,6 +6,7 @@ import org.bukkit.ChatColor; public enum Title implements Displayable { + MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, "Master-Builder"), DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"), OWNER("the", "Owner", ChatColor.BLUE, "Owner"); @@ -43,10 +44,4 @@ public enum Title implements Displayable return determiner + " " + color + ChatColor.ITALIC + name; } - @Override - public String getAbbr() - { - return abbr; - } - } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 7ea292b1..9d4a94ae 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -21,6 +21,9 @@ server: owners: - TheMinecraft + # All players who show up as Master Builder + master_builders: [] + # URL players should appeal for bans at ban_url: http://totalfreedom.boards.net/