Skip to content

Commit 0e83059

Browse files
authored
Merge pull request #4 from CommandAPI/dev/commandapi-paper
Add documentation for CommandAPI/CommandAPI#517
2 parents 1114bff + 948f9d4 commit 0e83059

File tree

259 files changed

+2892
-1476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+2892
-1476
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ reference-code.iml
88
reference-code/reference-code.iml
99
reference-code/target
1010
reference-code/build
11-
reference-code/.kotlin
12-
reference-code/.gradle
11+
reference-code/**/build
12+
**/.kotlin
13+
**/.gradle
1314

1415
package-lock.json
1516
.vscode

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ yarn install
1414
yarn docs:build
1515
```
1616

17+
### View website changes locally
18+
19+
```bash
20+
yarn docs:dev
21+
```
22+
1723
### Verify reference code
1824

1925
```bash

docs/.vitepress/config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const vitepressOptions: UserConfig = {
114114
}).then(_ => {
115115
})
116116
},
117-
config: (md) => {
117+
config: ( md) => {
118118
tabsPlugin(md);
119119
injectUpgradingPartsPlugin(md);
120120
mermaidSpaceConverter(md);

docs/.vitepress/theme/preference/PreferenceSwitch.vue

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
import {VTIconChevronDown, VTSwitch} from '@vue/theme'
55
import {useData, useRoute} from 'vitepress'
66
import {onMounted, ref, Ref, watch} from 'vue'
7-
import {openPreference, openPreferenceKey, preferGroovyInGradle, preferGroovyInGradleKey, preferMaven, preferMavenKey, preferReobf, preferReobfKey,} from "./preference";
7+
import {
8+
openPreference, openPreferenceKey,
9+
preferPaper, preferPaperKey,
10+
preferGroovyInGradle, preferGroovyInGradleKey,
11+
preferMaven, preferMavenKey
12+
} from "./preference";
813
914
const {frontmatter} = useData();
1015
let preferencesToDisplay: Ref<string[]> = ref();
@@ -36,6 +41,12 @@ const restoreOutline = (e: Event) => {
3641
(e.target as HTMLElement).classList.remove('no-outline');
3742
};
3843
44+
const togglePaper = useToggleFn(
45+
preferPaperKey,
46+
preferPaper,
47+
'prefer-paper'
48+
)
49+
3950
const toggleMaven = useToggleFn(
4051
preferMavenKey,
4152
preferMaven,
@@ -48,12 +59,6 @@ const toggleGradleDsl = useToggleFn(
4859
'prefer-groovy'
4960
);
5061
51-
const toggleMapping = useToggleFn(
52-
preferReobfKey,
53-
preferReobf,
54-
'prefer-reobf'
55-
)
56-
5762
function useToggleFn(
5863
storageKey: string,
5964
state: Ref<boolean>,
@@ -77,9 +82,9 @@ function useToggleFn(
7782
refresh()
7883
7984
onMounted(() => {
85+
togglePaper(preferPaper.value);
8086
toggleMaven(preferMaven.value);
8187
toggleGradleDsl(preferGroovyInGradle.value);
82-
toggleMapping(preferReobf.value);
8388
});
8489
</script>
8590

@@ -102,6 +107,16 @@ onMounted(() => {
102107
:aria-hidden="!openPreference"
103108
>
104109
<div class="mobile-wrapper switches">
110+
<div v-if="preferencesToDisplay.includes('paper-spigot')" class="switch-container">
111+
<label class="paper-label prefer-label-left" @click="togglePaper(true)">Paper</label>
112+
<VTSwitch
113+
class="platform-switch"
114+
aria-label="prefer paper"
115+
:aria-checked="preferPaper"
116+
@click="togglePaper()"
117+
/>
118+
<label class="spigot-label prefer-label-right" @click="togglePaper(false)">Spigot</label>
119+
</div>
105120
<div v-if="preferencesToDisplay.includes('build-system')" class="switch-container">
106121
<label class="gradle-label prefer-label-left" @click="toggleMaven(false)">Gradle</label>
107122
<VTSwitch
@@ -122,16 +137,6 @@ onMounted(() => {
122137
/>
123138
<label class="groovy-label prefer-label-right" @click="toggleGradleDsl(true)">.gradle</label>
124139
</div>
125-
<div v-if="preferencesToDisplay.includes('mapping')" class="switch-container">
126-
<label class="mojmap-label prefer-label-left" @click="toggleMapping(false)">Mojmap</label>
127-
<VTSwitch
128-
class="mapping-switch"
129-
aria-label="prefer reobf"
130-
:aria-checked="preferReobf"
131-
@click="toggleMapping()"
132-
/>
133-
<label class="reobf-label prefer-label-right" @click="toggleMapping(true)">Reobf</label>
134-
</div>
135140
</div>
136141
</div>
137142
<br class="hide-on-mobile" :hidden="openPreference"/>
@@ -270,59 +275,63 @@ onMounted(() => {
270275
</style>
271276

272277
<style>
278+
.paper,
273279
.maven,
274-
.groovy,
275-
.reobf {
280+
.groovy {
276281
display: none;
277282
}
278283
284+
.prefer-paper .spigot,
279285
.prefer-maven .gradle,
280-
.prefer-groovy .kts,
281-
.prefer-reobf .mojmap {
286+
.prefer-groovy .kts {
282287
display: none;
283288
}
284289
290+
.prefer-paper .paper,
285291
.prefer-maven .maven,
286-
.prefer-groovy .groovy,
287-
.prefer-reobf .reobf {
292+
.prefer-groovy .groovy {
288293
display: initial;
289294
}
290295
296+
.paper-label,
291297
.maven-label,
292298
.groovy-label,
293-
.reobf-label,
299+
.prefer-paper .spigot-label,
294300
.prefer-maven .gradle-label,
295-
.prefer-groovy .kts-label,
296-
.prefer-reobf .mojmap-label {
301+
.prefer-groovy .kts-label {
297302
color: var(--vt-c-text-3);
298303
}
299304
305+
.prefer-paper .paper-label,
300306
.prefer-maven .maven-label,
301-
.prefer-groovy .groovy-label,
302-
.prefer-reobf .reobf-label {
307+
.prefer-groovy .groovy-label {
303308
color: var(--vt-c-text-1);
304309
}
305310
306-
.prefer-maven .api-switch .vt-switch-check {
311+
.platform-switch .vt-switch-check {
307312
transform: translateX(18px);
308313
}
309314
310-
.prefer-groovy .dsl-switch .vt-switch-check {
315+
.prefer-paper .platform-switch .vt-switch-check {
316+
transform: translateX(0px);
317+
}
318+
319+
.prefer-maven .api-switch .vt-switch-check {
311320
transform: translateX(18px);
312321
}
313322
314-
.prefer-reobf .mapping-switch .vt-switch-check {
323+
.prefer-groovy .dsl-switch .vt-switch-check {
315324
transform: translateX(18px);
316325
}
317326
327+
.tip .paper,
328+
.tip .spigot,
318329
.tip .gradle,
319330
.tip .groovy,
320331
.tip .kts,
321-
.tip .maven,
322-
.tip .mojmap,
323-
.tip .reobf {
324-
color: var(--vt-c-text-code);
332+
.tip .maven {
333+
//color: var(--vt-c-text-code);
325334
/* transition: color 0.5s; */
326-
font-weight: 600;
335+
//font-weight: 600;
327336
}
328337
</style>

docs/.vitepress/theme/preference/preference.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ function getBoolean(key: string, defaultValue: boolean) {
1212
export const openPreferenceKey = 'command-api-docs-prefer-open-preference'
1313
export const openPreference = ref(getBoolean(openPreferenceKey, true))
1414

15+
export const preferPaperKey = 'command-api-docs-prefer-paper'
16+
export const preferPaper = ref(getBoolean(preferPaperKey, true))
17+
1518
export const preferMavenKey = 'command-api-docs-prefer-maven'
1619
export const preferMaven = ref(getBoolean(preferMavenKey, false))
1720

1821
export const preferGroovyInGradleKey = 'command-api-docs-prefer-groovy-dsl-in-gradle'
19-
export const preferGroovyInGradle = ref(getBoolean(preferGroovyInGradleKey, false))
20-
21-
export const preferReobfKey = 'command-api-docs-prefer-mojmap'
22-
export const preferReobf = ref(getBoolean(preferReobfKey, false))
22+
export const preferGroovyInGradle = ref(getBoolean(preferGroovyInGradleKey, false))

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const upgradingInfos: UpgradingInfo[] = [
1919
{from: '9.0.3', to: '9.1.0'},
2020
{from: '9.2.0', to: '9.3.0'},
2121
{from: '9.7.0', to: '10.0.0'},
22+
{from: '10.1.2', to: '11.0.0'}
2223
]
2324

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

docs/en/annotations/annotations.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ This page outlines in detail the list of all annotations that the CommandAPI's a
1414

1515
The `@Command` annotation is used to declare a command. The parameter is the name of the command that will be registered.
1616

17-
<<< @/../reference-code/src/main/java/annotations/WarpCommand.java#declareCommand
17+
<<< @/../reference-code/bukkit/src/main/java/annotations/WarpCommand.java#declareCommand
1818

1919
### `@Alias({...})`
2020

2121
The `@Alias` annotation is used to declare a list of aliases for a command. The parameter is a list of aliases which can be used for the command.
2222

23-
<<< @/../reference-code/src/main/java/annotations/aliasClassExample/TeleportCommand.java#aliasClassExample
23+
<<< @/../reference-code/bukkit/src/main/java/annotations/aliasClassExample/TeleportCommand.java#aliasClassExample
2424

2525
### `@Permission("permissionNode")`
2626

2727
The `@Permission` annotation is used to add a permission node to a command. Users that want to run this command must have this permission. The parameter is the permission node required to run the command.
2828

29-
<<< @/../reference-code/src/main/java/annotations/permissionClassExample/TeleportCommand.java#permissionClassExample
29+
<<< @/../reference-code/bukkit/src/main/java/annotations/permissionClassExample/TeleportCommand.java#permissionClassExample
3030

3131
### `@NeedsOp`
3232

3333
The `@NeedsOp` annotation is used to indicate that a command needs to have operator privileges to run it. This annotation has no parameters.
3434

35-
<<< @/../reference-code/src/main/java/annotations/needsOpClassExample/TeleportCommand.java#needsOpClassExample
35+
<<< @/../reference-code/bukkit/src/main/java/annotations/needsOpClassExample/TeleportCommand.java#needsOpClassExample
3636

3737
### `@Help("Full description")`
3838

3939
The `@Help` annotation is used to add a help topic to a command. This annotation can take two forms:
4040

4141
A simple form which just uses a string which is used as the full description for a command:
4242

43-
<<< @/../reference-code/src/main/java/annotations/helpClassExample/TeleportCommand.java#helpClassExample
43+
<<< @/../reference-code/bukkit/src/main/java/annotations/helpClassExample/TeleportCommand.java#helpClassExample
4444

4545
A form with two parameters `value` and `shortDescription`, to provide the full description (`value`) and short description (`shortDescription`) content for a command:
4646

47-
<<< @/../reference-code/src/main/java/annotations/shortHelpClassExample/TeleportCommand.java#shortHelpClassExample
47+
<<< @/../reference-code/bukkit/src/main/java/annotations/shortHelpClassExample/TeleportCommand.java#shortHelpClassExample
4848

4949
## Annotations that go on methods
5050

@@ -54,27 +54,27 @@ To use annotations on methods, **methods must be static**.
5454

5555
The `@Default` annotation indicates that the method is _not_ a subcommand. This acts in a similar way to regular Bukkit commands. Commands with the `@Default` annotation can be used to run the main code when the command named with the `@Command` annotation is stated, such as the following:
5656

57-
<<< @/../reference-code/src/main/java/annotations/DefaultMethodExample.java#defaultMethodExample
57+
<<< @/../reference-code/bukkit/src/main/java/annotations/DefaultMethodExample.java#defaultMethodExample
5858

5959
The `@Default` annotation does not mean that the command can't have arguments! Arguments can still be used and declared as shown:
6060

61-
<<< @/../reference-code/src/main/java/annotations/DefaultMethodExample.java#defaultWithArgsMethodExample
61+
<<< @/../reference-code/bukkit/src/main/java/annotations/DefaultMethodExample.java#defaultWithArgsMethodExample
6262

6363
### `@Subcommand`
6464

6565
The `@Subcommand` simply tells the CommandAPI that the declared method is a subcommand. This acts in a similar way to the regular CommandAPI's `.withSubcommand()` method. The subcommand annotation can take in a single string which is the name of the subcommand:
6666

67-
<<< @/../reference-code/src/main/java/annotations/SubcommandMethodExample.java#subcommandMethodExample
67+
<<< @/../reference-code/bukkit/src/main/java/annotations/SubcommandMethodExample.java#subcommandMethodExample
6868

6969
Or, it can take in a list of strings which represent the _aliases_ that can also be used for the declared subcommand:
7070

71-
<<< @/../reference-code/src/main/java/annotations/SubcommandMethodExample.java#subcommandAliasesMethodExample
71+
<<< @/../reference-code/bukkit/src/main/java/annotations/SubcommandMethodExample.java#subcommandAliasesMethodExample
7272

7373
### `@Permission`
7474

7575
The `@Permission` annotation can also be used on methods to indicate that a permission is required to execute a command.
7676

77-
<<< @/../reference-code/src/main/java/annotations/PermissionMethodExample.java#permissionMethodExample
77+
<<< @/../reference-code/bukkit/src/main/java/annotations/PermissionMethodExample.java#permissionMethodExample
7878

7979
### `@NeedsOp`
8080

@@ -88,14 +88,14 @@ The annotations for arguments are really simple, there are just two things you n
8888

8989
$$\begin{align}
9090
\texttt{StringArgument}&\xrightarrow{A}\texttt{@AStringArgument}\\\\
91-
\texttt{PlayerArgument}&\xrightarrow{A}\texttt{@APlayerArgument}\\\\
91+
\texttt{IntegerArgument}&\xrightarrow{A}\texttt{@AIntegerArgument}\\\\
9292
\texttt{AdvancementArgument}&\xrightarrow{A}\texttt{@AAdvancementArgument}\\\\
9393
&\hspace{0.75em}\vdots
9494
\end{align}$$
9595

9696
For example, we use `@AStringArgument` to indicate that this command takes a `StringArgument` as its first parameter:
9797

98-
<<< @/../reference-code/src/main/java/annotations/ParameterExample.java#simpleParameterExample
98+
<<< @/../reference-code/bukkit/src/main/java/annotations/ParameterExample.java#simpleParameterExample
9999

100100
- **The name of the argument (referred to as "nodeName" in the normal CommandAPI system) is the name of the variable assigned to the parameter.** In the above code, this means that the name of the argument is `warpName`.
101101

@@ -107,18 +107,18 @@ Certain argument annotations have extra parameters that can be supplied to provi
107107

108108
The following numerical arguments can take both a `min` and `max` value. Both of these are completely optional. This indicates the range of values (inclusive) that is valid for this argument. For example:
109109

110-
<<< @/../reference-code/src/main/java/annotations/ParameterExample.java#numericalParameterExample
110+
<<< @/../reference-code/bukkit/src/main/java/annotations/ParameterExample.java#numericalParameterExample
111111

112112
#### Literal arguments
113113

114114
Both the `LiteralArgument` and `MultiLiteralArgument` can be used. When these are used, the name of the variable assigned to the parameter is _ignored_ and not used as the argument's name.
115115

116116
For the `@ALiteralArgument` annotation, the parameter is the literal to be used for the command. For the `@AMultiLiteralArgument`, the parameter can be an array of multiple literals to use:
117117

118-
<<< @/../reference-code/src/main/java/annotations/ParameterExample.java#literalParameterExample
118+
<<< @/../reference-code/bukkit/src/main/java/annotations/ParameterExample.java#literalParameterExample
119119

120120
#### Other arguments
121121

122122
The `LocationArgument`, `Location2DArgument`, `EntitySelectorArgument` and `ScoreHolderArgument` can all take an extra parameter in their constructors. As a result, the annotation-equivalent of these arguments also allow you to provide the parameter in the annotation:
123123

124-
<<< @/../reference-code/src/main/java/annotations/ParameterExample.java#otherParameterExample
124+
<<< @/../reference-code/bukkit/src/main/java/annotations/ParameterExample.java#otherParameterExample

0 commit comments

Comments
 (0)