summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/commands/Commandtempban.java
diff options
context:
space:
mode:
authorChris Ward <chris@chrisgward.com>2013-02-02 18:45:32 +1100
committerChris Ward <chris@chrisgward.com>2013-02-02 18:45:32 +1100
commit7816916a8e88e25af146f107c0253f143debb62d (patch)
tree5463d0893684fa735a6d7ad02b65dcfa2373dc3a /Essentials/src/net/ess3/commands/Commandtempban.java
parent5996d645f43edb0cd8ef2786626f6aca2c078def (diff)
downloadEssentials-7816916a8e88e25af146f107c0253f143debb62d.tar
Essentials-7816916a8e88e25af146f107c0253f143debb62d.tar.gz
Essentials-7816916a8e88e25af146f107c0253f143debb62d.tar.lz
Essentials-7816916a8e88e25af146f107c0253f143debb62d.tar.xz
Essentials-7816916a8e88e25af146f107c0253f143debb62d.zip
Add tempban limit config option with matching exempt node. Console override to tempban.exempt
Diffstat (limited to 'Essentials/src/net/ess3/commands/Commandtempban.java')
-rw-r--r--Essentials/src/net/ess3/commands/Commandtempban.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandtempban.java b/Essentials/src/net/ess3/commands/Commandtempban.java
index 3bd267095..13b72f92c 100644
--- a/Essentials/src/net/ess3/commands/Commandtempban.java
+++ b/Essentials/src/net/ess3/commands/Commandtempban.java
@@ -10,6 +10,8 @@ import net.ess3.utils.DateUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import java.util.Calendar;
+
public class Commandtempban extends EssentialsCommand
{
@@ -31,7 +33,7 @@ public class Commandtempban extends EssentialsCommand
}
else
{
- if (Permissions.TEMPBAN_EXEMPT.isAuthorized(user))
+ if (Permissions.TEMPBAN_EXEMPT.isAuthorized(user) && sender instanceof Player)
{
sender.sendMessage(_("tempbanExempt"));
return;
@@ -40,6 +42,13 @@ public class Commandtempban extends EssentialsCommand
final String time = getFinalArg(args, 1);
final long banTimestamp = DateUtil.parseDateDiff(time, true);
+ final long max = ess.getSettings().getData().getCommands().getTempban().getMaxTempbanTime();
+ if(max != -1 && banTimestamp - Calendar.getInstance().getTimeInMillis() > max && !Permissions.TEMPBAN_UNLIMITED.isAuthorized(sender))
+ {
+ sender.sendMessage(_("tempbanOversized"));
+ return;
+ }
+
final String banReason = _("tempBanned", DateUtil.formatDateDiff(banTimestamp));
final Ban ban = new Ban();
final UserData userData = user.getData();