1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-09-25 13:49:12 +02:00

Add tempban limit config option with matching exempt node. Console override to tempban.exempt

This commit is contained in:
Chris Ward
2013-02-02 18:45:32 +11:00
parent 5996d645f4
commit 7816916a8e
5 changed files with 30 additions and 1 deletions

View File

@@ -367,6 +367,7 @@ teleporting=\u00a76Teleporting...
teleportingPortal=\u00a76Teleporting via portal.
tempBanned=Temporarily banned from server for {0}
tempbanExempt=\u00a74You may not tempban that player.
tempbanOversized=\u00a74You may not ban a player for this period of time.
thunder= \u00a76You\u00a7c {0} \u00a76thunder in your world.
thunderDuration=\u00a76You\u00a7c {0} \u00a76thunder in your world for\u00a7c {1} \u00a76seconds.
timeBeforeHeal=\u00a76Time before next heal:\u00a7c {0}

View File

@@ -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();

View File

@@ -100,6 +100,7 @@ public enum Permissions implements IPermission
TELEPORT_TIMER_BYPASS,
TELEPORT_TIMER_MOVE,
TEMPBAN_EXEMPT,
TEMPBAN_UNLIMITED,
TEMPBAN_OFFLINE,
TIME_SET,
TOGGLEJAIL_OFFLINE,

View File

@@ -23,6 +23,7 @@ public class Commands implements StorageObject
private SocialSpy socialspy = new SocialSpy();
private Spawnmob spawnmob = new Spawnmob();
private Teleport teleport = new Teleport();
private Tempban tempban = new Tempban();
private Speed speed = new Speed();
@ListType
@Comment(

View File

@@ -0,0 +1,17 @@
package net.ess3.settings.commands;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.ess3.storage.Comment;
import net.ess3.storage.StorageObject;
@Data
@EqualsAndHashCode(callSuper = false)
public class Tempban implements StorageObject
{
@Comment({
"Set to the maximum time in seconds a player can be tempbanned for.",
"Set to -1 to disable, and override with essentials.tempban.unlimited"
})
private long maxTempbanTime = -1;
}