mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fixed a neophyte bug
Custom login messages would be the same for anyone who logs in after the player with the same rank
This commit is contained in:
parent
75bc17cd8f
commit
34d15d4c96
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Tue Dec 03 14:18:20 CET 2013
|
||||
build.number=666
|
||||
#Tue Dec 03 20:42:40 CET 2013
|
||||
build.number=667
|
||||
|
@ -691,7 +691,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
if (impostor || TFM_SuperadminList.isUserSuperadmin(player))
|
||||
{
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.fromSender(player).getLoginMessage());
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
|
||||
|
||||
if (impostor)
|
||||
{
|
||||
@ -720,7 +720,7 @@ public class TFM_PlayerListener implements Listener
|
||||
}
|
||||
else if (TFM_Util.DEVELOPERS.contains(player.getName()))
|
||||
{
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.fromSender(player).getLoginMessage());
|
||||
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
|
||||
}
|
||||
|
||||
if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public enum TFM_PlayerRank
|
||||
{
|
||||
DEVELOPER(ChatColor.DARK_PURPLE + "Developer", ChatColor.DARK_PURPLE + "[Dev]"),
|
||||
IMPOSTOR("an " + ChatColor.YELLOW + ChatColor.UNDERLINE + "Impostor", ChatColor.YELLOW.toString() + ChatColor.UNDERLINE + "[IMP]"),
|
||||
NON_OP("a " + ChatColor.GREEN + "Non-OP", ChatColor.GREEN.toString()),
|
||||
OP("an " + ChatColor.RED + "OP", ChatColor.RED + "[OP]"),
|
||||
@ -24,6 +25,32 @@ public enum TFM_PlayerRank
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public static String getLoginMessage(CommandSender sender)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
return fromSender(sender).getLoginMessage();
|
||||
}
|
||||
|
||||
final TFM_Superadmin entry = TFM_SuperadminList.getAdminEntry((Player) sender);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
return fromSender(sender).getLoginMessage();
|
||||
}
|
||||
|
||||
final String loginMessage = entry.getCustomLoginMessage();
|
||||
|
||||
if (loginMessage != null && !loginMessage.isEmpty())
|
||||
{
|
||||
return ChatColor.translateAlternateColorCodes('&', loginMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
return fromSender(sender).getLoginMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public static TFM_PlayerRank fromSender(CommandSender sender)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
@ -36,6 +63,12 @@ public enum TFM_PlayerRank
|
||||
return IMPOSTOR;
|
||||
}
|
||||
|
||||
if (DEVELOPERS.contains(sender.getName()))
|
||||
{
|
||||
return DEVELOPER;
|
||||
}
|
||||
|
||||
|
||||
final TFM_Superadmin entry = TFM_SuperadminList.getAdminEntry((Player) sender);
|
||||
|
||||
final TFM_PlayerRank rank;
|
||||
@ -59,20 +92,6 @@ public enum TFM_PlayerRank
|
||||
{
|
||||
rank = SUPER;
|
||||
}
|
||||
|
||||
final String loginMessage = entry.getCustomLoginMessage();
|
||||
|
||||
if (loginMessage != null && !loginMessage.isEmpty())
|
||||
{
|
||||
rank.setLoginMessage(ChatColor.translateAlternateColorCodes('&', loginMessage));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEVELOPERS.contains(sender.getName()))
|
||||
{
|
||||
rank.setLoginMessage("a " + ChatColor.DARK_PURPLE + "Developer");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -85,18 +104,7 @@ public enum TFM_PlayerRank
|
||||
rank = NON_OP;
|
||||
}
|
||||
|
||||
if (DEVELOPERS.contains(sender.getName()))
|
||||
{
|
||||
rank.setLoginMessage("a " + ChatColor.DARK_PURPLE + "Developer");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (DEVELOPERS.contains(sender.getName()))
|
||||
{
|
||||
rank.setPrefix(ChatColor.DARK_PURPLE + "[Dev]");
|
||||
}
|
||||
|
||||
return rank;
|
||||
}
|
||||
|
||||
@ -105,16 +113,6 @@ public enum TFM_PlayerRank
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix)
|
||||
{
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public void setLoginMessage(String rank)
|
||||
{
|
||||
this.loginMessage = rank;
|
||||
}
|
||||
|
||||
public String getLoginMessage()
|
||||
{
|
||||
return loginMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user