Add default ban reason for tempban reason.

This commit is contained in:
KHobbits 2014-06-14 22:06:26 +01:00
parent 71936cfe22
commit c54e9b5dba

View File

@ -44,7 +44,8 @@ public class Commandtempban extends EssentialsCommand
}
final String time = getFinalArg(args, 1);
final long banTimestamp = DateUtil.parseDateDiff(time, true);
final String stringDregs = DateUtil.removeTimePattern(time);
String stringDregs = DateUtil.removeTimePattern(time);
final long maxBanLength = ess.getSettings().getMaxTempban() * 1000;
if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength)
&& sender.isPlayer() && !(ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.unlimited")))
@ -53,6 +54,11 @@ public class Commandtempban extends EssentialsCommand
throw new NoChargeException();
}
if (stringDregs.length() < 2)
{
stringDregs = tl("defaultBanReason");
}
final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
final String banReason = tl("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName, stringDregs);
user.setBanReason(banReason);