📚 Fix readme code examples
This commit is contained in:
parent
9f642dec9b
commit
460040b39c
1 changed files with 50 additions and 50 deletions
14
README.md
14
README.md
|
|
@ -21,15 +21,15 @@ Cloud allows for commands to be defined using builder patterns, like this:
|
|||
manager.command(
|
||||
manager.commandBuilder("command", Description.of("Test cloud command using a builder"), "alias")
|
||||
.argument(StringArgument.of("input"))
|
||||
.argument(IntegerArgument.newBuilder("number").withMin(1).withMax(100).build())
|
||||
.argument(IntegerArgument.<CommandSender>newBuilder("number").withMin(1).withMax(100).build())
|
||||
.handler(context -> {
|
||||
String input = context.get("input");
|
||||
int number = context.get("number");
|
||||
context.getSender().sendMessage(String.format(
|
||||
"I am %d%% hyped for %s!"
|
||||
"I am %d%% hyped for %s!",
|
||||
number,
|
||||
input
|
||||
);
|
||||
));
|
||||
})
|
||||
);
|
||||
```
|
||||
|
|
@ -38,12 +38,12 @@ or using annotated methods, like this:
|
|||
@CommandDescription("Test cloud command using @CommandMethod")
|
||||
@CommandMethod("command|alias <input> <number>")
|
||||
private void yourCommand(
|
||||
Player sender,
|
||||
CommandSender sender,
|
||||
@Argument("input") String input,
|
||||
@Argument("number") @Range(min = "1", max = "100") int number)
|
||||
@Argument("number") @Range(min = "1", max = "100") int number
|
||||
) {
|
||||
player.sendMessage(String.format(
|
||||
"I am %d%% hyped for %s!"
|
||||
sender.sendMessage(String.format(
|
||||
"I am %d%% hyped for %s!",
|
||||
number,
|
||||
input
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue