From c54e9b5dbac119c124d46665640c0bff413eaa4a Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 14 Jun 2014 22:06:26 +0100 Subject: Add default ban reason for tempban reason. --- .../src/com/earth2me/essentials/commands/Commandtempban.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 2ec7d9962..478c2c257 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -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"))) @@ -52,6 +53,11 @@ public class Commandtempban extends EssentialsCommand sender.sendMessage(tl("oversizedTempban")); 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); -- cgit v1.2.3