Add a command option to force jailing never played
This commit is contained in:
parent
c22f1ec22d
commit
93d8b88bb1
@ -8,6 +8,9 @@ public interface Jailing {
|
|||||||
|
|
||||||
@Option(longName={"player", "pl"}, shortName="p", description = "the player's name")
|
@Option(longName={"player", "pl"}, shortName="p", description = "the player's name")
|
||||||
public String getPlayer();
|
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")
|
@Option(longName={"time", "length"}, shortName="t", description = "the amount of time")
|
||||||
public String getTime();
|
public String getTime();
|
||||||
@ -30,6 +33,7 @@ public interface Jailing {
|
|||||||
@Option(longName={"reason"}, shortName="r", description = "the reason this player is being jailed")
|
@Option(longName={"reason"}, shortName="r", description = "the reason this player is being jailed")
|
||||||
public List<String> getReason();
|
public List<String> getReason();
|
||||||
|
|
||||||
|
public boolean isForce();
|
||||||
public boolean isInfinite();
|
public boolean isInfinite();
|
||||||
public boolean isTime();
|
public boolean isTime();
|
||||||
public boolean isJail();
|
public boolean isJail();
|
||||||
|
@ -39,7 +39,7 @@ import com.lexicalscope.jewel.cli.CliFactory;
|
|||||||
)
|
)
|
||||||
public class JailCommand implements Command {
|
public class JailCommand implements Command {
|
||||||
private static final String noJailPermission = "jail.cantbejailed";
|
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:
|
* Executes the command. Checks the following:
|
||||||
@ -101,7 +101,7 @@ public class JailCommand implements Command {
|
|||||||
//TODO: Make this whole jail command non-blocking
|
//TODO: Make this whole jail command non-blocking
|
||||||
OfflinePlayer of = jm.getPlugin().getServer().getOfflinePlayer(params.getPlayer());
|
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()));
|
sender.sendMessage(Lang.PLAYERHASNEVERPLAYEDBEFORE.get(params.getPlayer()));
|
||||||
return true;
|
return true;
|
||||||
}else {
|
}else {
|
||||||
|
Loading…
Reference in New Issue
Block a user