Create Rank ScoreboardTag to fix Name collision

This commit is contained in:
samczsun 2016-12-06 14:50:56 -05:00 committed by cnr
parent 9234c7a7d5
commit 20697982e7
6 changed files with 51 additions and 48 deletions

View File

@ -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 Administrators 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 <message>") + "."),
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 <message>") + "."),
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 <message>") + "."),
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 <message>") + "."),
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 Administrators 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 <message>") + "."),
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 <message>") + "."),
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 <message>") + "."),
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 <message>") + "."),
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()

View File

@ -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);

View File

@ -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);

View File

@ -282,9 +282,9 @@ public class HubManager extends MiniClientPlugin<HubClient> 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<HubClient> 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<HubClient> 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<HubClient> implements IChatMess
for (MineplexScoreboard scoreboard : getScoreboards().values())
{
scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().Name).removeEntry(playerName);
scoreboard.getHandle().getTeam(client.getRealOrDisguisedRank().ScoreboardTag).removeEntry(playerName);
}
}

View File

@ -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)

View File

@ -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;
}
}