Super simple start
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package net.minecraft.commands.builder;
|
||||
|
||||
public abstract class CommandBuilder {
|
||||
private boolean finished;
|
||||
private Runnable commandExecutor;
|
||||
|
||||
public void finish() {
|
||||
if (finished) {
|
||||
throw new IllegalStateException("Cannot finish() multiple times!");
|
||||
}
|
||||
if (commandExecutor == null) {
|
||||
throw new IllegalStateException("Cannot finish() without a command executor!");
|
||||
}
|
||||
onFinish();
|
||||
finished = true;
|
||||
}
|
||||
|
||||
protected abstract void onFinish();
|
||||
|
||||
public CommandBuilder executes(Runnable runnable) {
|
||||
this.commandExecutor = runnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Runnable getCommandExecutor() {
|
||||
return commandExecutor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user