Super simple start

This commit is contained in:
Nathan Adams
2014-09-16 12:08:15 +02:00
parent 4801ab8dc9
commit c73607ba36
9 changed files with 160 additions and 0 deletions
@@ -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;
}
}