mirror of
https://github.com/aikar/commands.git
synced 2026-06-26 08:30:37 +00:00
Updated Using ACF (markdown)
+8
-6
@@ -3,11 +3,11 @@
|
||||
## Build Tool Setup
|
||||
See [Maven](Maven-Setup), [Gradle](Gradle-Setup), or you can find artifacts here:
|
||||
|
||||
http://ci.emc.gs/nexus/content/groups/aikar/co/aikar/commands/
|
||||
https://repo.aikar.co/content/groups/aikar/co/aikar/commands/
|
||||
|
||||
## Getting a Command Manager
|
||||
```java
|
||||
CommandManager manager = ACF.createManager(yourBukkitPlugin);
|
||||
BukkitCommandManager manager = new BukkitCommandManager(yourBukkitPlugin);
|
||||
```
|
||||
|
||||
## Registering a command
|
||||
@@ -27,7 +27,7 @@ Special [Completion Handlers](Completion-Handlers) are prefixed @ like @foo
|
||||
|
||||
To register your own custom ones, one would do
|
||||
```java
|
||||
manager.getCommandCompletions().registerCompletion("foo", (sender, completionConfig, input) {
|
||||
manager.getCommandCompletions().registerCompletion("foo", c -> {
|
||||
return ImmutableList.of("some", "custom", "completion");
|
||||
});
|
||||
```
|
||||
@@ -37,13 +37,15 @@ manager.getCommandCompletions().registerCompletion("foo", (sender, completionCon
|
||||
|
||||
To register your own custom ones, one would do
|
||||
```java
|
||||
manager.getCommandContexts().registerContext(Foo.class, (c) {
|
||||
manager.getCommandContexts().registerContext(Foo.class, c -> {
|
||||
return /* stuff */;
|
||||
});
|
||||
```
|
||||
See [CommandExecutionContext](https://github.com/aikar/commands/blob/master/src/main/java/co/aikar/commands/CommandExecutionContext.java) for information on what methods are available for (c)
|
||||
See [CommandContexts](https://github.com/aikar/commands/blob/master/src/main/java/co/aikar/commands/CommandContexts.java) and [BukkitCommandContexts](https://github.com/aikar/commands/blob/master/src/main/java/co/aikar/commands/BukkitCommandContexts.java) for examples.
|
||||
|
||||
You may also use `registerSenderAwareContext` instead to tell ACF that this resolver is able to resolve without consuming input, by understanding the context of the sender of the command (such as World, Location, Etc)
|
||||
You may also use `registerIssuerAwareContext` instead to tell ACF that this resolver is able to resolve without consuming input, by understanding the context of the issuer of the command (such as World, Location, Etc)
|
||||
|
||||
A non sender aware resolver must consume input. Sender Aware may optionally consume input if supplied, and fallback to context if not.
|
||||
A non issuer aware resolver must consume input. Issuer Aware may optionally consume input if supplied, and fallback to context if not.
|
||||
|
||||
If you want an Issuer Only resolver, one that always resolves based on Issuer and never consumes input, you may use `registerIssuerOnlyContext`
|
||||
Reference in New Issue
Block a user