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

Commit ccd6925

Browse files
committed
Update WiP
1 parent ce65329 commit ccd6925

12 files changed

+411
-130
lines changed

Writerside/litecommands.tree

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

99
<toc-element topic="Introdution.md">
10-
<toc-element topic="Why-use-LiteCommands.md"/>
1110
<toc-element topic="Getting-started.md"/>
1211
</toc-element>
13-
<toc-element topic="Platforms.md"/>
12+
<toc-element topic="Platforms.md">
13+
<toc-element topic="SENDER.md"/>
14+
<toc-element topic="Bukkit-Platform.md"/>
15+
</toc-element>
16+
<toc-element topic="Adventure-Kyori.md">
17+
<toc-element topic="adventure.md"/>
18+
<toc-element topic="adventure-platform.md"/>
19+
<toc-element topic="Adventure-Usage.md"/>
20+
</toc-element>
1421
</instance-profile>

Writerside/redirection-rules.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
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>
1721
</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/Bukkit-Platform.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Bukkit
2+

Writerside/topics/Getting-started.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Getting started
22

3-
This page will help you to get started with LiteCommands.
3+
This page will guide you through the process of setting up LiteCommands in your project.
4+
After reading this page, you will be able to use LiteCommands in your project.
45

56
## Requirements
67

@@ -34,5 +35,6 @@ implementation("dev.rollczi:[[[ARTIFACT_ID|Platforms.md]]]:3.0.1")
3435

3536
</tabs>
3637

37-
Replace [ARTIFACT_ID](Platforms.md) with the artifact ID of the platform you want to use.
38-
You can find all of them in the [Platforms](Platforms.md) page.
38+
> Replace [ARTIFACT_ID](Platforms.md) with the artifact ID of the platform you want to use.
39+
> You can find all of them in the [Platforms](Platforms.md) page.
40+
{ style="warning" }

Writerside/topics/Introdution.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,115 @@
11
# Introduction
22

3+
Welcome to the LiteCommands documentation! Here you will find everything you need to know about LiteCommands.
4+
5+
## Why use LiteCommands?
6+
7+
LiteCommands is a versatile and feature-rich command framework
8+
designed to simplify command handling for a wide range of platforms and implementations.
9+
Providing a simple and intuitive API, LiteCommands makes it easy to create and manage commands
10+
for your minecraft **plugin**, **mod**, or **discord bot**.
11+
12+
## Cross-Platform Integration
13+
LiteCommands seamlessly integrates with various platforms, making it effortless to manage
14+
commands across different systems.
15+
Whether you're developing for **Velocity**, **Bukkit**, **Paper**, **BungeeCord**, **Minestom**, **JDA**,
16+
or any other platform, LiteCommands has you covered.
17+
18+
See the [Platforms](Platforms.md) page for more information.
19+
20+
## More Clear Logic
21+
22+
LiteCommands offers a more intuitive and clear approach to handling commands when
23+
compared to the traditional methods.
24+
25+
<tabs>
26+
<tab title="LiteCommands">
27+
28+
```java
29+
30+
@[[[Command|Platforms.md]]](name = "chat")
31+
@Permission("command.chat")
32+
public class ChatCommand {
33+
34+
private final ChatManager chatManager = new ChatManager();
35+
36+
@Execute(name = "on")
37+
void enableChat(@Context CommandSender sender) {
38+
this.chatManager.enableChat();
39+
}
40+
41+
@Execute(name = "off")
42+
void disableChat(@Context CommandSender sender) {
43+
this.chatManager.disableChat();
44+
}
45+
46+
@Execute(name = "clear")
47+
@Permission("command.chat.clear")
48+
void clearChat(@Context CommandSender sender, @Arg int lines) {
49+
this.chatManager.clearChat(lines);
50+
}
51+
52+
}
53+
```
54+
55+
</tab>
56+
<tab title="Traditional">
57+
58+
```Java
59+
public class BukkitWayCommand implements CommandExecutor {
60+
61+
private final ChatManager chatManager = new ChatManager();
62+
63+
@Override
64+
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
65+
if (!sender.hasPermission("command.chat")) {
66+
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
67+
return true;
68+
}
69+
70+
if (args.length == 0) {
71+
this.usage(sender);
72+
return true;
73+
}
74+
75+
if (args[0].equalsIgnoreCase("on")) {
76+
this.chatManager.enableChat();
77+
return true;
78+
}
79+
80+
if (args[0].equalsIgnoreCase("off")) {
81+
this.chatManager.disableChat();
82+
return true;
83+
}
84+
85+
if (args.length == 2 && args[0].equalsIgnoreCase("clear")) {
86+
if (!sender.hasPermission("command.chat.clear")) {
87+
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
88+
return true;
89+
}
90+
91+
try {
92+
int lines = Integer.parseInt(args[1]);
93+
this.chatManager.clearChat(lines);
94+
} catch (NumberFormatException exeption) {
95+
sender.sendMessage(ChatColor.RED + "Invalid argument: " + args[1] + " is not a number.");
96+
}
97+
98+
return true;
99+
}
100+
101+
this.usage(sender);
102+
return true;
103+
}
104+
105+
private void usage(CommandSender sender) {
106+
sender.sendMessage(ChatColor.RED + "Usage:");
107+
sender.sendMessage(ChatColor.RED + " - /chat on");
108+
sender.sendMessage(ChatColor.RED + " - /chat off");
109+
sender.sendMessage(ChatColor.RED + " - /chat clear <lines>");
110+
}
111+
112+
}
113+
```
114+
</tab>
115+
</tabs>

