diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/ISettings.java | 2 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Settings.java | 6 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandtempban.java | 11 | ||||
-rw-r--r-- | Essentials/src/config.yml | 4 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_cs.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_da.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_de.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_es.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fi.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fr.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_it.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_nl.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_pl.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_pt.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_se.properties | 1 |
17 files changed, 35 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index fb0073c8a..1ad9b0207 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -183,4 +183,6 @@ public interface ISettings extends IConf public int getMailsPerMinute(); public void setEssentialsChatActive(boolean b); + + long getMaxTempban(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 416602c4d..46f7ee770 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -982,4 +982,10 @@ public class Settings implements ISettings { return mailsPerMinute; } + + @Override + public long getMaxTempban() + { + return config.getLong("max-tempban-time", -1); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 0549e9c0d..4ac2db89c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -4,6 +4,8 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.util.Calendar; +import java.util.GregorianCalendar; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -35,7 +37,7 @@ public class Commandtempban extends EssentialsCommand } else { - if (user.isAuthorized("essentials.tempban.exempt")) + if (user.isAuthorized("essentials.tempban.exempt") && sender instanceof Player) { sender.sendMessage(_("tempbanExempt")); return; @@ -44,6 +46,13 @@ public class Commandtempban extends EssentialsCommand final String time = getFinalArg(args, 1); final long banTimestamp = Util.parseDateDiff(time, true); + final long max = ess.getSettings().getMaxTempban(); + if(max != 0 && banTimestamp - GregorianCalendar.getInstance().getTimeInMillis() > max * 1000 && ess.getUser(sender).isAuthorized("essentials.tempban.unlimited")) + { + sender.sendMessage(_("oversizedTempban")); + throw new NoChargeException(); + } + final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp), senderName); user.setBanReason(banReason); diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index a766e0549..e428354a8 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -351,6 +351,10 @@ sethome-multiple: # Set to 0 for no timeout tpa-accept-cancellation: 0 +# Set the maximum time /tempban can be used for in seconds. +# Set to -1 to disable, and essentials.tempban.unlimited can be used to override. +max-tempban-time: -1 + ############################################################ # +------------------------------------------------------+ # # | EssentialsEco | # diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 8a17513cf..a84e9cdab 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 5cc095f15..dca74c0e0 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -469,3 +469,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 6beff781a..e9099f3cf 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 4db624c6a..35f584f52 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 8a17513cf..a84e9cdab 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 8d0ad7892..c3bbfb80c 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index fef0aeb78..ceb44335e 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index e5cfd4975..bed11e666 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index f24899599..9afb93c4d 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 0c4fd2cd0..5ec926da5 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 804784f19..a3c27652c 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 4c039bc1c..5aa293a73 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index b6017786b..3a184f675 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. |