fix titles not showing up in login messages

This commit is contained in:
ZeroEpoch1969 2019-08-11 14:12:53 -07:00
parent fb336f27bb
commit 841e354d35
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
2 changed files with 24 additions and 2 deletions

View File

@ -150,7 +150,7 @@ public class Command_myadmin extends FreedomCommand
FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false); FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
target.setLoginMessage(msg); target.setLoginMessage(msg);
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: "); msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
msg("> " + ChatColor.AQUA + (msg.contains("%name%") ? "" : target.getName() + " is ") + FUtil.colorize(msg).replace("%name%", targetPlayer.getName()).replace("%rank%", target.getRank().getName()).replace("%coloredrank%", target.getRank().getColoredName())); msg("> " + ChatColor.AQUA + (msg.contains("%name%") ? "" : target.getName() + " is ") + FUtil.colorize(msg).replace("%name%", targetPlayer.getName()).replace("%rank%", plugin.rm.getDisplay(target).getName()).replace("%coloredrank%", plugin.rm.getDisplay(target).getColoredName()));
plugin.al.save(); plugin.al.save();
plugin.al.updateTables(); plugin.al.updateTables();
return true; return true;

View File

@ -81,6 +81,28 @@ public class RankManager extends FreedomService
return getRank(player); return getRank(player);
} }
public Displayable getDisplay(Admin admin)
{
// If the player's an owner, display that
if (ConfigEntry.SERVER_OWNERS.getList().contains(admin.getName()))
{
return Title.OWNER;
}
// Developers always show up
if (FUtil.DEVELOPERS.contains(admin.getName()))
{
return Title.DEVELOPER;
}
if (ConfigEntry.SERVER_EXECUTIVES.getList().contains(admin.getName()))
{
return Title.EXECUTIVE;
}
return admin.getRank();
}
public Rank getRank(CommandSender sender) public Rank getRank(CommandSender sender)
{ {
if (sender instanceof Player) if (sender instanceof Player)
@ -218,7 +240,7 @@ public class RankManager extends FreedomService
Admin admin = plugin.al.getAdmin(player); Admin admin = plugin.al.getAdmin(player);
if (admin.hasLoginMessage()) if (admin.hasLoginMessage())
{ {
loginMsg = ChatUtils.colorize(admin.getLoginMessage()).replace("%rank%", admin.getRank().getName()).replace("%coloredrank%", admin.getRank().getColoredName()); loginMsg = ChatUtils.colorize(admin.getLoginMessage()).replace("%rank%", plugin.rm.getDisplay(admin).getName()).replace("%coloredrank%", plugin.rm.getDisplay(admin).getColoredName());
} }
} }
FUtil.bcastMsg(ChatColor.AQUA + (loginMsg.contains("%name%") ? "" : player.getName() + " is ") + FUtil.colorize(loginMsg).replace("%name%", player.getName())); FUtil.bcastMsg(ChatColor.AQUA + (loginMsg.contains("%name%") ? "" : player.getName() + " is ") + FUtil.colorize(loginMsg).replace("%name%", player.getName()));