@@ -28,7 +28,7 @@ To add this project as a dependency to your project, add the following to your p
28
28
<dependency >
29
29
<groupId >com.github.Despical</groupId >
30
30
<artifactId >CommandFramework</artifactId >
31
- <version >1.0.4 </version >
31
+ <version >1.0.5 </version >
32
32
<scope >compile</scope >
33
33
</dependency >
34
34
```
@@ -41,7 +41,7 @@ repositories {
41
41
```
42
42
```
43
43
dependencies {
44
- compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.0.4 ";
44
+ compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.0.5 ";
45
45
}
46
46
```
47
47
@@ -60,6 +60,18 @@ public class ExampleClass extends JavaPlugin {
60
60
// Then this will register all the @Command methods as a command
61
61
// so there is no necessity to add command to your plugin.yml
62
62
commandFramework. registerCommands(this );
63
+ commandFramework. setAnyMatch(arguments - > {
64
+ if (arguments. isArgumentsEmpty()) return ;
65
+
66
+ String label = arguments. getLabel(), arg = arguments. getArgument(0 );
67
+
68
+ // StringMatcher is an external class from Despical's Commons library which is not in this framework
69
+ ListStringMatcher . Match > matches = StringMatcher . match(arg, commandFramework. getCommands(). stream(). map(cmd - > cmd. name(). replace(label + " ." , " " )). collect(Collectors . toList()));
70
+
71
+ if (! matches. isEmpty()) {
72
+ arguments. sendMessage(" Did you mean %command%?" ). replace(" %command%" , label + " " + matches. get(0 ). getMatch());
73
+ }
74
+ });
63
75
}
64
76
65
77
// Before creating command the method must only have
0 commit comments