26
26
import org .bukkit .command .*;
27
27
import org .bukkit .plugin .Plugin ;
28
28
import org .jetbrains .annotations .ApiStatus ;
29
- import org .jetbrains .annotations .Contract ;
30
29
import org .jetbrains .annotations .NotNull ;
31
30
32
31
import java .lang .reflect .*;
@@ -224,17 +223,13 @@ protected final void setCommandMap(CommandMap commandMap) {
224
223
}
225
224
226
225
/**
227
- * Get a copy of registered commands and sub-commands .
226
+ * Get a copy of registered commands.
228
227
*
229
- * @return list of the commands and sub-commands .
228
+ * @return list of the commands.
230
229
*/
231
230
@ NotNull
232
- @ Contract (pure = true )
233
231
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 ());
238
233
}
239
234
240
235
/**
@@ -243,8 +238,20 @@ public final List<Command> getCommands() {
243
238
* @return list of the sub-commands.
244
239
*/
245
240
@ NotNull
246
- @ Contract (pure = true )
247
241
public final List <Command > getSubCommands () {
248
242
return new ArrayList <>(this .registry .getSubCommands ());
249
243
}
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
+ }
250
257
}
0 commit comments