summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2014-06-14 22:06:26 +0100
committerKHobbits <rob@khobbits.co.uk>2014-06-14 22:06:26 +0100
commitc54e9b5dbac119c124d46665640c0bff413eaa4a (patch)
tree34bdcf8ee580c73bd7ed2638ef101c540be9b274
parent71936cfe22bf2e169393cc14c209c49d5de10d04 (diff)
downloadEssentials-c54e9b5dbac119c124d46665640c0bff413eaa4a.tar
Essentials-c54e9b5dbac119c124d46665640c0bff413eaa4a.tar.gz
Essentials-c54e9b5dbac119c124d46665640c0bff413eaa4a.tar.lz
Essentials-c54e9b5dbac119c124d46665640c0bff413eaa4a.tar.xz
Essentials-c54e9b5dbac119c124d46665640c0bff413eaa4a.zip
Add default ban reason for tempban reason.
-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);