No longer require true/false for the -m.
This commit is contained in:
parent
500c2abd51
commit
5f2fcd9027
@ -27,7 +27,8 @@ public class JailCommand implements Command {
|
|||||||
try {
|
try {
|
||||||
new JCommander(params, args);
|
new JCommander(params, args);
|
||||||
}catch(ParameterException e) {
|
}catch(ParameterException e) {
|
||||||
return false;
|
sender.sendMessage(e.getMessage());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import com.beust.jcommander.Parameter;
|
|||||||
* Contains all the parameters from the jail command.
|
* Contains all the parameters from the jail command.
|
||||||
*
|
*
|
||||||
* @author graywolf336
|
* @author graywolf336
|
||||||
* @version 1.0.0
|
* @version 1.0.1
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
public class JailParameters {
|
public class JailParameters {
|
||||||
@ -28,7 +28,7 @@ public class JailParameters {
|
|||||||
@Parameter(names = { "-c", "-cell" }, description = "The cell in the jail we are sending them to.")
|
@Parameter(names = { "-c", "-cell" }, description = "The cell in the jail we are sending them to.")
|
||||||
private String cell = "";
|
private String cell = "";
|
||||||
|
|
||||||
@Parameter(names = { "-m", "-muted" }, description = "Whether they can talk or not.", arity = 1)
|
@Parameter(names = { "-m", "-muted" }, description = "Whether they can talk or not.")
|
||||||
private boolean muted = false;
|
private boolean muted = false;
|
||||||
|
|
||||||
@Parameter(names = { "-r", "-reason" }, description = "The reason this player is being jailed for.", variableArity = true)
|
@Parameter(names = { "-r", "-reason" }, description = "The reason this player is being jailed for.", variableArity = true)
|
||||||
|
@ -13,14 +13,14 @@ public class TestCommandParams {
|
|||||||
public void TestJailCommand() {
|
public void TestJailCommand() {
|
||||||
JailParameters jail = new JailParameters();
|
JailParameters jail = new JailParameters();
|
||||||
//"/jail [-p name] (-t time) (-j JailName) (-c CellName) (-m Muted) (-r A reason for jailing)"
|
//"/jail [-p name] (-t time) (-j JailName) (-c CellName) (-m Muted) (-r A reason for jailing)"
|
||||||
String[] params = { "-p", "graywolf336", "-t", "30", "-j", "den", "-c", "cell_01", "-m", "true", "-r", "He", "was", "a", "very", "bad", "boy." };
|
String[] params = { "-p", "graywolf336", "-t", "30", "-j", "den", "-c", "cell_01", "-m", "-r", "He", "was", "a", "very", "bad", "boy." };
|
||||||
new JCommander(jail, params);
|
new JCommander(jail, params);
|
||||||
|
|
||||||
Assert.assertEquals("The player is not the one we provided.", jail.player(), "graywolf336");
|
Assert.assertEquals("The player is not the one we provided.", "graywolf336", jail.player());
|
||||||
Assert.assertEquals("The time doesn't match what we gave.", jail.time(), "30");
|
Assert.assertEquals("The time doesn't match what we gave.", "30", jail.time());
|
||||||
Assert.assertEquals("The jail is not the one we specified.", jail.jail(), "den");
|
Assert.assertEquals("The jail is not the one we specified.", "den", jail.jail());
|
||||||
Assert.assertEquals("The cell doesn't match up.", jail.cell(), "cell_01");
|
Assert.assertEquals("The cell doesn't match up.", "cell_01", jail.cell());
|
||||||
Assert.assertEquals("The muted is not true.", jail.muted(), true);
|
Assert.assertEquals("The muted is false.", true, jail.muted());
|
||||||
Assert.assertEquals("Jailed reason didn't match up.", jail.reason(), "He was a very bad boy.");
|
Assert.assertEquals("Jailed reason didn't match up.", "He was a very bad boy.", jail.reason());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user