Skip to content

Commit bffdb8b

Browse files
committed
Add documentation for CommandAPI/CommandAPI#517
1 parent 334d68e commit bffdb8b

File tree

8 files changed

+336
-91
lines changed

8 files changed

+336
-91
lines changed

docs/.vitepress/theme/upgrading/upgrading.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const upgradingInfos: UpgradingInfo[] = [
1818
{from: '9.0.1', to: '9.0.2'},
1919
{from: '9.0.3', to: '9.1.0'},
2020
{from: '9.2.0', to: '9.3.0'},
21+
{from: '9.7.1', to: '10.0.0'}
2122
]
2223

2324
export const keyVersions = Array.from(new Set(upgradingInfos.map(info => [info.from, info.to]).flat()));

docs/en/create-commands/arguments/arguments.md

Lines changed: 64 additions & 64 deletions
Large diffs are not rendered by default.

docs/en/create-commands/arguments/types/chat/adventure-chat-arguments.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@ authors:
88

99
# Adventure chat arguments
1010

11-
:::info
11+
From Paper 1.16.5 build #473 onwards, Paper now includes [Kyori's Adventure API](https://github.com/KyoriPowered/adventure-platform). This library is a replacement of the BungeeCord chat API and has all the same functionality as the BungeeCord chat API (and more!). The documentation for this API can be found [here](https://docs.adventure.kyori.net/index.html).
1212

13-
The two following classes, `AdventureChatComponentArgument` and `AdventureChatArgument` depend on a Paper-based server which has the Adventure library. If you use this class on a server without the Adventure library, it will throw a `PaperAdventureNotFoundException`
13+
Since this functions very similar to the Spigot chat arguments, this page won't reiterate everything about how it works, we'll just outline some examples of how to use these arguments instead.
14+
Additionally, the names used here may be confusing as they are the same names as on the [Spigot chat arguments](spigot-chat-arguments.md) page but have different return types. This is because the classes on this page are only accessible using `commandapi-paper-core` or `commandapi-paper-shade`
15+
while the arguments on the Spigot chat arguments page are only available when using `commandapi-spigot-core` or `commandapi-spigot-shade`.
1416

15-
:::
17+
:::info
1618

17-
From Paper 1.16.5 build #473 onwards, Paper now includes [Kyori's Adventure API](https://github.com/KyoriPowered/adventure-platform). This library is a replacement of the BungeeCord chat API and has all the same functionality as the BungeeCord chat API (and more!). The documentation for this API can be found [here](https://docs.adventure.kyori.net/index.html).
19+
The three following classes, `ChatColorArgument`, `ChatComponentArgument` and `ChatArgument` depend on a Paper based server which has the Adventure library. If you use any of these classes on a server without the Adventure library, they will throw a `PaperAdventureNotFoundException`.
1820

19-
Since this functions very similar to the Spigot chat arguments, this page won't reiterate everything about how it works, we'll just outline some examples of how to use these arguments instead.
21+
:::
2022

2123
## Adventure chat color argument
2224

2325
![Chatcolor argument in-game, displaying a list of Minecraft chat colors](/images/arguments/chatcolor.png)
2426

25-
The `AdventureChatColorArgument` class is used to represent a given chat color (e.g., red or green). This argument returns the `NamedTextColor` object. If `reset` is passed to this argument, this will return `NamedTextColor.WHITE`.
27+
The `ChatColorArgument` class is used to represent a given chat color (e.g., red or green). This argument returns the `NamedTextColor` object. If `reset` is passed to this argument, this will return `NamedTextColor.WHITE`.
2628

2729
::::tip Example – Username color changing plugin
2830

@@ -47,7 +49,7 @@ We then use the `ChatColorArgument` to change the player's name color:
4749

4850
## Adventure chat component argument
4951

