mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-06 02:51:32 +01:00
Add default ban reason for tempban reason.
This commit is contained in:
parent
71936cfe22
commit
c54e9b5dba
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user