Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f6aa49d
Update to version 11.0.0-SNAPSHOT
willkroboth Aug 20, 2025
8e2b800
Add documentation for https://github.com/CommandAPI/CommandAPI/pull/517
DerEchtePilz Feb 17, 2025
085078e
Add diff language support
DerEchtePilz Feb 17, 2025
2516a3a
Update mappings preference switch to say "Paper" and "Spigot" instead…
DerEchtePilz Aug 22, 2025
d81cac5
Document the updated config options
DerEchtePilz Aug 22, 2025
7408d7e
Update default configs
DerEchtePilz Aug 22, 2025
759a92c
Rename "mappings" preference to "paper-spigot" and use that on the co…
DerEchtePilz Aug 22, 2025
a3b2790
Finish config page
DerEchtePilz Aug 22, 2025
74134e4
Move documentation code to a new bukkit submodule in preparation for …
DerEchtePilz Sep 11, 2025
4e432e9
Setup buildSrc
DerEchtePilz Sep 11, 2025
e9dfa20
Add empty Paper/Spigot/Velocity modules
DerEchtePilz Sep 11, 2025
5dbe76f
Make Kotlin examples compile
DerEchtePilz Sep 12, 2025
d6abfcf
Make Java examples compile
DerEchtePilz Sep 13, 2025
eb7d287
Update code references
DerEchtePilz Sep 13, 2025
bc22213
Use more Paper/Spigot preference switches
DerEchtePilz Sep 13, 2025
b897923
Update ranged-arguments.md to correctly mention the DoubleRangeArgument
DerEchtePilz Sep 13, 2025
50b2d67
Update entities-arguments.md to now metion PlayerProfileArgument inst…
DerEchtePilz Sep 13, 2025
8476ecf
Update adventure chat arguments page
DerEchtePilz Sep 13, 2025
8390216
Update BlockStateArgument page
DerEchtePilz Sep 13, 2025
a6ce6ad
Replace PlayerArgument with EntitySelectorArgument.OnePlayer where ap…
DerEchtePilz Sep 13, 2025
b1f3688
Update cast table and safe suggestion table
DerEchtePilz Sep 13, 2025
446df85
Update unregistration page
DerEchtePilz Sep 14, 2025
2873d18
Start dealing with the code review
DerEchtePilz Sep 24, 2025
d48945f
Update functions.md
DerEchtePilz Sep 24, 2025
74043fa
Update image for ranged arguments
DerEchtePilz Sep 24, 2025
3eb3d19
I forgot these
DerEchtePilz Sep 24, 2025
7e50b54
Mention spigot vs paper test toolkit
willkroboth Sep 7, 2025
0cd01d4
Fix reference-code compilation
willkroboth Sep 23, 2025
85f9122
Update documentation references to code examples
willkroboth Sep 23, 2025
66e8879
Add test toolkit to upgrading guide
willkroboth Oct 1, 2025
4f04c28
Address some more code review
DerEchtePilz Oct 1, 2025
cf47a18
Update config page to account for the latest changes
DerEchtePilz Oct 4, 2025
08f1fe1
Merge pull request #13 from CommandAPI/dev/spigot-paper-test-toolkit
DerEchtePilz Oct 4, 2025
948f9d4
Update version to 11.0.0
DerEchtePilz Oct 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ reference-code.iml
reference-code/reference-code.iml
reference-code/target
reference-code/build
reference-code/.kotlin
reference-code/.gradle
reference-code/**/build
**/.kotlin
**/.gradle

