Skip to content

Commit c0c421f

Browse files
committed
Added new method to get both commands and sub-commands
1 parent ecf9caa commit c0c421f

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/main/java/me/despical/commandframework/CommandFramework.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.bukkit.command.*;
2727
import org.bukkit.plugin.Plugin;
2828
import org.jetbrains.annotations.ApiStatus;
29-
import org.jetbrains.annotations.Contract;
3029
import org.jetbrains.annotations.NotNull;
3130

3231
import java.lang.reflect.*;
@@ -224,17 +223,13 @@ protected final void setCommandMap(CommandMap commandMap) {
224223
}
225224

226225
/**
227-
* Get a copy of registered commands and sub-commands.
226+
* Get a copy of registered commands.
228227
*
229-
* @return list of the commands and sub-commands.
228+
* @return list of the commands.
230229
*/
231230
@NotNull
232-
@Contract(pure = true)
233231
public final List<Command> getCommands() {
234-
List<Command> commands = new ArrayList<>(this.registry.getCommands());
235-
commands.addAll(this.registry.getSubCommands());
236-
237-
return commands;
232+
return new ArrayList<>(this.registry.getCommands());
238233
}
239234

240235
/**
@@ -243,8 +238,20 @@ public final List<Command> getCommands() {
243238
* @return list of the sub-commands.
244239
*/
245240
@NotNull
246-
@Contract(pure = true)
247241
public final List<Command> getSubCommands() {
248242
return new ArrayList<>(this.registry.getSubCommands());
249243
}
244+
245+
/**
246+
* Get a copy of registered commands and sub-commands.
247+
*
248+
* @return list of the commands and sub-commands.
249+
*/
250+
@NotNull
251+
public final List<Command> getAllCommands() {
252+
final List<Command> commands = new ArrayList<>(this.registry.getCommands());
253+
commands.addAll(this.registry.getSubCommands());
254+
255+
return commands;
256+
}
250257
}

0 commit comments

Comments
 (0)