Skip to content

Commit 1eaaca0

Browse files
committed
v1.1.4
1 parent 9956f4f commit 1eaaca0

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed
0 Bytes
Binary file not shown.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'java'
22

33
group = 'dev.manere'
4-
version = '1.1.3'
4+
version = '1.1.4'
55

66
repositories {
77
mavenCentral()

src/main/java/dev/manere/commands/CommandNode.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ public static CommandNode of(final @NotNull String literal) {
6666
return literal(literal);
6767
}
6868

69+
@NotNull
70+
public static CommandNode node(final @NotNull String literal, final @NotNull Consumer<CommandContext<CommandSender>> executor) {
71+
return of(literal).executes(executor);
72+
}
73+
74+
@NotNull
75+
public static CommandNode literal(final @NotNull String literal, final @NotNull Consumer<CommandContext<CommandSender>> executor) {
76+
return node(literal, executor);
77+
}
78+
79+
@NotNull
80+
public static CommandNode of(final @NotNull String literal, final @NotNull Consumer<CommandContext<CommandSender>> executor) {
81+
return literal(literal, executor);
82+
}
83+
6984
@NotNull
7085
public String literal() {
7186
return literal;
@@ -160,6 +175,18 @@ public CommandNode subcommand(final @NotNull CommandNode child) {
160175
return this;
161176
}
162177

178+
@NotNull
179+
@CanIgnoreReturnValue
180+
public CommandNode subcommand(final @NotNull String literal, final @NotNull Consumer<CommandContext<CommandSender>> executor) {
181+
return subcommand(new CommandNode(literal).executes(executor));
182+
}
183+
184+
@NotNull
185+
@CanIgnoreReturnValue
186+
public <S extends CommandSender> CommandNode subcommand(final @NotNull String literal, final @NotNull Class<S> senderType, final @NotNull Consumer<CommandContext<S>> executor) {
187+
return subcommand(new CommandNode(literal).executes(senderType, executor));
188+
}
189+
163190
@NotNull
164191
@Unmodifiable
165192
public Map<Class<? extends CommandSender>, Consumer<CommandContext<? extends CommandSender>>> executors() {

src/main/java/dev/manere/commands/api/CommandAPI.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ public void register(final @NotNull BasicCommandNode root) {
9797
@NotNull
9898
@ApiStatus.Internal
9999
private CommandNode convert(final @NotNull BasicCommandNode basicNode) {
100-
final CommandNode node = CommandNode.of(basicNode.getLiteral())
101-
.executes(basicNode::execute)
100+
final CommandNode node = CommandNode.of(basicNode.getLiteral(), basicNode::execute)
102101
.permission(basicNode.getPermission().orElse(null))
103102
.aliases(basicNode.getAliases());
104103

0 commit comments

Comments
 (0)