require ranks to be displayed in login messgaes

This commit is contained in:
ZeroEpoch1969 2019-08-06 21:33:12 -07:00
parent 503a8d5b4f
commit 5085b90727
No known key found for this signature in database
GPG key ID: A7BAB4E14F089CF3
2 changed files with 7 additions and 2 deletions

View file

@ -142,10 +142,15 @@ public class Command_myadmin extends FreedomCommand
}
String msg = StringUtils.join(args, " ", 1, args.length);
if (!msg.contains("%rank%") && !msg.contains("%coloredrank%"))
{
msg("Your login message must contain your rank. User either %rank% or %coloredrank% to specify where you want the rank", ChatColor.RED);
return true;
}
FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
target.setLoginMessage(msg);
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()));
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()));
plugin.al.save();
plugin.al.updateTables();
return true;

View file

@ -218,7 +218,7 @@ public class RankManager extends FreedomService
Admin admin = plugin.al.getAdmin(player);
if (admin.hasLoginMessage())
{
loginMsg = ChatUtils.colorize(admin.getLoginMessage());
loginMsg = ChatUtils.colorize(admin.getLoginMessage()).replace("%rank%", admin.getRank().getName()).replace("%coloredrank%", admin.getRank().getColoredName());
}
}
FUtil.bcastMsg(ChatColor.AQUA + (loginMsg.contains("%name%") ? "" : player.getName() + " is ") + FUtil.colorize(loginMsg).replace("%name%", player.getName()));