Add a method to jail someone forever, resolves #49.
Include -i in the command and the player will be jailed forever.
This commit is contained in:
@ -11,6 +11,9 @@ public interface Jailing {
|
||||
|
||||
@Option(longName={"time", "length"}, shortName="t", description = "the amount of time")
|
||||
public String getTime();
|
||||
|
||||
@Option(longName={"forever", "eternity", "infinite"}, shortName="i", description = "jail the player for eternity")
|
||||
public boolean getInfinite();
|
||||
|
||||
@Option(longName={"jail", "prison"}, shortName="j", description = "the jail")
|
||||
public String getJail();
|
||||
@ -27,6 +30,7 @@ public interface Jailing {
|
||||
@Option(longName={"reason"}, shortName="r", description = "the reason this player is being jailed")
|
||||
public List<String> getReason();
|
||||
|
||||
public boolean isInfinite();
|
||||
public boolean isTime();
|
||||
public boolean isJail();
|
||||
public boolean isCell();
|
||||
|
@ -83,17 +83,21 @@ public class JailCommand implements Command {
|
||||
//from the config and if that isn't there then we default to thirty minutes.
|
||||
Long time = 10L;
|
||||
try {
|
||||
if(!params.isTime()) {
|
||||
time = Util.getTime(jm.getPlugin().getConfig().getString(Settings.DEFAULTTIME.getPath(), "30m"));
|
||||
}else if(params.getTime() == String.valueOf(-1)) {
|
||||
time = -1L;
|
||||
}else {
|
||||
if(params.isTime()) {
|
||||
time = Util.getTime(params.getTime());
|
||||
}else {
|
||||
time = Util.getTime(jm.getPlugin().getConfig().getString(Settings.DEFAULTTIME.getPath(), "30m"));
|
||||
}
|
||||
}catch(Exception e) {
|
||||
sender.sendMessage(Lang.NUMBERFORMATINCORRECT.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
//Check if they provided the infinite argument
|
||||
//if so, then set the time jailed forever
|
||||
if(params.isInfinite()) {
|
||||
time = -1L;
|
||||
}
|
||||
|
||||
//Check the jail params. If it is empty, let's get the default jail
|
||||
//from the config. If that is nearest, let's make a call to getting the nearest jail to
|
||||
|
Reference in New Issue
Block a user