@@ -19,7 +19,7 @@ public abstract class CommandLink<T> {
19
19
protected final Set <CommandNode <?>> children = new HashSet <>();
20
20
protected final List <Requirement > requires = new ArrayList <>();
21
21
22
- protected Consumer < CommandContext > executor ;
22
+ protected Executor executor ;
23
23
24
24
/**
25
25
* Requires the context in which the command is executed in to pass the {@code requires} check
@@ -64,7 +64,7 @@ public T then(@NotNull CommandNode<?> node) {
64
64
* @param executor The executor
65
65
* @return The builder, for chaining
66
66
*/
67
- public T executes (@ NotNull Consumer < CommandContext > executor ) {
67
+ public T executes (@ NotNull Executor executor ) {
68
68
this .executor = executor ;
69
69
return getThis ();
70
70
}
@@ -82,12 +82,18 @@ public T executes(@NotNull Consumer<CommandContext> executor) {
82
82
* Gets the executor
83
83
* @return The executor
84
84
*/
85
- public Consumer < CommandContext > getExecutor () {
85
+ public Executor getExecutor () {
86
86
return executor ;
87
87
}
88
88
89
89
protected abstract @ NotNull T getThis ();
90
90
91
+ /**
92
+ * A function that defines a command executor
93
+ * This interface is basically a shorthand for {@code Consumer<CommandContext>}
94
+ */
95
+ public interface Executor extends Consumer <CommandContext > { }
96
+
91
97
/**
92
98
* A function that defines a command requirement.
93
99
* This interface is basically a shorthand for {@code Function<CommandContext, Result<None, String>>}
0 commit comments