📚 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

100
README.md
View file

@ -19,18 +19,18 @@ of using the framework is like floating on a fluffy cloud in heaven. Its feature
Cloud allows for commands to be defined using builder patterns, like this: Cloud allows for commands to be defined using builder patterns, like this:
```java ```java
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
); ));
}) })
); );
``` ```
or using annotated methods, like this: or using annotated methods, like this:
@ -38,14 +38,14 @@ 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
)); ));
} }
``` ```
@ -141,37 +141,37 @@ with conflicting dependencies:
```xml ```xml
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version> <version>3.2.4</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations> <relocations>
<relocation> <relocation>
<pattern>cloud.commandframework</pattern> <pattern>cloud.commandframework</pattern>
<shadedPattern>YOUR.PACKAGE.HERE.shaded.cloud</shadedPattern> <!-- Replace this --> <shadedPattern>YOUR.PACKAGE.HERE.shaded.cloud</shadedPattern> <!-- Replace this -->
</relocation> </relocation>
<relocation> <relocation>
<pattern>io.leangen.geantyref</pattern> <pattern>io.leangen.geantyref</pattern>
<shadedPattern>YOUR.PACKAGE.HERE.shaded.typetoken</shadedPattern> <!-- Replace this --> <shadedPattern>YOUR.PACKAGE.HERE.shaded.typetoken</shadedPattern> <!-- Replace this -->
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
``` ```