Remove all reference to jcommands and use jewelcli.
This commit also cleans up the jail command to be quicker as the old way I was doing it just didn't work nor was it good to go for production. This method also utilizes the CommandInfo's pattern to match subcommands, like it was meant to be used for. Completely untested.
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
package com.graywolf336.jail.command.commands.jewels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.lexicalscope.jewel.cli.Option;
|
||||
|
||||
public interface Jailing {
|
||||
|
||||
@Option(longName={"player", "pl"}, shortName="p", description = "the player's name")
|
||||
public String getPlayer();
|
||||
|
||||
@Option(longName={"time", "length"}, shortName="t", description = "the amount of time")
|
||||
public String getTime();
|
||||
|
||||
@Option(longName={"jail", "prison"}, shortName="j", description = "the jail")
|
||||
public String getJail();
|
||||
|
||||
@Option(longName={"cell"}, shortName="c", description = "the cell")
|
||||
public String getCell();
|
||||
|
||||
@Option(longName={"muted", "canttalk"}, shortName="m", description = "whether the prisoner is muted or not")
|
||||
public boolean isMuted();
|
||||
|
||||
@Option(longName={"reason"}, shortName="r", description = "the reason this player is being jailed")
|
||||
public List<String> getReason();
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.graywolf336.jail.command.commands.jewels;
|
||||
|
||||
import com.lexicalscope.jewel.cli.Option;
|
||||
|
||||
public interface Transfer {
|
||||
|
||||
@Option(longName={"player", "pl"}, shortName="p", description = "the player's name")
|
||||
public String getPlayer();
|
||||
|
||||
@Option(longName={"jail", "prison"}, shortName="j", description = "the jail")
|
||||
public String getJail();
|
||||
|
||||
@Option(longName={"cell"}, shortName="c", description = "the cell")
|
||||
public String getCell();
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
package com.graywolf336.jail.command.commands.params;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
|
||||
/**
|
||||
* Contains all the parameters from the jail command.
|
||||
*
|
||||
* @author graywolf336
|
||||
* @version 1.0.1
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class Jailing {
|
||||
@Parameter
|
||||
private List<String> parameters = new ArrayList<String>();
|
||||
|
||||
@Parameter(names = { "-player", "-p", "-prisoner" }, description = "The name of the player we are jailing.")
|
||||
private String player = "";
|
||||
|
||||
@Parameter(names = { "-time", "-t", "-length" }, description = "The length of the jailing sentence.")
|
||||
private String time = "";
|
||||
|
||||
@Parameter(names = { "-jail", "-j", "-prison" }, description = "The jail we are sending the player to.")
|
||||
private String jail = "";
|
||||
|
||||
@Parameter(names = { "-cell", "-c"}, description = "The cell in the jail we are sending them to.")
|
||||
private String cell = "";
|
||||
|
||||
@Parameter(names = { "-muted", "-m" }, description = "Whether they can talk or not.")
|
||||
private boolean muted = false;
|
||||
|
||||
@Parameter(names = { "-reason", "-r" }, description = "The reason this player is being jailed for.", variableArity = true)
|
||||
private List<String> reason = new ArrayList<String>();
|
||||
|
||||
/** Returns the parameters. */
|
||||
public List<String> parameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/** Returns the player parameter. */
|
||||
public String player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/** Returns the time parameter. */
|
||||
public String time() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/** Sets the time parameter. */
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
/** Returns the jail parameter. */
|
||||
public String jail() {
|
||||
return jail;
|
||||
}
|
||||
|
||||
/** Sets the jail parameter. */
|
||||
public void setJail(String jail) {
|
||||
this.jail = jail;
|
||||
}
|
||||
|
||||
/** Returns the cell parameter. */
|
||||
public String cell() {
|
||||
return cell;
|
||||
}
|
||||
|
||||
/** Returns the muted parameter. */
|
||||
public boolean muted() {
|
||||
return muted;
|
||||
}
|
||||
|
||||
/** Sets the muted parameter. */
|
||||
public void setMuted(boolean muted) {
|
||||
this.muted = muted;
|
||||
}
|
||||
|
||||
/** Returns the reason compressed into one string. */
|
||||
public String reason() {
|
||||
String r = "";
|
||||
|
||||
for(String s : reason) {
|
||||
if(r.isEmpty()) {
|
||||
r = s;
|
||||
}else {
|
||||
r += " " + s;
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/** Sets the reason. */
|
||||
public void setReason(String r) {
|
||||
String[] rs = r.split(" ");
|
||||
|
||||
for(String s : rs) {
|
||||
reason.add(s);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package com.graywolf336.jail.command.commands.params;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
|
||||
public class Transferring {
|
||||
@Parameter
|
||||
private List<String> parameters = new ArrayList<String>();
|
||||
|
||||
@Parameter(names = { "-player", "-p", "-prisoner" }, description = "The name of the player we are jailing.")
|
||||
private String player = "";
|
||||
|
||||
@Parameter(names = { "-jail", "-j", "-prison" }, description = "The jail we are sending the player to.")
|
||||
private String jail = "";
|
||||
|
||||
@Parameter(names = { "-cell", "-c"}, description = "The cell in the jail we are sending them to.")
|
||||
private String cell = "";
|
||||
|
||||
/** Returns the parameters. */
|
||||
public List<String> parameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/** Returns the player parameter. */
|
||||
public String player() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/** Returns the jail parameter. */
|
||||
public String jail() {
|
||||
return jail;
|
||||
}
|
||||
|
||||
/** Sets the jail parameter. */
|
||||
public void setJail(String jail) {
|
||||
this.jail = jail;
|
||||
}
|
||||
|
||||
/** Returns the cell parameter. */
|
||||
public String cell() {
|
||||
return cell;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user