📚 Fix readme code examples

This commit is contained in:
jmp 2020-10-16 14:22:41 -07:00 • committed by Alexander Söderberg
parent 9f642dec9b
commit 460040b39c

View file

@ -21,15 +21,15 @@ Cloud allows for commands to be defined using builder patterns, like this:
manager.command( manager.command(
manager.commandBuilder("command", Description.of("Test cloud command using a builder"), "alias") manager.commandBuilder("command", Description.of("Test cloud command using a builder"), "alias")
.argument(StringArgument.of("input")) .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 -> { .handler(context -> {
String input = context.get("input"); String input = context.get("input");
int number = context.get("number"); int number = context.get("number");
context.getSender().sendMessage(String.format( context.getSender().sendMessage(String.format(
"I am %d%% hyped for %s!" "I am %d%% hyped for %s!",
number, number,
input input
); ));
}) })
); );
``` ```
@ -38,12 +38,12 @@ or using annotated methods, like this:
@CommandDescription("Test cloud command using @CommandMethod") @CommandDescription("Test cloud command using @CommandMethod")
@CommandMethod("command|alias <input> <number>") @CommandMethod("command|alias <input> <number>")
private void yourCommand( private void yourCommand(
Player sender, CommandSender sender,
@Argument("input") String input, @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( sender.sendMessage(String.format(
"I am %d%% hyped for %s!" "I am %d%% hyped for %s!",
number, number,
input input
)); ));