You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/Imperat/Dispatcher API.md
+8-4
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ It's a flexible abstract class in Imperat, which parses the annotated command cl
26
26
it's used internally inside the method `Imperat#registerCommand(T instance)`.
27
27
Simply, It defines how the data from the annotations (inside your Command class) are translated and converted into command objects.
28
28
29
-
You can customize and make your own AnnotationParser as you wish by using `Imperat#setAnnotationParser(AnnotationParser<C>)` where C is automatically
29
+
You can customize and make your own AnnotationParser as you wish by using `YourPlatformImperatConfigBuilder#setAnnotationParser(AnnotationParser<C>)` where C is automatically
30
30
your command-sender type
31
31
32
32
Refer to the java docs if you need more details on how to implement your own `AnnotationParser`, although I would never recommend you to do this, as the default `AnnotationParser` is competent enough.
@@ -44,7 +44,7 @@ it's own way of identifying whether the command-sender/source has a permission o
44
44
### Implementing your own Permission Resolver
45
45
46
46
If you ever wanted to make your own `Permission Resolver` you should consider
47
-
adding it as a parameter inside the `YourCommandPlatform.create()`, Refer to the java docs
47
+
adding it as a parameter inside the `YourPlatformImperatConfigBuilder#permissionResolver()`, Refer to the java docs
48
48
for more info about method parameters for creation of Imperat instances from various supported platforms and you may would like to check [Supported-Platforms](Supported-Platforms.md)
49
49
50
50
*Quick **Bukkit** example:*
@@ -65,7 +65,7 @@ class MyPlugin extends JavaPlugin {
65
65
@Override
66
66
publicvoidonEnable() {
67
67
//now you injected the your own instance of permission resolver into the Command Dispatcher
@@ -141,11 +141,15 @@ The `areAmbigious(CommandUsage, CommandUsage)` method checks if any two usages o
141
141
#### Common Scenarios
142
142
Here are some important common scenarios that will help you better understand
143
143
how Imperat recognizes and when does it tolerate an ambiguity.
144
+
144
145
##### Scenario #1
145
146
if you have the command `group` and it has 2 usages which are `/group <group>` and `/group help` , an actual group can be called **'help'**. Luckily however, Imperat prioritizes subcommands compared to value arguments, so the dispatcher will tolerate this pseudo-ambiguity. <br/>
147
+
146
148
##### Scenario #2
147
149
If you have the command `buy` with 2 usages which are `/buy <itemId>` and `/buy <itemName>`
148
-
Even if both parameters `itemId` and `itemName` are of different types, the current `Imperat` cannot tolerate this ambiguity coming from these 2 usages.
150
+
Even if both parameters `itemId` and `itemName` are of different types (Integer vs String), the current `Imperat` can work with this depending
151
+
on the `UsageVerifier`, the default usage verifier would deal with such ambiguity. However it may cause some unknown problems.
152
+
149
153
150
154
:::warning
151
155
We don't recommend implementing your own UsageVerifier, unless you know what you're doing, since the `DefaultUsageVerifier` is competent enough.
0 commit comments