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

Commit a1c41eb

Browse files
committed
Update WiP
1 parent ccd6925 commit a1c41eb

File tree

5 files changed

+95
-3
lines changed

5 files changed

+95
-3
lines changed

Writerside/litecommands.tree

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
</toc-element>
1212
<toc-element topic="Platforms.md">
1313
<toc-element topic="SENDER.md"/>
14-
<toc-element topic="Bukkit-Platform.md"/>
14+
</toc-element>
15+
<toc-element topic="Features.md">
16+
<toc-element topic="Arguments.md">
17+
</toc-element>
1518
</toc-element>
1619
<toc-element topic="Adventure-Kyori.md">
1720
<toc-element topic="adventure.md"/>

Writerside/redirection-rules.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@
1818
<description><![CDATA[Created after removal of "<Why-use-LiteCommands.md>" from LiteCommands]]></description>
1919
<accepts>Why-use-LiteCommands.html</accepts>
2020
</rule>
21+
<rule id="69b50e61">
22+
<description>Created after removal of "Bukkit" from LiteCommands</description>
23+
<accepts>Bukkit-Platform.html</accepts>
24+
</rule>
25+
<rule id="6406aeae">
26+
<description>Created after removal of "@Arg Annotation" from LiteCommands</description>
27+
<accepts>Arg.html</accepts>
28+
</rule>
29+
<rule id="66f09aab">
30+
<description>Created after removal of "Programmatic Argument" from LiteCommands</description>
31+
<accepts>Programmatic-Argument.html</accepts>
32+
</rule>
2133
</rules>

Writerside/topics/Arguments.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Argument
2+
3+
Argument is a value that is passed to the command.
4+
For example, you can use the `String` object as an argument in your command:
5+
6+
<tabs>
7+
<tab title="Annotation">
8+
9+
```java
10+
@Command(name = "say")
11+
public class SayCommand {
12+
@Execute
13+
public void ban(@Arg String text) {
14+
// ...
15+
}
16+
}
17+
```
18+
</tab>
19+
<tab title="Programmatically">
20+
21+
```java
22+
new LiteCommand<CommandSender>("say")
23+
.argument("text", String.class)
24+
.onExecute(context -> {
25+
String text = context.argument("text", String.class);
26+
// ...
27+
})
28+
```
29+
</tab>
30+
31+
<tab title="Programmatic (class)">
32+
33+
```java
34+
public class SayCommand extends LiteCommand<CommandSender> {
35+
public SayCommand() {
36+
super("say");
37+
argument("text", String.class);
38+
}
39+
40+
@Override
41+
public void execute(Context<CommandSender> context) {
42+
String text = context.argument("text", String.class);
43+
// ...
44+
}
45+
}
46+
```
47+
</tab>
48+
</tabs>
49+
50+
LiteCommands supports multiple argument types. You can find all of them in the table below.
51+
52+
| Argument Type | Values | Platforms |
53+
|---------------|------------------------------------------------|-----------|
54+
| `Boolean` | `true`, `false` | * |
55+
| `Byte` | `-128` - `127` | * |
56+
| `Short` | `-32768` - `32767` | * |
57+
| `Integer` | `-2147483648` - `2147483647` | * |
58+
| `Long` | `-9223372036854775808` - `9223372036854775807` | * |
59+
| `Float` | `0.0` - `3.4028235E38` | * |
60+
| `Double` | `0.0` - `1.7976931348623157E308` | * |
61+
| `String` | Any string | * |
62+
| `Enum` | Any enum | * |
63+
| `Duration` | 1d, 1h, 1m, 1s, 1ms | * |
64+
| `Period` | 1y, 1mo, 1w, 1d | * |
65+
| `Instant` | yyyy-MM-dd HH:mm:ss | * |
66+
| `Component` | Any string | Adventure |
67+
| `Component` | Any string | Adventure |
68+
| `Player` | Any player | Bukkit |
69+
| `World` | Any world | Bukkit |
70+
| `Location` | Any location | Bukkit |
71+
| `Player` | Any player | Minestom |
72+
73+
// TODO: Add more argument types
74+
| `UUID` | Any UUID | All |
75+
| `Color` | Any color | All |
76+
| `Enchantment` | Any enchantment | All |
77+
| `ChatColor` | Any chat color | All |
78+

Writerside/topics/Bukkit-Platform.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

Writerside/topics/Features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Features

0 commit comments

Comments
 (0)