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

Commit a0065c2

Browse files
authored
GH-1 Initial documentation (#1)
2 parents eb194c9 + 361561e commit a0065c2

20 files changed

+753
-113
lines changed

Writerside/cfg/buildprofiles.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
<buildprofiles xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
44

5-
<variables></variables>
65
<build-profile instance="hi">
76
<variables>
87
<noindex-content>true</noindex-content>
8+
<primary-color>purple</primary-color>
9+
<color-preset>purple</color-preset>
910
</variables>
1011
</build-profile>
1112

Writerside/images/litecommands.png

61.6 KB
Loading

Writerside/litecommands.tree

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@
77
start-page="Introdution.md">
88

99
<toc-element topic="Introdution.md">
10-
<toc-element topic="Why-use-LiteCommands.md"/>
10+
<toc-element topic="Dependency.md"/>
11+
<toc-element topic="Configuration.md"/>
12+
</toc-element>
13+
<toc-element topic="Platforms.md">
14+
<toc-element topic="SENDER.md"/>
15+
</toc-element>
16+
<toc-element topic="Command.md"/>
17+
<toc-element topic="Arguments.md">
18+
<toc-element topic="Supported-Types.md"/>
19+
<toc-element topic="Unsupported-Types-TODO.md"/>
20+
<toc-element topic="Custom-Types.md"/>
21+
</toc-element>
22+
<toc-element topic="Adventure-Kyori.md">
23+
<toc-element topic="adventure.md"/>
24+
<toc-element topic="adventure-platform.md"/>
25+
<toc-element topic="Adventure-Usage.md"/>
1126
</toc-element>
12-
<toc-element topic="Platforms.md"/>
1327
</instance-profile>

Writerside/redirection-rules.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,28 @@
1414
<description>Created after removal of "This is the first topic" from Help Instance</description>
1515
<accepts>Default-topic.html</accepts>
1616
</rule>
17+
<rule id="3cfa662e">
18+
<description><![CDATA[Created after removal of "<Why-use-LiteCommands.md>" from LiteCommands]]></description>
19+
<accepts>Why-use-LiteCommands.html</accepts>
20+
</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>
33+
<rule id="2fe346aa">
34+
<description>Created after removal of "| III | Command Str" from LiteCommands</description>
35+
<accepts>Features.html</accepts>
36+
</rule>
37+
<rule id="dbb0302">
38+
<description>Created after removal of "Configuration - Bukkit" from LiteCommands</description>
39+
<accepts>Configuration-Bukkit.html</accepts>
40+
</rule>
1741
</rules>

Writerside/topics/Adventure-Kyori.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Adventure Kyori Extensions
2+
3+
Adventure Kyori is a library that provides a set of utilities for the [Adventure](https://docs.advntr.dev/getting-started.html) library.
4+
5+
If you want to use the Adventure Kyori features in your project, you need to add the following dependency, depending on the platform you are using:
6+
7+
| Platform Artifact | Extension Artifact | Compatible Platforms | Compatible Versions |
8+
|---------------------------|-----------------------------------|-----------------------|---------------------|
9+
| `litecommands-bukkit` | `litecommands-adventure-platform` | Bukkit, Spigot | 1.8.8 - 1.20.2 |
10+
| `litecommands-bukkit` | `litecommands-adventure` | Paper, Purpur | 1.16 - 1.20.2 |
11+
| `litecommands-bungeecord` | `litecommands-adventure-platform` | BungeeCord, Waterfall | 1.20-R0.1 |
12+
| `litecommands-velocity` | build-in | Velocity | 3.2.0 |
13+
| `litecommands-minestom` | build-in | Minestom | 1.20.2 |
14+
15+
<tip>
16+
17+
Depending on the platform you are using, see the following pages for more information:
18+
19+
- `litecommands-adventure-platform` -> [Adventure Platform](adventure-platform.md)
20+
- `litecommands-adventure` -> [Adventure](adventure.md)
21+
- `build-in` means that you don't need to add any additional artifacts to your project.
22+
23+
</tip>

Writerside/topics/Adventure-Usage.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Adventure Usage
2+
3+
## Argument
4+
5+
For example, you can use the `Component` object as an argument in your command:
6+
7+
```java
8+
@Execute(name = "tell")
9+
void tell(@Context SENDER sender, @Arg SENDER target, @Join Component message) {
10+
target.sendMessage(message);
11+
}
12+
```
13+
14+
## Response
15+
16+
You can also use the `Component` object as a response:
17+
18+
```java
19+
@Execute(name = "info")
20+
Component info() {
21+
return Component.text("This is an example of the Component response.");
22+
}
23+
```
24+
25+
## Colorizer
26+
27+
Colorizer is a feature that allows you to colorize the `Component` object in the `@Arg` argument.
28+
29+
If you want to use the default colorizer, you need to enable it in the `LiteCommands` builder:
30+
31+
<tabs>
32+
<tab title="Adventure">
33+
34+
```java
35+
.extension(new LiteAdventureExtension<SENDER>()
36+
.colorizeArgument(true)
37+
)
38+
```
39+
</tab>
40+
<tab title="Adventure Platform">
41+
42+
```java
43+
.extension(new LiteAdventurePlatformExtension<SENDER>(this.audienceProvider)
44+
.colorizeArgument(true)
45+
)
46+
```
47+
</tab>
48+
</tabs>
49+
50+
You can force **enable** the colorizer for the specific argument:
51+
52+
```java
53+
@Execute(name = "colorize")
54+
void colorize(@Arg @Key("color") Component colorized) {
55+
// ...
56+
}
57+
```
58+
59+
And you can also force **disable** the colorizer:
60+
61+
```java
62+
@Execute(name = "raw")
63+
void raw(@Arg @Key("raw") Component notColorized) {
64+
// ...
65+
}
66+
```
67+
68+
## Serializer (Colorizer)
69+
70+
Serializer is used to colorize the `Component` object in the `@Arg` argument and the response.
71+
72+
You can modify the default serializer by using the `miniMessage()` and `legacyColor()` methods in the `LiteCommands` builder:
73+
74+
<tabs>
75+
<tab title="Adventure">
76+
77+
```java
78+
.extension(new LiteAdventureExtension<SENDER>()
79+
.miniMessage(true)
80+
.legacyColor(true)
81+
)
82+
```
83+
</tab>
84+
<tab title="Adventure Platform">
85+
86+
```java
87+
.extension(new LiteAdventurePlatformExtension<SENDER>(this.audienceProvider)
88+
.miniMessage(true)
89+
.legacyColor(true)
90+
)
91+
```
92+
</tab>
93+
</tabs>
94+
95+
The `miniMessage()` method enables the MiniMessage support. Read more about it [here](https://docs.advntr.dev/minimessage/).
96+
The `legacyColor()` method enables the legacy color support. `&c`, `&a`, etc.
97+
98+
99+
If you want to use the custom serializer, you need to set it in the `LiteCommands` builder:
100+
101+
<tabs>
102+
<tab title="Adventure">
103+
104+
```java
105+
.extension(new LiteAdventureExtension<SENDER>()
106+
.serializer(this.miniMessage)
107+
)
108+
```
109+
</tab>
110+
<tab title="Adventure Platform">
111+
112+
```java
113+
.extension(new LiteAdventurePlatformExtension<SENDER>(this.audienceProvider)
114+
.serializer(this.miniMessage)
115+
)
116+
```
117+
</tab>
118+
</tabs>
119+
120+
<warning>
121+
Remember to replace <code>SENDER</code> with your sender type that corresponds to the platform you are using.
122+
See <a href="SENDER.md">What is SENDER?</a> for more information.
123+
</warning>

Writerside/topics/Arguments.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Argument
2+
3+
Arguments are used to get the values from the command sender.
4+
5+
## @Arg Argument
6+
7+
`@Arg` is the most common argument. It is used to get the value from the command sender.
8+
9+
```java
10+
@Command(name = "ban")
11+
public class BanCommand {
12+
@Execute
13+
public void ban(@Arg Player player) {
14+
// ...
15+
}
16+
}
17+
```
18+
19+
## @Flag Argument
20+
21+
`@Flag` is used to get the value from the command sender, but it is optional.
22+
23+
```java
24+
@Command(name = "ban")
25+
public class BanCommand {
26+
@Execute
27+
public void ban(@Flag("-s") boolean isSilent) {
28+
// ...
29+
}
30+
}
31+
```
32+
33+
## @Join Argument
34+
35+
`@Join` is used to get the value from the command sender, it joins all arguments into one string.
36+
37+
```java
38+
@Command(name = "ban")
39+
public class BanCommand {
40+
@Execute
41+
public void ban(@Join String reason) {
42+
// ...
43+
}
44+
}
45+
```
46+
47+
Sometimes you may want to limit the number of arguments that will be joined.
48+
```java
49+
@Join(limit = 2)
50+
```
51+
52+
Or you may want to join arguments with a different separator.
53+
```java
54+
@Join(separator = ", ")
55+
```
56+
57+
## Full Example
58+
59+
```java
60+
@Command(name = "ban")
61+
public class BanCommand {
62+
@Execute
63+
public void ban(@Arg Player player, @Flag("-s") boolean isSilent, @Join String reason) {
64+
// ...
65+
}
66+
}
67+
```

Writerside/topics/Command.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Command
2+
3+
<tldr>
4+
<p>
5+
Annotations <shortcut>@Command</shortcut> <shortcut>@Execute</shortcut>
6+
</p>
7+
</tldr>
8+
9+
The command structure is the most important part of the command. It is the structure that determines how the command will be executed.
10+
11+
For example, the command `/time day`
12+
13+
```java
14+
@Command(name = "time")
15+
public class TimeCommand {
16+
17+
@Execute(name = "day")
18+
public void day() {
19+
// ... set time to day
20+
}
21+
22+
}
23+
```

Writerside/topics/Configuration.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Configuration
2+
3+
Create a new instance of `LiteCommands` using specific factory for your platform.
4+
5+
<tabs>
6+
7+
<!-- Bukkit -->
8+
<tab title="Bukkit">
9+
10+
```Java
11+
this.liteCommands = LiteCommandsBukkit.builder("my-plugin", this)
12+
.commands(
13+
new FlyCommand(),
14+
new GameModeCommand()
15+
)
16+
.build();
17+
```
18+
</tab>
19+
20+
<!-- Velocity -->
21+
<tab title="Velocity">
22+
23+
```Java
24+
this.liteCommands = LiteVelocityFactory.builder(this.proxyServer)
25+
.commands(
26+
new SendCommand(),
27+
new MoveCommand()
28+
)
29+
.build();
30+
```
31+
</tab>
32+
33+
<!-- BungeeCord -->
34+
<tab title="BungeeCord">
35+
36+
```Java
37+
this.liteCommands = LiteBungeeFactory.builder(this)
38+
.commands(
39+
new SendCommand(),
40+
new MoveCommand()
41+
)
42+
.build();
43+
```
44+
</tab>
45+
46+
<!-- Minestom -->
47+
<tab title="Minestom">
48+
49+
```Java
50+
Server server = MinecraftServer.getServer();
51+
CommandManager commandManager = MinecraftServer.getCommandManager();
52+
53+
this.liteCommands = LiteMinestomFactory.builder(server, commandManager)
54+
.commands(
55+
new FlyCommand(),
56+
new GameModeCommand()
57+
)
58+
.build();
59+
```
60+
</tab>
61+
62+
<!-- JDA -->
63+
<tab title="JDA">
64+
65+
```Java
66+
JDA jda = JDABuilder.createDefault("token")
67+
.build();
68+
69+
this.liteCommands = LiteJDAFactory.builder(jda)
70+
.commands(
71+
new EmbedCommand(),
72+
new MessageCommand()
73+
)
74+
.build();
75+
```
76+
</tab>
77+
78+
79+
</tabs>

0 commit comments

Comments
 (0)