summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandtempban.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtempban.java8
1 files changed, 7 insertions, 1 deletions
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);