From 20697982e7471c4d8ca2d3e4a02de7eae203217a Mon Sep 17 00:00:00 2001 From: samczsun Date: Tue, 6 Dec 2016 14:50:56 -0500 Subject: [PATCH] Create Rank ScoreboardTag to fix Name collision --- .../src/mineplex/core/common/Rank.java | 57 ++++++++++--------- .../PlayerScoreboard.java | 8 +-- .../src/mineplex/clanshub/HubManager.java | 8 +-- .../src/mineplex/hub/HubManager.java | 10 ++-- .../nautilus/game/arcade/ArcadeManager.java | 10 ++-- .../arcade/managers/lobby/LobbyManager.java | 6 +- 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 7a5bbcc88..53a2ba498 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -10,55 +10,58 @@ import mineplex.core.common.util.UtilPlayer; public enum Rank { //Staff - LT("Leader", ChatColor.DARK_RED, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."), - OWNER("Owner", ChatColor.DARK_RED, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."), - DEVELOPER("Dev", ChatColor.DARK_RED, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), - ADMIN("Admin", ChatColor.DARK_RED, "An Administrator’s role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."), - JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), - SUPPORT("Support", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."), - CMOD("C.Mod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - MODERATOR("Mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - HELPER("Trainee", ChatColor.GOLD, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), - MAPLEAD("MapLead", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."), - MAPDEV("Builder", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."), - MEDIA("Media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."), + LT("Leader", "lt", ChatColor.DARK_RED, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."), + OWNER("Owner", "owner", ChatColor.DARK_RED, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."), + DEVELOPER("Dev", "dev", ChatColor.DARK_RED, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), + ADMIN("Admin", "adm", ChatColor.DARK_RED, "An Administrator’s role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."), + JNR_DEV("Jr.Dev", "jrdev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."), + SUPPORT("Support", "spp", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."), + CMOD("C.Mod", "cmod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + SNR_MODERATOR("Sr.Mod", "srmod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + MODERATOR("Mod", "mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + HELPER("Trainee", "train", ChatColor.GOLD, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a ") + "."), + MAPLEAD("MapLead", "mapl", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."), + MAPDEV("Builder", "mapd", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."), + MEDIA("Media", "media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."), - EVENT("Event", ChatColor.WHITE, "A member of the official Mineplex Events team!"), + EVENT("Event", "evnt", ChatColor.WHITE, "A member of the official Mineplex Events team!"), //Media - YOUTUBE("YouTube", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."), - YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."), - TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."), + YOUTUBE("YouTube", "yt", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."), + YOUTUBE_SMALL("YT", "ytsm", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."), + TWITCH("Twitch", "tw", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."), //Player - ETERNAL("Eternal", ChatColor.DARK_AQUA, true, "???"), - TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"), - LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"), - HERO("Hero", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"), - ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank. \n\nPurchase Ultra at www.mineplex.com/shop"), - ALL("", ChatColor.WHITE, null); + ETERNAL("Eternal", "et", ChatColor.DARK_AQUA, true, "???"), + TITAN("Titan", "t", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"), + LEGEND("Legend", "l", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"), + HERO("Hero", "h", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"), + ULTRA("Ultra", "u", ChatColor.AQUA, true, "Mineplex's first premium rank. \n\nPurchase Ultra at www.mineplex.com/shop"), + ALL("", "", ChatColor.WHITE, null); private ChatColor _color; private boolean _donor; private String _description; public String Name; + public String ScoreboardTag; - Rank(String name, ChatColor color, String description) + Rank(String name, String scoreboardTag, ChatColor color, String description) { _color = color; Name = name; _donor = false; _description = description; + ScoreboardTag = scoreboardTag; } - Rank(String name, ChatColor color, boolean donor, String description) + Rank(String name, String scoreboardTag, ChatColor color, boolean donor, String description) { _color = color; Name = name; _donor = donor; _description = description; + ScoreboardTag = scoreboardTag; } public String getDescription() @@ -122,8 +125,8 @@ public enum Rank if (uppercase) name = Name.toUpperCase(); - if (bold) return _color + C.Bold + name; - else return _color + name; + if (bold) return _color + C.Bold + name; + else return _color + name; } public ChatColor getColor() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java b/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java index 7655e3bc4..8a7175388 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/thereallyoldscoreboardapiweshouldremove/PlayerScoreboard.java @@ -38,9 +38,9 @@ public class PlayerScoreboard for (Rank rank : Rank.values()) { if (rank != Rank.ALL) - _scoreboard.registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + _scoreboard.registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); else - _scoreboard.registerNewTeam(rank.Name).setPrefix(""); + _scoreboard.registerNewTeam(rank.ScoreboardTag).setPrefix(""); } _scoreboard.registerNewTeam("Party").setPrefix(ChatColor.LIGHT_PURPLE + C.Bold + "Party" + ChatColor.RESET + " "); @@ -53,8 +53,8 @@ public class PlayerScoreboard if (_manager.getClients().Get(otherPlayer) == null) continue; - String rankName = _manager.getClients().Get(player).GetRank().Name; - String otherRankName = _manager.getClients().Get(otherPlayer).GetRank().Name; + String rankName = _manager.getClients().Get(player).GetRank().ScoreboardTag; + String otherRankName = _manager.getClients().Get(otherPlayer).GetRank().ScoreboardTag; //Add Other to Self _scoreboard.getTeam(otherRankName).addPlayer(otherPlayer); diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java index c2c848c73..1e92dce8a 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java @@ -403,9 +403,9 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter for (Rank rank : Rank.values()) { if (rank != Rank.ALL) - board.registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + board.registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); else - board.registerNewTeam(rank.Name).setPrefix(""); + board.registerNewTeam(rank.ScoreboardTag).setPrefix(""); } for (Player otherPlayer : Bukkit.getOnlinePlayers()) @@ -413,8 +413,8 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter if (_clientManager.Get(otherPlayer) == null) continue; - String rankName = _clientManager.Get(player).GetRank().Name; - String otherRankName = _clientManager.Get(otherPlayer).GetRank().Name; + String rankName = _clientManager.Get(player).GetRank().ScoreboardTag; + String otherRankName = _clientManager.Get(otherPlayer).GetRank().ScoreboardTag; //Add Other to Self board.getTeam(otherRankName).addPlayer(otherPlayer); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index f046d1bed..a9f9ee0e3 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -282,9 +282,9 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (Rank rank : Rank.values()) { if (rank == Rank.ALL) - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(""); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(""); else - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); } scoreboard.register(HubScoreboardLine.SERVER_TITLE) @@ -345,7 +345,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(playerName); } if (get(player) != null) @@ -353,7 +353,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (Player player1 : Bukkit.getOnlinePlayers()) { client = GetClients().Get(player1); - get(player).getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(player1.getName()); + get(player).getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(player1.getName()); } } } @@ -367,7 +367,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).removeEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).removeEntry(playerName); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 55cbdc20b..f30e2eb73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -408,7 +408,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(playerName); } Player player = Bukkit.getPlayerExact(playerName); @@ -419,7 +419,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation { client = GetClients().Get(player1); - get(player).getHandle().getTeam(client.getRealOrDisguisedRank().Name).addEntry(player1.getName()); + get(player).getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).addEntry(player1.getName()); } } @@ -452,7 +452,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation for (MineplexScoreboard scoreboard : getScoreboards().values()) { - scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).removeEntry(playerName); + scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).removeEntry(playerName); } } @@ -462,9 +462,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation for (Rank rank : Rank.values()) { if (rank == Rank.ALL) - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(""); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(""); else - scoreboard.getHandle().registerNewTeam(rank.Name).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); + scoreboard.getHandle().registerNewTeam(rank.ScoreboardTag).setPrefix(rank.getTag(true, true) + ChatColor.RESET + " "); } scoreboard.register(ArcadeScoreboardLine.PLAYERS_SPACER) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java index 262acbb45..dbfdbd404 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java @@ -630,7 +630,7 @@ public abstract class LobbyManager implements Listener { team.removeEntry(player.getName()); } - scoreboard.getHandle().getTeam(rank.Name).addEntry(player.getName()); + scoreboard.getHandle().getTeam(rank.ScoreboardTag).addEntry(player.getName()); } } @@ -647,7 +647,7 @@ public abstract class LobbyManager implements Listener rank = _manager.GetClients().Get(player).getRealOrDisguisedRank(); } - String rankName = rank.Name; + String rankName = rank.ScoreboardTag; if (player != null) { boolean rankIsUltra = !rank.has(Rank.ULTRA) && @@ -655,7 +655,7 @@ public abstract class LobbyManager implements Listener if (rankIsUltra) { - rankName = Rank.ULTRA.Name; + rankName = Rank.ULTRA.ScoreboardTag; } }