some shit to do with the command manager, again
Signed-off-by: deepCurse <leverplays@gmail.com>
This commit is contained in:
parent
22837cf438
commit
cda31cfaa0
9 changed files with 237 additions and 108 deletions
|
@ -1,5 +1,7 @@
|
|||
package pkg.deepCurse.nopalmo.manager;
|
||||
|
||||
import pkg.deepCurse.nopalmo.command.CommandInterface;
|
||||
|
||||
public class Argument {
|
||||
|
||||
// README
|
||||
|
@ -22,6 +24,11 @@ public class Argument {
|
|||
private Argument[] subArgs = null;
|
||||
private boolean requiresPrefix = false;
|
||||
private Boolean isWildcard;
|
||||
private int position = -1;
|
||||
private String wildCardString = null;
|
||||
private boolean autoStartRunnable = false;
|
||||
private boolean skipOriginalTaskOnRunnable = false;
|
||||
private RunnableArg runnableArg = null;
|
||||
|
||||
public static final String argumentPrefix = "-"; // This exists for the sole reason of customization and will
|
||||
// generally not change, ever, its recommended you keep it to
|
||||
|
@ -54,6 +61,7 @@ public class Argument {
|
|||
this.requiredArgs = requiredArgs;
|
||||
this.argName = argName;
|
||||
this.subArgs = subArgs;
|
||||
this.runnableArg = runnableArg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,6 +86,7 @@ public class Argument {
|
|||
*/
|
||||
public Argument(String argName, RunnableArg runnableArg) {
|
||||
this.argName = argName;
|
||||
this.runnableArg = runnableArg;
|
||||
}
|
||||
|
||||
public int getRequiredArgs() {
|
||||
|
@ -113,6 +122,11 @@ public class Argument {
|
|||
}
|
||||
|
||||
public Argument setIsWildcard(Boolean bool) {
|
||||
|
||||
if (this.position<=-1) {
|
||||
throw new IllegalArgumentException("Cannot create a wildcard without a position; set a position first");
|
||||
}
|
||||
|
||||
this.isWildcard = bool;
|
||||
return this;
|
||||
}
|
||||
|
@ -125,10 +139,50 @@ public class Argument {
|
|||
return this.requiresPrefix;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public Argument setPosition(int position) {
|
||||
this.position = position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface RunnableArg {
|
||||
|
||||
public void run(Argument[] argArray);
|
||||
public void run(CommandBlob blob);
|
||||
|
||||
}
|
||||
|
||||
public Argument setWildCardString(String wildCardString) {
|
||||
this.wildCardString = wildCardString;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWildCardString() {
|
||||
return wildCardString;
|
||||
}
|
||||
|
||||
public Argument setAutoStartRunnable(boolean bool) {
|
||||
this.autoStartRunnable = bool;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isAutoStartRunnable() {
|
||||
return autoStartRunnable;
|
||||
}
|
||||
|
||||
public boolean isSkipOriginalTaskOnRunnable() {
|
||||
return skipOriginalTaskOnRunnable;
|
||||
}
|
||||
|
||||
public Argument setSkipOriginalTaskOnRunnable(boolean skipOriginalTaskOnRunnable) {
|
||||
this.skipOriginalTaskOnRunnable = skipOriginalTaskOnRunnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunnableArg getRunnableArg() {
|
||||
return runnableArg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue