Add a command option to force jailing never played

This commit is contained in:
graywolf336 2015-06-30 12:48:33 -05:00
parent c22f1ec22d
commit 93d8b88bb1
2 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,9 @@ public interface Jailing {
@Option(longName={"player", "pl"}, shortName="p", description = "the player's name")
public String getPlayer();
@Option(longName={"force"}, shortName="f", description = "force jailing someone who has never been online")
public boolean getForce();
@Option(longName={"time", "length"}, shortName="t", description = "the amount of time")
public String getTime();
@ -30,6 +33,7 @@ public interface Jailing {
@Option(longName={"reason"}, shortName="r", description = "the reason this player is being jailed")
public List<String> getReason();
public boolean isForce();
public boolean isInfinite();
public boolean isTime();
public boolean isJail();

View File

@ -39,7 +39,7 @@ import com.lexicalscope.jewel.cli.CliFactory;
)
public class JailCommand implements Command {
private static final String noJailPermission = "jail.cantbejailed";
private List<String> commands = Arrays.asList(new String[] { "p", "t", "i", "j", "c", "a", "m", "r" });
private List<String> commands = Arrays.asList(new String[] { "p", "t", "i", "j", "c", "a", "m", "r", "f" });
/*
* Executes the command. Checks the following:
@ -101,7 +101,7 @@ public class JailCommand implements Command {
//TODO: Make this whole jail command non-blocking
OfflinePlayer of = jm.getPlugin().getServer().getOfflinePlayer(params.getPlayer());
if(!of.hasPlayedBefore() && !jm.getPlugin().getConfig().getBoolean(Settings.ALLOWJAILINGNEVERPLAYEDBEFOREPLAYERS.getPath())) {
if(!of.hasPlayedBefore() && !jm.getPlugin().getConfig().getBoolean(Settings.ALLOWJAILINGNEVERPLAYEDBEFOREPLAYERS.getPath()) && !params.isForce()) {
sender.sendMessage(Lang.PLAYERHASNEVERPLAYEDBEFORE.get(params.getPlayer()));
return true;
}else {