initial commit

This commit is contained in:
Sen 2025-03-11 00:23:54 +01:00 committed by Sen
parent 3c9ee26b06
commit 22186c33b9
1458 changed files with 282792 additions and 0 deletions

View file

@ -0,0 +1,45 @@
package game.command;
import java.util.Map;
import game.collect.Lists;
import game.collect.Maps;
public abstract class ScriptExecutable implements Executable {
private final String name;
private final Map<String, Parameter> parameters = Maps.newHashMap();
private int parPos = 0;
private boolean parReq = true;
protected ScriptExecutable(String name) {
this.name = name;
}
protected ScriptExecutable setParamsOptional() {
this.parReq = false;
return this;
}
protected ScriptExecutable addParameter(String name, ArgumentParser ... parsers) {
this.parameters.put(name, new Parameter(name, (char)0, this.parPos++, this.parReq, Lists.newArrayList(parsers)));
return this;
}
protected ScriptExecutable addParameter(String name, char shortName, ArgumentParser ... parsers) {
this.parameters.put(name, new Parameter(name, shortName, -1, false, Lists.newArrayList(parsers)));
return this;
}
public Object exec(ScriptEnvironment env, ScriptArgs args) {
return null;
}
public Map<String, Parameter> getParameters() {
return this.parameters;
}
public String getName() {
return this.name;
}
}