package-lock.json
.vscode
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ yarn install
yarn docs:build
```

### View website changes locally

```bash
yarn docs:dev
```

### Verify reference code

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const vitepressOptions: UserConfig = {
}).then(_ => {
})
},
config: (md) => {
config: ( md) => {
tabsPlugin(md);
injectUpgradingPartsPlugin(md);
mermaidSpaceConverter(md);
Expand Down
83 changes: 46 additions & 37 deletions docs/.vitepress/theme/preference/PreferenceSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import {VTIconChevronDown, VTSwitch} from '@vue/theme'
import {useData, useRoute} from 'vitepress'
import {onMounted, ref, Ref, watch} from 'vue'
import {openPreference, openPreferenceKey, preferGroovyInGradle, preferGroovyInGradleKey, preferMaven, preferMavenKey, preferReobf, preferReobfKey,} from "./preference";
import {
openPreference, openPreferenceKey,
preferPaper, preferPaperKey,
preferGroovyInGradle, preferGroovyInGradleKey,
preferMaven, preferMavenKey
} from "./preference";

const {frontmatter} = useData();
let preferencesToDisplay: Ref<string[]> = ref();
Expand Down Expand Up @@ -36,6 +41,12 @@ const restoreOutline = (e: Event) => {
(e.target as HTMLElement).classList.remove('no-outline');
};

const togglePaper = useToggleFn(
preferPaperKey,
preferPaper,
'prefer-paper'
)

const toggleMaven = useToggleFn(
preferMavenKey,
preferMaven,
Expand All @@ -48,12 +59,6 @@ const toggleGradleDsl = useToggleFn(
'prefer-groovy'
);

const toggleMapping = useToggleFn(
preferReobfKey,
preferReobf,
'prefer-reobf'
)

function useToggleFn(
storageKey: string,
state: Ref<boolean>,
Expand All @@ -77,9 +82,9 @@ function useToggleFn(
refresh()

onMounted(() => {
togglePaper(preferPaper.value);
toggleMaven(preferMaven.value);
toggleGradleDsl(preferGroovyInGradle.value);
toggleMapping(preferReobf.value);
});
</script>

Expand All @@ -102,6 +107,16 @@ onMounted(() => {
:aria-hidden="!openPreference"
>
<div class="mobile-wrapper switches">
<div v-if="preferencesToDisplay.includes('paper-spigot')" class="switch-container">
<label class="paper-label prefer-label-left" @click="togglePaper(true)">Paper</label>
<VTSwitch
class="platform-switch"
aria-label="prefer paper"
:aria-checked="preferPaper"
@click="togglePaper()"
/>
<label class="spigot-label prefer-label-right" @click="togglePaper(false)">Spigot</label>
</div>
<div v-if="preferencesToDisplay.includes('build-system')" class="switch-container">
<label class="gradle-label prefer-label-left" @click="toggleMaven(false)">Gradle</label>
<VTSwitch
Expand All @@ -122,16 +137,6 @@ onMounted(() => {
/>
<label class="groovy-label prefer-label-right" @click="toggleGradleDsl(true)">.gradle</label>
</div>
<div v-if="preferencesToDisplay.includes('mapping')" class="switch-container">
<label class="mojmap-label prefer-label-left" @click="toggleMapping(false)">Mojmap</label>
<VTSwitch
class="mapping-switch"
aria-label="prefer reobf"
:aria-checked="preferReobf"
@click="toggleMapping()"
/>
<label class="reobf-label prefer-label-right" @click="toggleMapping(true)">Reobf</label>
</div>
</div>
</div>
<br class="hide-on-mobile" :hidden="openPreference"/>
Expand Down Expand Up @@ -270,59 +275,63 @@ onMounted(() => {
</style>

<style>
.paper,
.maven,
.groovy,
.reobf {
.groovy {
display: none;
}

.prefer-paper .spigot,
.prefer-maven .gradle,
.prefer-groovy .kts,
.prefer-reobf .mojmap {
.prefer-groovy .kts {
display: none;
}

.prefer-paper .paper,
.prefer-maven .maven,
.prefer-groovy .groovy,
.prefer-reobf .reobf {
.prefer-groovy .groovy {
display: initial;
}

.paper-label,
.maven-label,
.groovy-label,
.reobf-label,
.prefer-paper .spigot-label,
.prefer-maven .gradle-label,
.prefer-groovy .kts-label,
.prefer-reobf .mojmap-label {
.prefer-groovy .kts-label {
color: var(--vt-c-text-3);
}

.prefer-paper .paper-label,
.prefer-maven .maven-label,
.prefer-groovy .groovy-label,
.prefer-reobf .reobf-label {
.prefer-groovy .groovy-label {
color: var(--vt-c-text-1);
}

.prefer-maven .api-switch .vt-switch-check {
.platform-switch .vt-switch-check {
transform: translateX(18px);
}

.prefer-groovy .dsl-switch .vt-switch-check {
.prefer-paper .platform-switch .vt-switch-check {
transform: translateX(0px);
}

.prefer-maven .api-switch .vt-switch-check {
transform: translateX(18px);
}

.prefer-reobf .mapping-switch .vt-switch-check {
.prefer-groovy .dsl-switch .vt-switch-check {
transform: translateX(18px);
}

.tip .paper,
.tip .spigot,
.tip .gradle,
.tip .groovy,
.tip .kts,
.tip .maven,
.tip .mojmap,
.tip .reobf {
color: var(--vt-c-text-code);
.tip .maven {
//color: var(--vt-c-text-code);
/* transition: color 0.5s; */
font-weight: 600;
//font-weight: 600;
}
</style>
8 changes: 4 additions & 4 deletions docs/.vitepress/theme/preference/preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ function getBoolean(key: string, defaultValue: boolean) {
export const openPreferenceKey = 'command-api-docs-prefer-open-preference'
export const openPreference = ref(getBoolean(openPreferenceKey, true))

export const preferPaperKey = 'command-api-docs-prefer-paper'
export const preferPaper = ref(getBoolean(preferPaperKey, true))

export const preferMavenKey = 'command-api-docs-prefer-maven'
export const preferMaven = ref(getBoolean(preferMavenKey, false))

export const preferGroovyInGradleKey = 'command-api-docs-prefer-groovy-dsl-in-gradle'
export const preferGroovyInGradle = ref(getBoolean(preferGroovyInGradleKey, false))

export const preferReobfKey = 'command-api-docs-prefer-mojmap'
export const preferReobf = ref(getBoolean(preferReobfKey, false))
export const preferGroovyInGradle = ref(getBoolean(preferGroovyInGradleKey, false))
1 change: 1 addition & 0 deletions docs/.vitepress/theme/upgrading/upgrading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const upgradingInfos: UpgradingInfo[] = [
{from: '9.0.3', to: '9.1.0'},
{from: '9.2.0', to: '9.3.0'},
{from: '9.7.0', to: '10.0.0'},
{from: '10.1.2', to: '11.0.0'}
]

export const keyVersions = Array.from(new Set(upgradingInfos.map(info => [info.from, info.to]).flat()));
Expand Down
32 changes: 16 additions & 16 deletions docs/en/annotations/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ This page outlines in detail the list of all annotations that the CommandAPI's a

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

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

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

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.

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

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

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.

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

### `@NeedsOp`

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

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

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

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

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

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

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

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

## Annotations that go on methods

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

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:

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

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

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

### `@Subcommand`

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:

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

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

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

### `@Permission`

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

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

### `@NeedsOp`

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

$$\begin{align}
\texttt{StringArgument}&\xrightarrow{A}\texttt{@AStringArgument}\\\\
\texttt{PlayerArgument}&\xrightarrow{A}\texttt{@APlayerArgument}\\\\
\texttt{IntegerArgument}&\xrightarrow{A}\texttt{@AIntegerArgument}\\\\
\texttt{AdvancementArgument}&\xrightarrow{A}\texttt{@AAdvancementArgument}\\\\
&\hspace{0.75em}\vdots
\end{align}$$

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

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

- **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`.

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

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:

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

#### Literal arguments

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.

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:

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

#### Other arguments

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:

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