11# CommandAPI
2- Simple Reflection Command API that just does what you want it to do without any problems.
2+ Annotation/ Reflection Based Command API that just does what you want it to do without any problems.
33
44### Importing
55
@@ -16,7 +16,7 @@ Simple Reflection Command API that just does what you want it to do without any
1616 <dependency>
1717 <groupId >com.github.therealdamt</groupId >
1818 <artifactId >commandapi</artifactId >
19- <version >1.2 .0</version >
19+ <version >1.3 .0</version >
2020 </dependency >
2121```
2222
@@ -40,21 +40,12 @@ Simple Reflection Command API that just does what you want it to do without any
4040* Example main class
4141
4242``` java
43- @Getter
4443public class Main extends JavaPlugin {
45-
46- @Getter
47- private static Main instance;
48-
49- @Override
50- public void onLoad () {
51- instance = this ;
52- }
53-
5444 @Override
55- public void onEnable () {
45+ public void onEnable () { // You also have the default tab completer, and the default help service, new DefaultTabCompleter();
5646 new CommandHandler (this ). bind(ItemStack . class, new ItemStackProvider ())
57- .register(new FlyCommand (), new ItemStackCommand ()). registerCommands();
47+ .register(new FlyCommand (), new ItemStackCommand ()). helpService(new HelpService ())
48+ .tabComplete(new TabCompleter ()). registerCommands();
5849 }
5950
6051}
@@ -92,6 +83,32 @@ public class ItemStackProvider implements CommandProvider<ItemStack> {
9283}
9384```
9485
86+ * Example Help Service
87+
88+ ``` java
89+ public class HelpService implements HelpCommandService {
90+
91+ @Override
92+ public List<String > get (Command command , List<Command > subCommands ) {
93+ return subCommands. stream(). map(command1 - > command. getUsage() + " , " ). collect(Collectors . toList());
94+ }
95+
96+ }
97+ ```
98+
99+ * Example Tab Completer
100+
101+ ``` java
102+ public class TabCompleter implements TabComplete {
103+
104+ @Override
105+ public List<String > get (Command command , List<Command > subCommands , String [] args ) {
106+ return subCommands. stream(). map(subCommand - > subCommand. getName() + " \n " ). collect(Collectors . toList());
107+ }
108+
109+ }
110+ ```
111+
95112### Credits
96113
97114You have full rights to use this command api within your projects, but if possible to include credits that'd be amazing!
0 commit comments