Writerside/topics/Platforms.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,8 @@ LiteCommands supports multiple platforms and extensions for them. You can find a
1010
| `litecommands-minestom` | Minestom | 1.20.2 |
1111
| `litecommands-jda` | JDA | 5.0.0-beta.15 |
1212

13-
## Optional Adventure extension
1413

15-
| Platform Artifact | Extension Artifact | Compatible Platforms | Compatible Versions |
16-
|---------------------------|-----------------------------------|-------------------------------|---------------------|
17-
| `litecommands-bukkit` | `litecommands-adventure` | Paper, Purpur | 1.16 - 1.20.2 |
18-
| `litecommands-bukkit` | `litecommands-adventure-platform` | Bukkit, Spigot, Paper, Purpur | 1.8.8 - 1.20.2 |
19-
| `litecommands-bungeecord` | `litecommands-adventure-platform` | BungeeCord, Waterfall | 1.20-R0.1 |
20-
| `litecommands-velocity` | build-in | Velocity | 3.2.0 |
21-
| `litecommands-minestom` | build-in | Minestom | 1.20.2 |
22-
23-
Platforms:
14+
More information about each platform can be found on the following pages:
2415
- [Bukkit](https://dev.bukkit.org/)
2516
- [Spigot](https://www.spigotmc.org/wiki/spigot-maven/)
2617
- [Paper](https://docs.papermc.io/paper/devi)
@@ -29,7 +20,4 @@ Platforms:
2920
- [Waterfall](https://docs.papermc.io/waterfall/getting-started)
3021
- [Velocity](https://docs.papermc.io/velocity/dev/)
3122
- [Minestom](https://github.com/Minestom/Minestom)
32-
- [JDA](https://github.com/discord-jda/JDA)
33-
Extensions for platforms:
34-
- [Adventure](https://docs.advntr.dev/getting-started.html)
35-
- [Adventure Platform](https://docs.advntr.dev/platform/index.html)
23+
- [JDA](https://github.com/discord-jda/JDA)

Writerside/topics/SENDER.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# What is SENDER?
2+
3+
LiteCommands uses the `SENDER` type in the documentation to indicate the sender type that corresponds to the platform you are using.
4+
5+
Depending on the platform, the sender type may be different.
6+
7+
| Platform | Sender Type | Sender Import |
8+
|------------|-----------------|-------------------------------------------------|
9+
| Bukkit | `CommandSender` | `org.bukkit.command.CommandSender` |
10+
| Velocity | `CommandSource` | `com.velocitypowered.api.command.CommandSource` |
11+
| BungeeCord | `CommandSender` | `net.md_5.bungee.api.CommandSender` |
12+
| Minestom | `CommandSender` | `net.minestom.server.command.CommandSender` |
13+
| JDA | `User` | `net.dv8tion.jda.api.entities.User` |

0 commit comments

Comments
 (0)