Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit 6a33f10

Browse files
committed
Merge branch 'wip'
2 parents 24d5b9b + 6073a7f commit 6a33f10

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

Writerside/topics/Join-Argument.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,39 @@ Let's consider the following command usage:
2828

2929
```
3030
/ban JohnDoe Offensive language and behavior
31-
In this case, the `target` parameter will represent the player "JohnDoe", and the `reason` parameter will represent the string "Offensive language and behavior." The @Join annotation automatically combines all the remaining text arguments into the reason parameter.
31+
target = JohnDoe
32+
reason = Offensive language and behavior
3233
```
3334

3435
## Notes
35-
- The `@Join `annotation is particularly useful when you want to capture a variable number of arguments into a single string.
36+
- The `@Join` annotation is particularly useful when you want to capture a variable number of arguments into a single string.
3637
- The joined string includes spaces between the original arguments, making it suitable for textual descriptions or reasons.
3738

3839
## Additional Options
3940

4041

42+
- The `limit` option allows developers to specify the
43+
maximum number of arguments to include in the joined string.
44+
- On the other hand, the `separator` option enables developers to define a custom string that separates each joined
45+
argument, allowing for fine-grained control over formatting.
4146

42-
In LiteCommands, the @Join annotation offers additional options for customization, namely limit and separator. The limit option allows developers to specify the maximum number of arguments to include in the joined string, providing control over the length of the concatenated result. On the other hand, the separator option enables developers to define a custom string that separates each joined argument, allowing for fine-grained control over formatting. These options enhance the flexibility of the @Join annotation, allowing developers to tailor the concatenated string output to their specific needs.
47+
```java
48+
@Command(name = "ban")
49+
public class BanCommand {
50+
@Execute
51+
public void ban(
52+
@Arg Player target,
53+
@Join(limit = 10, separator = "-") String reason
54+
) {
55+
// Command implementation
56+
}
57+
}
58+
```
59+
60+
Let's consider the following command usage:
61+
62+
```
63+
/ban JohnDoe Offensive language and behavior
64+
target = JohnDoe
65+
reason = Offensive-language-and-behavior
66+
```

0 commit comments

Comments
 (0)