50-
The `AdventureChatComponentArgument` class accepts raw chat-based JSON as valid input, as declared [here](https://minecraft.wiki/w/Raw_JSON_text_format). This is converted into Adventure's `Component` class.
52+
The `ChatComponentArgument` class accepts raw chat-based JSON as valid input, as declared [here](https://minecraft.wiki/w/Raw_JSON_text_format). This is converted into Adventure's `Component` class.
5153

5254
::::tip Example – Opening a book with raw JSON content
5355

@@ -72,11 +74,11 @@ We can construct a book using the Adventure API's `Book.book(Component, Componen
7274

7375
## Adventure chat argument
7476

75-
The `AdventureChatArgument` class is the equivalent Adventure API class for the `ChatArgument` - it represents infinitely long strings similar to the `GreedyStringArgument` and allows entity selectors such as `@e`, `@p` and so on. The `AdventureChatArgument` returns a `Component`, similar to the `AdventureChatComponentArgument`.
77+
The `ChatArgument` represents infinitely long strings similar to the `GreedyStringArgument` and allows entity selectors such as `@e`, `@p` and so on. The `ChatArgument` returns a `Component`, similar to the `ChatComponentArgument`.
7678

7779
::::tip Example – Sending personalized messages to players
7880

79-
We'll take the same example from the `ChatArgument` class, but using the `AdventureChatArgument` instead - We want to create a personalized message broadcasted to all users using a chat component that allows entity selectors. For this command, we want the following syntax:
81+
We want to create a personalized message broadcasted to all users using a chat component that allows entity selectors. For this command, we want the following syntax:
8082

8183
```mccmd
8284
/pbroadcast <message>

docs/en/dev-setup/setup.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,30 @@ If you've never used a build system before, I highly recommend it! It makes it e
4646
4747
- Add the dependency to your `pom.xml`:
4848

49+
:::tabs
50+
===Paper
4951
```xml
5052
<dependencies>
5153
<dependency>
5254
<groupId>dev.jorel</groupId>
53-
<artifactId>commandapi-bukkit-core</artifactId>
55+
<artifactId>commandapi-paper-core</artifactId>
5456
<version>9.7.0</version>
5557
<scope>provided</scope>
5658
</dependency>
5759
</dependencies>
5860
```
61+
===Spigot
62+
```xml
63+
<dependencies>
64+
<dependency>
65+
<groupId>dev.jorel</groupId>
66+
<artifactId>commandapi-spigot-core</artifactId>
67+
<version>9.7.0</version>
68+
<scope>provided</scope>
69+
</dependency>
70+
</dependencies>
71+
```
72+
:::
5973

6074
</div>
6175
<div class="gradle">
@@ -88,21 +102,38 @@ If you've never used a build system before, I highly recommend it! It makes it e
88102

89103
<div class="groovy">
90104

105+
:::tabs
106+
===Paper
91107
```groovy
92108
dependencies {
93-
compileOnly "dev.jorel:commandapi-bukkit-core:9.7.0"
109+
compileOnly "dev.jorel:commandapi-paper-core:9.7.0"
94110
}
95111
```
112+
===Spigot
113+
```groovy
114+
dependencies {
115+
compileOnly "dev.jorel:commandapi-spigot-core:9.7.0"
116+
}
117+
```
118+
:::
96119

97120
</div>
98121
<div class="kts">
99122

123+
:::tabs
124+
===Paper
100125
```kotlin
101126
dependencies {
102-
compileOnly("dev.jorel:commandapi-bukkit-core:9.7.0")
127+
compileOnly("dev.jorel:commandapi-paper-core:9.7.0")
103128
}
104129
```
105-
130+
===Spigot
131+
```kotlin
132+
dependencies {
133+
compileOnly("dev.jorel:commandapi-spigot-core:9.7.0")
134+
}
135+
```
136+
:::
106137
</div>
107138

108139
</div>

docs/en/dev-setup/shading.md

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,36 @@ public class CommandAPIConfig {
5050

5151
The `CommandAPIConfig` class follows a typical builder pattern (without you having to run `.build()` at the end), which lets you easily construct configuration instances.
5252

53-
However, the `CommandAPIConfig` class is abstract and can’t be used to configure the CommandAPI directly. Instead, you must use a subclass of `CommandAPIConfig` that corresponds to the platform you’re developing for. For example, when developing for Bukkit, you should use the `CommandAPIBukkitConfig` class.
53+
However, the `CommandAPIConfig` class is abstract and can’t be used to configure the CommandAPI directly. Instead, you must use a subclass of `CommandAPIConfig` that corresponds to the platform you’re developing for. For example, when developing for a Bukkit-based server, you should use the `CommandAPIPaperConfig` or the `CommandAPISpigotConfig` class.
5454

5555
<!-- TODO: Add tabs and explanations for other platforms -->
5656

57+
:::tabs
58+
===Bukkit
5759
```java
58-
public class CommandAPIBukkitConfig extends CommandAPIConfig {
60+
public abstract class CommandAPIBukkitConfig extends CommandAPIConfig {
5961
CommandAPIBukkitConfig(JavaPlugin plugin);
6062

61-
CommandAPIBukkitConfig shouldHookPaperReload(boolean hooked); // Whether the CommandAPI should hook into the Paper-exclusive ServerResourcesReloadedEvent
6263
CommandAPIBukkitConfig skipReloadDatapacks(boolean skip); // Whether the CommandAPI should reload datapacks on server load
6364
}
6465
```
66+
===Paper
67+
```java
68+
public class CommandAPIPaperConfig extends CommandAPIBukkitConfig {
69+
CommandAPIPaperConfig(JavaPlugin plugin);
70+
71+
CommandAPIPaperConfig shouldHookPaperReload(boolean hooked); // Whether the CommandAPI should hook into the Paper-exclusive ServerResourcesReloadedEvent
72+
}
73+
```
74+
===Spigot
75+
```java
76+
public class CommandAPISpigotConfig extends CommandAPIBukkitConfig {
77+
CommandAPISpigotConfig(JavaPlugin plugin);
78+
}
79+
```
80+
:::
6581

66-
In order to create a `CommandAPIBukkitConfig` object, you must give it a reference to your `JavaPlugin` instance. The CommandAPI always uses this to register events, so it is required when loading the CommandAPI on Bukkit. There are also Bukkit-specific features, such as the `hook-paper-reload` configuration option, which may be configured using a `CommandAPIBukkitConfig` instance.
82+
In order to create a `CommandAPIPaperConfig` or a `CommandAPISpigotConfig` object, you must give it a reference to your `JavaPlugin` instance. The CommandAPI always uses this to register events, so it is required when loading the CommandAPI on Bukkit. There are also platform-specific features, such as the `hook-paper-reload` configuration option on Paper, which may be configured using a `CommandAPIPaperConfig` instance.
6783

6884
For example, to load the CommandAPI on Bukkit with all logging disabled, you can use the following:
6985

@@ -109,27 +125,55 @@ Add the CommandAPI shade dependency:
109125

110126
<div class="reobf">
111127

128+
:::tabs
129+
===Paper
112130
```xml
113131
<dependencies>
114132
<dependency>
115133
<groupId>dev.jorel</groupId>
116-
<artifactId>commandapi-bukkit-shade</artifactId>
134+
<artifactId>commandapi-paper-shade</artifactId>
117135
<version>9.7.0</version>
118136
</dependency>
119137
</dependencies>
120138
```
139+
===Spigot
140+
```xml
141+
<dependencies>
142+
<dependency>
143+
<groupId>dev.jorel</groupId>
144+
<artifactId>commandapi-spigot-shade</artifactId>
145+
<version>9.7.0</version>
146+
</dependency>
147+
</dependencies>
148+
```
149+
:::
150+
121151
</div>
122152
<div class="mojmap">
123153

154+
:::tabs
155+
===Paper
156+
```xml
157+
<dependencies>
158+
<dependency>
159+
<groupId>dev.jorel</groupId>
160+
<artifactId>commandapi-paper-shade-mojang-mapped</artifactId>
161+
<version>9.7.0</version>
162+
</dependency>
163+
</dependencies>
164+
```
165+
===Spigot
124166
```xml
125167
<dependencies>
126168
<dependency>
127169
<groupId>dev.jorel</groupId>
128-
<artifactId>commandapi-bukkit-shade-mojang-mapped</artifactId>
170+
<artifactId>commandapi-spigot-shade-mojang-mapped</artifactId>
129171
<version>9.7.0</version>
130172
</dependency>
131173
</dependencies>
132174
```
175+
:::
176+
133177
</div>
134178

135179
You can shade the CommandAPI easily by adding the `maven-shade-plugin` to your build sequence:
@@ -220,37 +264,77 @@ Next, we declare our dependencies:
220264
<div class="groovy">
221265
<div class="reobf">
222266

267+
:::tabs
268+
===Paper
269+
```groovy
270+
dependencies {
271+
implementation "dev.jorel:commandapi-paper-shade:9.7.0"
272+
}
273+
```
274+
===Spigot
223275
```groovy
224276
dependencies {
225-
implementation "dev.jorel:commandapi-bukkit-shade:9.7.0"
277+
implementation "dev.jorel:commandapi-spigot-shade:9.7.0"
226278
}
227279
```
280+
:::
281+
228282
</div>
229283
<div class="mojmap">
230284

285+
:::tabs
286+
===Paper
231287
```groovy
232288
dependencies {
233-
implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0"
289+
implementation "dev.jorel:commandapi-paper-shade-mojang-mapped:9.7.0"
234290
}
235291
```
292+
===Spigot
293+
```groovy
294+
dependencies {
295+
implementation "dev.jorel:commandapi-spigot-shade-mojang-mapped:9.7.0"
296+
}
297+
```
298+
:::
299+
236300
</div>
237301
</div>
238302
<div class="kts">
239303
<div class="reobf">
240304

305+
:::tabs
306+
===Paper
241307
```kotlin
242308
dependencies {
243-
implementation("dev.jorel:commandapi-bukkit-shade:9.7.0")
309+
implementation("dev.jorel:commandapi-paper-shade:9.7.0")
244310
}
245311
```
312+
===Spigot
313+
```kotlin
314+
dependencies {
315+
implementation("dev.jorel:commandapi-spigot-shade:9.7.0")
316+
}
317+
```
318+
:::
319+
246320
</div>
247321
<div class="mojmap">
248322

323+
:::tabs
324+
===Paper
249325
```kotlin
250326
dependencies {
251-
implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0")
327+
implementation("dev.jorel:commandapi-paper-shade-mojang-mapped:9.7.0")
252328
}
253329
```
330+
===Spigot
331+
```kotlin
332+
dependencies {
333+
implementation("dev.jorel:commandapi-spigot-shade-mojang-mapped:9.7.0")
334+
}
335+
```
336+
:::
337+
254338
</div>
255339
</div>
256340

docs/en/kotlin-dsl/intro.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,34 @@ This DSL provides many methods to easily add arguments to your command structure
1515

1616
## Installing the DSL
1717

18-
To install the DSL, you need to add the `commandapi-bukkit-kotlin` dependency into your `pom.xml` or your `build.gradle`, making sure to specify the server flavor you are developing for:
18+
To install the DSL, you need to add the Kotlin DSL dependency into your build script, making sure to specify the server flavor you are developing for:
1919

2020
### Adding the dependency
2121

2222
<div class="maven">
2323

24+
:::tabs
25+
===Paper
2426
```xml
2527
<dependencies>
2628
<dependency>
2729
<groupId>dev.jorel</groupId>
28-
<artifactId>commandapi-bukkit-kotlin</artifactId>
30+
<artifactId>commandapi-kotlin-paper</artifactId>
2931
<version>9.7.0</version>
3032
</dependency>
3133
</dependencies>
3234
```
35+
===Spigot
36+
```xml
37+
<dependencies>
38+
<dependency>
39+
<groupId>dev.jorel</groupId>
40+
<artifactId>commandapi-kotlin-spigot</artifactId>
41+
<version>9.7.0</version>
42+
</dependency>
43+
</dependencies>
44+
```
45+
:::
3346

3447
Next, you need to add Kotlin to your project. For this, you first need to add the dependency:
3548

@@ -104,20 +117,38 @@ Next, you need to add the dependency:
104117

105118
<div class="groovy">
106119

120+
:::tabs
121+
===Paper
107122
```groovy
108123
dependencies {
109-
implementation "dev.jorel:commandapi-bukkit-kotlin:9.7.0"
124+
implementation "dev.jorel:commandapi-kotlin-paper:9.7.0"
110125
}
111126
```
127+
===Spigot
128+
```groovy
129+
dependencies {
130+
implementation "dev.jorel:commandapi-kotlin-spigot:9.7.0"
131+
}
132+
```
133+
:::
112134

113135
</div>
114136
<div class="kts">
115137

138+
:::tabs
139+
===Paper
140+
```kotlin
141+
dependencies {
142+
implementation("dev.jorel:commandapi-kotlin-paper:9.7.0")
143+
}
144+
```
145+
===Spigot
116146
```kotlin
117147
dependencies {
118-
implementation("dev.jorel:commandapi-bukkit-kotlin:9.7.0")
148+
implementation("dev.jorel:commandapi-kotlin-spigot:9.7.0")
119149
}
120150
```
151+
:::
121152

122153
</div>
123154

0 commit comments

Comments
 (0)