Skip to content

Commit 4aa6476

Browse files
committed
Up to date
1 parent ca165c3 commit 4aa6476

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

docs/Imperat/Command Help.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public final class GroupCommand {
3939
) {
4040
source.reply("Group entered= " + group.name());
4141
//showing help to the user
42-
help.display();
42+
help.display(source);
4343
}
4444
}
4545
```

docs/Imperat/Dispatcher API.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ It's a flexible abstract class in Imperat, which parses the annotated command cl
2626
it's used internally inside the method `Imperat#registerCommand(T instance)`.
2727
Simply, It defines how the data from the annotations (inside your Command class) are translated and converted into command objects.
2828

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
3030
your command-sender type
3131

3232
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
4444
### Implementing your own Permission Resolver
4545

4646
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
4848
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)
4949

5050
*Quick **Bukkit** example:*
@@ -65,7 +65,7 @@ class MyPlugin extends JavaPlugin {
6565
@Override
6666
public void onEnable() {
6767
//now you injected the your own instance of permission resolver into the Command Dispatcher
68-
imperat = BukkitImperat.create(plugin, new MyBukkitPermissionResolver());
68+
imperat = BukkitImperat.builder(this).permissionResolver(new MyBukkitPermissionResolver()).build();
6969
}
7070
}
7171
```
@@ -141,11 +141,15 @@ The `areAmbigious(CommandUsage, CommandUsage)` method checks if any two usages o
141141
#### Common Scenarios
142142
Here are some important common scenarios that will help you better understand
143143
how Imperat recognizes and when does it tolerate an ambiguity.
144+
144145
##### Scenario #1
145146
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+
146148
##### Scenario #2
147149
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+
149153

150154
:::warning
151155
We don't recommend implementing your own UsageVerifier, unless you know what you're doing, since the `DefaultUsageVerifier` is competent enough.

docs/Imperat/Introduction.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,31 @@ These objects are registered/injected into the class `Imperat` which handles all
1717
**Answer:** It's the Ultimate class handling all data needed when processing and registering
1818
commands objects (`Command`).
1919
You have to create **new instance** of the imperat.
20-
on the **start** of your platform by calling `YourPlatformImperat#create` (the method is static) to create
21-
and initialize a new instance of `Imperat` type.
20+
on the **start** of your platform by calling `YourPlatformImperat#builder` (the method is static) to configure your imperat instance,
21+
then finally end the chain with `build` method to return a new instance of `YourPlatformImperat` type.
2222

2323
:::tip[TIP]
2424
Creation of an instance of your `PlatformImperat` depends mainly on which platform
2525
you are using. For more details, Check out [Supported-Platforms](Supported-Platforms.md)
26-
26+
But despite having various types of imperat implementations for different platforms,
27+
all of them are **configurable/customizable**
2728
:::
2829

2930
# Customizing Imperat
3031

32+
33+
3134
If you wanted to register a [Context Resolver](Context%20Resolver.md) or a [Parameter Type](Parameter-Type.md) , or even
3235
set a [Suggestion Resolver](Suggestion%20Resolver.md) for tab-completion in commands, You would have to
33-
call some methods using your platform's dispatcher instance/
36+
call some methods while configuring imperat.
37+
38+
*Quick-example:*
39+
```java
40+
BukkitImperat imperat = BukkitImperat.builder(plugin)
41+
// do stuff here
42+
.build();
43+
```
44+
3445
For a complete detailed guide on this, please check out [Dispatcher API](Dispatcher%20API.md)
3546

3647
:::note

0 commit comments

Comments
 (0)