From f6aa49d610e47b40ffa72d09e3cb0b02c3e9edc7 Mon Sep 17 00:00:00 2001 From: willkroboth <46540330+willkroboth@users.noreply.github.com> Date: Wed, 20 Aug 2025 11:40:25 -0400 Subject: [PATCH 01/33] Update to version 11.0.0-SNAPSHOT --- docs/en/dev-setup/annotations.md | 12 ++++++------ docs/en/dev-setup/setup.md | 6 +++--- docs/en/dev-setup/shading.md | 12 ++++++------ docs/en/kotlin-dsl/intro.md | 6 +++--- docs/en/test/setup.md | 12 ++++++------ docs/en/velocity/intro.md | 6 +++--- reference-code/gradle/libs.versions.toml | 10 +++++----- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/en/dev-setup/annotations.md b/docs/en/dev-setup/annotations.md index 8624b361..6919e019 100644 --- a/docs/en/dev-setup/annotations.md +++ b/docs/en/dev-setup/annotations.md @@ -22,7 +22,7 @@ The annotation system effectively needs to be added twice: Once for compilation dev.jorel commandapi-annotations - 10.1.2 + 11.0.0-SNAPSHOT provided @@ -42,7 +42,7 @@ The annotation system effectively needs to be added twice: Once for compilation dev.jorel commandapi-annotations - 10.1.2 + 11.0.0-SNAPSHOT @@ -81,8 +81,8 @@ The annotation system effectively needs to be added twice: Once for compilation ```groovy dependencies { - compileOnly "dev.jorel:commandapi-annotations:10.1.2" - annotationProcessor "dev.jorel:commandapi-annotations:10.1.2" + compileOnly "dev.jorel:commandapi-annotations:11.0.0-SNAPSHOT" + annotationProcessor "dev.jorel:commandapi-annotations:11.0.0-SNAPSHOT" } ``` @@ -90,8 +90,8 @@ The annotation system effectively needs to be added twice: Once for compilation ```kotlin dependencies { - compileOnly("dev.jorel:commandapi-annotations:10.1.2") - annotationProcessor("dev.jorel:commandapi-annotations:10.1.2") + compileOnly("dev.jorel:commandapi-annotations:11.0.0-SNAPSHOT") + annotationProcessor("dev.jorel:commandapi-annotations:11.0.0-SNAPSHOT") } ``` diff --git a/docs/en/dev-setup/setup.md b/docs/en/dev-setup/setup.md index c4b7d4f1..38fe0fe2 100644 --- a/docs/en/dev-setup/setup.md +++ b/docs/en/dev-setup/setup.md @@ -51,7 +51,7 @@ If you've never used a build system before, I highly recommend it! It makes it e dev.jorel commandapi-bukkit-core - 10.1.2 + 11.0.0-SNAPSHOT provided @@ -90,7 +90,7 @@ If you've never used a build system before, I highly recommend it! It makes it e ```groovy dependencies { - compileOnly "dev.jorel:commandapi-bukkit-core:10.1.2" + compileOnly "dev.jorel:commandapi-bukkit-core:11.0.0-SNAPSHOT" } ``` @@ -99,7 +99,7 @@ If you've never used a build system before, I highly recommend it! It makes it e ```kotlin dependencies { - compileOnly("dev.jorel:commandapi-bukkit-core:10.1.2") + compileOnly("dev.jorel:commandapi-bukkit-core:11.0.0-SNAPSHOT") } ``` diff --git a/docs/en/dev-setup/shading.md b/docs/en/dev-setup/shading.md index dc9fcb2a..c3e007b6 100644 --- a/docs/en/dev-setup/shading.md +++ b/docs/en/dev-setup/shading.md @@ -113,7 +113,7 @@ Add the CommandAPI shade dependency: dev.jorel commandapi-bukkit-shade - 10.1.2 + 11.0.0-SNAPSHOT ``` @@ -125,7 +125,7 @@ Add the CommandAPI shade dependency: dev.jorel commandapi-bukkit-shade-mojang-mapped - 10.1.2 + 11.0.0-SNAPSHOT ``` @@ -221,7 +221,7 @@ Next, we declare our dependencies: ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-shade:10.1.2" + implementation "dev.jorel:commandapi-bukkit-shade:11.0.0-SNAPSHOT" } ``` @@ -229,7 +229,7 @@ dependencies { ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:10.1.2" + implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:11.0.0-SNAPSHOT" } ``` @@ -239,7 +239,7 @@ dependencies { ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-shade:10.1.2") + implementation("dev.jorel:commandapi-bukkit-shade:11.0.0-SNAPSHOT") } ``` @@ -247,7 +247,7 @@ dependencies { ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:10.1.2") + implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:11.0.0-SNAPSHOT") } ``` diff --git a/docs/en/kotlin-dsl/intro.md b/docs/en/kotlin-dsl/intro.md index 54abf6a3..e638e51d 100644 --- a/docs/en/kotlin-dsl/intro.md +++ b/docs/en/kotlin-dsl/intro.md @@ -26,7 +26,7 @@ To install the DSL, you need to add the `commandapi-bukkit-kotlin` dependency in dev.jorel commandapi-bukkit-kotlin - 10.1.2 + 11.0.0-SNAPSHOT ``` @@ -106,7 +106,7 @@ Next, you need to add the dependency: ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-kotlin:10.1.2" + implementation "dev.jorel:commandapi-bukkit-kotlin:11.0.0-SNAPSHOT" } ``` @@ -115,7 +115,7 @@ dependencies { ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-kotlin:10.1.2") + implementation("dev.jorel:commandapi-bukkit-kotlin:11.0.0-SNAPSHOT") } ``` diff --git a/docs/en/test/setup.md b/docs/en/test/setup.md index 5956afa8..1a85abd7 100644 --- a/docs/en/test/setup.md +++ b/docs/en/test/setup.md @@ -29,7 +29,7 @@ When you add the dependencies for MockBukkit and `commandapi-bukkit-test-toolkit dev.jorel commandapi-bukkit-test-toolkit - 10.1.2 + 11.0.0-SNAPSHOT test @@ -37,7 +37,7 @@ When you add the dependencies for MockBukkit and `commandapi-bukkit-test-toolkit dev.jorel commandapi-bukkit-core - 10.1.2 + 11.0.0-SNAPSHOT provided @@ -70,10 +70,10 @@ dependencies { // See https://github.com/MockBukkit/MockBukkit?tab=readme-ov-file#mag-usage for latest version testImplementation 'com.github.seeseemelk:MockBukkit-v1.21:3.128.0' - testImplementation 'dev.jorel:commandapi-bukkit-test-toolkit:10.1.2' + testImplementation 'dev.jorel:commandapi-bukkit-test-toolkit:11.0.0-SNAPSHOT' // May be the shade dependency and/or mojang-mapped - compileOnly 'dev.jorel:commandapi-bukkit-core:10.1.2' + compileOnly 'dev.jorel:commandapi-bukkit-core:11.0.0-SNAPSHOT' // Can also be paper-api compileOnly 'org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT' @@ -91,10 +91,10 @@ dependencies { // See https://github.com/MockBukkit/MockBukkit?tab=readme-ov-file#mag-usage for latest version testImplementation("com.github.seeseemelk:MockBukkit-v1.21:3.128.0") - testImplementation("dev.jorel:commandapi-bukkit-test-toolkit:10.1.2") + testImplementation("dev.jorel:commandapi-bukkit-test-toolkit:11.0.0-SNAPSHOT") // May be the shade dependency and/or mojang-mapped - compileOnly("dev.jorel:commandapi-bukkit-core:10.1.2") + compileOnly("dev.jorel:commandapi-bukkit-core:11.0.0-SNAPSHOT") // Can also be paper-api compileOnly("org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT") diff --git a/docs/en/velocity/intro.md b/docs/en/velocity/intro.md index dbe9da29..2d5e3c79 100644 --- a/docs/en/velocity/intro.md +++ b/docs/en/velocity/intro.md @@ -26,7 +26,7 @@ Add the dependency to your list of dependencies in your build script: dev.jorel commandapi-velocity-shade - 10.1.2 + 11.0.0-SNAPSHOT ``` @@ -38,7 +38,7 @@ Add the dependency to your list of dependencies in your build script: ```groovy dependencies { - implementation "dev.jorel:commandapi-velocity-shade:10.1.2" + implementation "dev.jorel:commandapi-velocity-shade:11.0.0-SNAPSHOT" } ``` @@ -47,7 +47,7 @@ dependencies { ```kotlin dependencies { - implementation("dev.jorel:commandapi-velocity-shade:10.1.2") + implementation("dev.jorel:commandapi-velocity-shade:11.0.0-SNAPSHOT") } ``` diff --git a/reference-code/gradle/libs.versions.toml b/reference-code/gradle/libs.versions.toml index bf73e249..a63fe69f 100644 --- a/reference-code/gradle/libs.versions.toml +++ b/reference-code/gradle/libs.versions.toml @@ -7,11 +7,11 @@ com-mojang-authlib = "3.3.39" com-mojang-brigadier = "1.0.17" com-velocitypowered-velocity-api = "3.4.0-SNAPSHOT" de-tr7zw-item-nbt-api = "2.11.1" -dev-jorel-commandapi-annotations = "10.1.2" -dev-jorel-commandapi-bukkit-core = "10.1.2" -dev-jorel-commandapi-bukkit-kotlin = "10.1.2" -dev-jorel-commandapi-bukkit-test-toolkit = "10.1.2" -dev-jorel-commandapi-velocity-shade = "10.1.2" +dev-jorel-commandapi-annotations = "11.0.0-SNAPSHOT" +dev-jorel-commandapi-bukkit-core = "11.0.0-SNAPSHOT" +dev-jorel-commandapi-bukkit-kotlin = "11.0.0-SNAPSHOT" +dev-jorel-commandapi-bukkit-test-toolkit = "11.0.0-SNAPSHOT" +dev-jorel-commandapi-velocity-shade = "11.0.0-SNAPSHOT" io-papermc-paper-paper-api = "1.21-R0.1-SNAPSHOT" net-kyori-adventure-platform-bukkit = "4.2.0" org-jetbrains-kotlin-kotlin-stdlib = "2.0.0" From 8e2b80096a97199cfdc3bfaf7f4b3b0698f3f887 Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Mon, 17 Feb 2025 19:04:48 +0100 Subject: [PATCH 02/33] Add documentation for https://github.com/CommandAPI/CommandAPI/pull/517 --- docs/.vitepress/theme/upgrading/upgrading.ts | 1 + .../en/create-commands/arguments/arguments.md | 128 +++++++++--------- .../types/chat/adventure-chat-arguments.md | 20 +-- docs/en/dev-setup/setup.md | 39 +++++- docs/en/dev-setup/shading.md | 52 ++++--- docs/en/kotlin-dsl/intro.md | 39 +++++- docs/en/upgrading-parts/10.1.2-to-11.0.0.md | 43 ++++++ docs/en/user-setup/config.md | 62 +++++++++ 8 files changed, 286 insertions(+), 98 deletions(-) create mode 100644 docs/en/upgrading-parts/10.1.2-to-11.0.0.md diff --git a/docs/.vitepress/theme/upgrading/upgrading.ts b/docs/.vitepress/theme/upgrading/upgrading.ts index 0c39b932..95d0fe78 100644 --- a/docs/.vitepress/theme/upgrading/upgrading.ts +++ b/docs/.vitepress/theme/upgrading/upgrading.ts @@ -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())); diff --git a/docs/en/create-commands/arguments/arguments.md b/docs/en/create-commands/arguments/arguments.md index ebdf4694..419a7cb7 100644 --- a/docs/en/create-commands/arguments/arguments.md +++ b/docs/en/create-commands/arguments/arguments.md @@ -72,67 +72,67 @@ To access arguments, they have to be casted to the type that the argument repres The type to cast each argument (declared in the `dev.jorel.commandapi.arguments` package) is listed below: -| Argument class | Data type | -|------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [`AngleArgument`](./types/misc/angle-arguments) | `float` | -| [`AdvancementArgument`](./types/misc/advancement-arguments) | `org.bukkit.advancement.Advancement` | -| [`AdventureChatArgument`](./types/chat/adventure-chat-arguments) | `net.kyori.adventure.text.Component` | -| [`AdventureChatColorArgument`](./types/chat/adventure-chat-arguments#adventure-chat-color-argument) | `net.kyori.adventure.text.format.NamedTextColor` | -| [`AdventureChatComponentArgument`](./types/chat/adventure-chat-arguments#adventure-chat-component-argument) | `net.kyori.adventure.text.Component` | -| [`AxisArgument`](./types/position/axis-arguments) | `java.util.EnumSet` | -| [`BiomeArgument`](./types/misc/biome-arguments) | `org.bukkit.block.Biome` | -| [`BiomeArgument.NamespacedKey`](./types/misc/biome-arguments) | `org.bukkit.NamespacedKey` | -| [`BlockPredicateArgument`](./types/predicate/block-predicate-arguments) | `java.util.function.Predicate`
 `` | -| [`BlockStateArgument`](./types/misc/blockstate-arguments) | `org.bukkit.block.data.BlockData` | -| [`BooleanArgument`](./types/primitive-arguments#boolean-arguments) | `boolean` | -| [`ChatArgument`](./types/chat/spigot-chat-arguments#chat-argument) | `net.md_5.bungee.api.chat.BaseComponent[]` | -| [`ChatColorArgument`](./types/chat/spigot-chat-arguments#chat-color-argument) | `org.bukkit.ChatColor` | -| [`ChatComponentArgument`](./types/chat/spigot-chat-arguments#chat-component-argument) | `net.md_5.bungee.api.chat.BaseComponent[]` | -| [`CommandArgument`](./types/command-arguments) | `dev.jorel.commandapi.wrappers.CommandResult` | -| [`CustomArgument`](./types/custom-arguments) | `T` | -| [`DoubleArgument`](./types/primitive-arguments#numerical-arguments) | `double` | -| [`EnchantmentArgument`](./types/misc/enchantment-arguments) | `org.bukkit.enchantments.Enchantment` | -| [`EntitySelectorArgument.ManyEntities`](./types/entities-arguments#entity-selector-argument) | `Collection` | -| [`EntitySelectorArgument.ManyPlayers`](./types/entities-arguments#entity-selector-argument) | `Collection` | -| [`EntitySelectorArgument.OneEntity`](./types/entities-arguments#entity-selector-argument) | `org.bukkit.entity.Entity` | -| [`EntitySelectorArgument.OnePlayer`](./types/entities-arguments#entity-selector-argument) | `org.bukkit.entity.Player` | -| [`EntityTypeArgument`](./types/entities-arguments#entity-type-argument) | `org.bukkit.entity.EntityType` | -| [`FloatArgument`](./types/primitive-arguments#numerical-arguments) | `float` | -| [`FloatRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.FloatRange` | -| [`FunctionArgument`](../functions-and-tags/function-arguments) | `dev.jorel.commandapi.wrappers.FunctionWrapper[]` | -| [`GreedyStringArgument`](./types/string-arguments#greedy-string-argument) | `String` | -| [`IntegerArgument`](./types/primitive-arguments#numerical-arguments) | `int` | -| [`IntegerRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | -| [`ItemStackArgument`](./types/misc/itemstack-arguments) | `org.bukkit.inventory.ItemStack` | -| [`ItemStackPredicateArgument`](./types/predicate/itemstack-predicate-arguments) | `java.util.function.Predicate`
 `` | -| [`ListArgument`](./types/list-arguments) | `java.util.Collection` | -| [`LiteralArgument`](./types/literal/literal-arguments) | N/A | -| [`Location2DArgument`](./types/position/location-arguments#2d-location) | `dev.jorel.commandapi.wrappers.Location2D` | -| [`LocationArgument`](./types/position/location-arguments#3d-location) | `org.bukkit.Location` | -| [`LongArgument`](./types/primitive-arguments#numerical-arguments) | `long` | -| [`LootTableArgument`](./types/misc/loottable-arguments) | `org.bukkit.loot.LootTable` | -| [`MapArgument`](./types/map-arguments) | `java.util.LinkedHashMap` | -| [`MathOperationArgument`](./types/misc/mathoperation-arguments) | `dev.jorel.commandapi.wrappers.MathOperation` | -| [`MultiLiteralArgument`](./types/literal/multiliteral-arguments) | `String` | -| [`NamespacedKeyArgument`](./types/misc/namespacedkey-arguments) | `org.bukkit.NamespacedKey` | -| [`NBTCompoundArgument`](./types/nbt-arguments) | The cast type changes depending on whether you're shading the CommandAPI or using the CommandAPI as a plugin:
  • Shading:
    `T` (implemented yourself)

  • Plugin:
    `dev.jorel.commandapi.nbtapi.NBTContainer`
| -| [`ObjectiveArgument`](./types/scoreboard/objective-arguments#objective-argument) | `org.bukkit.scoreboard.Objective` | -| [`ObjectiveCriteriaArgument`](./types/scoreboard/objective-arguments#objective-criteria-argument) | `String` | -| [`OfflinePlayerArgument`](./types/entities-arguments#offlineplayer-argument) | `org.bukkit.OfflinePlayer` | -| [`ParticleArgument`](./types/misc/particle-arguments) | `dev.jorel.commandapi.wrappers.ParticleData` | -| [`PlayerArgument`](./types/entities-arguments#player-argument) | `org.bukkit.entity.Player` | -| [`PotionEffectArgument`](./types/misc/potion-arguments) | `org.bukkit.potion.PotionEffectType` | -| [`PotionEffectArgument.NamespacedKey`](./types/misc/potion-arguments) | `org.bukkit.NamespacedKey` | -| [`RecipeArgument`](./types/misc/recipe-arguments) | The cast type changes depending on your Minecraft version:
  • Version 1.14.4 and below:
    `org.bukkit.inventory.Recipe`

  • 1.15 and above:
    `org.bukkit.inventory.ComplexRecipe`
| -| [`RotationArgument`](./types/position/rotation-arguments) | `dev.jorel.commandapi.wrappers.Rotation` | -| [`ScoreboardSlotArgument`](./types/scoreboard/scoreboard-arguments#scoreboard-slot-argument) | `dev.jorel.commandapi.wrappers.ScoreboardSlot` | -| [`ScoreHolderArgument.Single`](./types/scoreboard/scoreboard-arguments#score-holder-argument) | `String` | -| [`ScoreHolderArgument.Multiple`](./types/scoreboard/scoreboard-arguments#score-holder-argument) | `Collection` | -| [`SoundArgument`](./types/misc/sound-arguments) | `org.bukkit.Sound` | -| [`SoundArgument.NamespacedKey`](./types/misc/sound-arguments) | `org.bukkit.NamespacedKey` | -| [`StringArgument`](./types/string-arguments#string-argument) | `String` | -| [`TeamArgument`](./types/scoreboard/team-arguments) | `org.bukkit.scoreboard.Team` | -| [`TextArgument`](./types/string-arguments#text-argument) | `String` | -| [`TimeArgument`](./types/misc/time-arguments) | `int` | -| [`UUIDArgument`](./types/misc/uuid-arguments) | `java.util.UUID` | -| [`WorldArgument`](./types/misc/world-arguments) | `org.bukkit.World` | \ No newline at end of file +| Argument class | Data type | +|--------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [`AngleArgument`](./types/misc/angle-arguments) | `float` | +| [`AdvancementArgument`](./types/misc/advancement-arguments) | `org.bukkit.advancement.Advancement` | +| [`AxisArgument`](./types/position/axis-arguments) | `java.util.EnumSet` | +| [`BiomeArgument`](./types/misc/biome-arguments) | `org.bukkit.block.Biome` | +| [`BiomeArgument.NamespacedKey`](./types/misc/biome-arguments) | `org.bukkit.NamespacedKey` | +| [`BlockPredicateArgument`](./types/predicate/block-predicate-arguments) | `java.util.function.Predicate`
 `` | +| [`BlockStateArgument`](./types/misc/blockstate-arguments) | `org.bukkit.block.data.BlockData` | +| [`BooleanArgument`](./types/primitive-arguments#boolean-arguments) | `boolean` | +| [`ChatArgument` (on Paper)](./types/chat/adventure-chat-arguments#adventure-chat-argument) | `net.kyori.adventure.text.Component` | +| [`ChatColorArgument` (on Paper)](./types/chat/adventure-chat-arguments#adventure-chat-color-argument) | `net.kyori.adventure.text.format.NamedTextColor` | +| [`ChatComponentArgument` (on Paper)](./types/chat/adventure-chat-arguments#adventure-chat-component-argument) | `net.kyori.adventure.text.Component` | +| [`ChatArgument` (on Spigot)](./types/chat/spigot-chat-arguments#chat-argument) | `net.md_5.bungee.api.chat.BaseComponent[]` | +| [`ChatColorArgument` (on Spigot)](./types/chat/spigot-chat-arguments#chat-color-argument) | `org.bukkit.ChatColor` | +| [`ChatComponentArgument` (on Spigot)](./types/chat/spigot-chat-arguments#chat-component-argument) | `net.md_5.bungee.api.chat.BaseComponent[]` | +| [`CommandArgument`](./types/command-arguments) | `dev.jorel.commandapi.wrappers.CommandResult` | +| [`CustomArgument`](./types/custom-arguments) | `T` | +| [`DoubleArgument`](./types/primitive-arguments#numerical-arguments) | `double` | +| [`EnchantmentArgument`](./types/misc/enchantment-arguments) | `org.bukkit.enchantments.Enchantment` | +| [`EntitySelectorArgument.ManyEntities`](./types/entities-arguments#entity-selector-argument) | `Collection` | +| [`EntitySelectorArgument.ManyPlayers`](./types/entities-arguments#entity-selector-argument) | `Collection` | +| [`EntitySelectorArgument.OneEntity`](./types/entities-arguments#entity-selector-argument) | `org.bukkit.entity.Entity` | +| [`EntitySelectorArgument.OnePlayer`](./types/entities-arguments#entity-selector-argument) | `org.bukkit.entity.Player` | +| [`EntityTypeArgument`](./types/entities-arguments#entity-type-argument) | `org.bukkit.entity.EntityType` | +| [`FloatArgument`](./types/primitive-arguments#numerical-arguments) | `float` | +| [`FloatRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.FloatRange` | +| [`FunctionArgument`](../functions-and-tags/function-arguments) | `dev.jorel.commandapi.wrappers.FunctionWrapper[]` | +| [`GreedyStringArgument`](./types/string-arguments#greedy-string-argument) | `String` | +| [`IntegerArgument`](./types/primitive-arguments#numerical-arguments) | `int` | +| [`IntegerRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | +| [`ItemStackArgument`](./types/misc/itemstack-arguments) | `org.bukkit.inventory.ItemStack` | +| [`ItemStackPredicateArgument`](./types/predicate/itemstack-predicate-arguments) | `java.util.function.Predicate`
 `` | +| [`ListArgument`](./types/list-arguments) | `java.util.Collection` | +| [`LiteralArgument`](./types/literal/literal-arguments) | N/A | +| [`Location2DArgument`](./types/position/location-arguments#2d-location) | `dev.jorel.commandapi.wrappers.Location2D` | +| [`LocationArgument`](./types/position/location-arguments#3d-location) | `org.bukkit.Location` | +| [`LongArgument`](./types/primitive-arguments#numerical-arguments) | `long` | +| [`LootTableArgument`](./types/misc/loottable-arguments) | `org.bukkit.loot.LootTable` | +| [`MapArgument`](./types/map-arguments) | `java.util.LinkedHashMap` | +| [`MathOperationArgument`](./types/misc/mathoperation-arguments) | `dev.jorel.commandapi.wrappers.MathOperation` | +| [`MultiLiteralArgument`](./types/literal/multiliteral-arguments) | `String` | +| [`NamespacedKeyArgument`](./types/misc/namespacedkey-arguments) | `org.bukkit.NamespacedKey` | +| [`NBTCompoundArgument`](./types/nbt-arguments) | The cast type changes depending on whether you're shading the CommandAPI or using the CommandAPI as a plugin:
  • Shading:
    `T` (implemented yourself)

  • Plugin:
    `dev.jorel.commandapi.nbtapi.NBTContainer`
| +| [`ObjectiveArgument`](./types/scoreboard/objective-arguments#objective-argument) | `org.bukkit.scoreboard.Objective` | +| [`ObjectiveCriteriaArgument`](./types/scoreboard/objective-arguments#objective-criteria-argument) | `String` | +| [`OfflinePlayerArgument`](./types/entities-arguments#offlineplayer-argument) | `org.bukkit.OfflinePlayer` | +| [`ParticleArgument`](./types/misc/particle-arguments) | `dev.jorel.commandapi.wrappers.ParticleData` | +| [`PlayerArgument`](./types/entities-arguments#player-argument) | `org.bukkit.entity.Player` | +| [`PotionEffectArgument`](./types/misc/potion-arguments) | `org.bukkit.potion.PotionEffectType` | +| [`PotionEffectArgument.NamespacedKey`](./types/misc/potion-arguments) | `org.bukkit.NamespacedKey` | +| [`RecipeArgument`](./types/misc/recipe-arguments) | The cast type changes depending on your Minecraft version:
  • Version 1.14.4 and below:
    `org.bukkit.inventory.Recipe`

  • 1.15 and above:
    `org.bukkit.inventory.ComplexRecipe`
| +| [`RotationArgument`](./types/position/rotation-arguments) | `dev.jorel.commandapi.wrappers.Rotation` | +| [`ScoreboardSlotArgument`](./types/scoreboard/scoreboard-arguments#scoreboard-slot-argument) | `dev.jorel.commandapi.wrappers.ScoreboardSlot` | +| [`ScoreHolderArgument.Single`](./types/scoreboard/scoreboard-arguments#score-holder-argument) | `String` | +| [`ScoreHolderArgument.Multiple`](./types/scoreboard/scoreboard-arguments#score-holder-argument) | `Collection` | +| [`SoundArgument`](./types/misc/sound-arguments) | `org.bukkit.Sound` | +| [`SoundArgument.NamespacedKey`](./types/misc/sound-arguments) | `org.bukkit.NamespacedKey` | +| [`StringArgument`](./types/string-arguments#string-argument) | `String` | +| [`TeamArgument`](./types/scoreboard/team-arguments) | `org.bukkit.scoreboard.Team` | +| [`TextArgument`](./types/string-arguments#text-argument) | `String` | +| [`TimeArgument`](./types/misc/time-arguments) | `int` | +| [`UUIDArgument`](./types/misc/uuid-arguments) | `java.util.UUID` | +| [`WorldArgument`](./types/misc/world-arguments) | `org.bukkit.World` | \ No newline at end of file diff --git a/docs/en/create-commands/arguments/types/chat/adventure-chat-arguments.md b/docs/en/create-commands/arguments/types/chat/adventure-chat-arguments.md index 6b38e197..15ccea2c 100644 --- a/docs/en/create-commands/arguments/types/chat/adventure-chat-arguments.md +++ b/docs/en/create-commands/arguments/types/chat/adventure-chat-arguments.md @@ -8,21 +8,23 @@ authors: # Adventure chat arguments -:::info +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). -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` +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. +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` +while the arguments on the Spigot chat arguments page are only available when using `commandapi-spigot-core` or `commandapi-spigot-shade`. -::: +:::info -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). +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`. -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. +::: ## Adventure chat color argument ![Chatcolor argument in-game, displaying a list of Minecraft chat colors](/images/arguments/chatcolor.png) -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`. +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`. ::::tip Example – Username color changing plugin @@ -47,7 +49,7 @@ We then use the `ChatColorArgument` to change the player's name color: ## Adventure chat component argument -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. +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. ::::tip Example – Opening a book with raw JSON content @@ -72,11 +74,11 @@ We can construct a book using the Adventure API's `Book.book(Component, Componen ## Adventure chat argument -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`. +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`. ::::tip Example – Sending personalized messages to players -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: +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: ```mccmd /pbroadcast diff --git a/docs/en/dev-setup/setup.md b/docs/en/dev-setup/setup.md index 38fe0fe2..5988ca4d 100644 --- a/docs/en/dev-setup/setup.md +++ b/docs/en/dev-setup/setup.md @@ -46,16 +46,30 @@ If you've never used a build system before, I highly recommend it! It makes it e - Add the dependency to your `pom.xml`: +:::tabs +===Paper ```xml dev.jorel - commandapi-bukkit-core + commandapi-paper-core 11.0.0-SNAPSHOT provided ``` +===Spigot + ```xml + + + dev.jorel + commandapi-spigot-core + 11.0.0-SNAPSHOT + provided + + + ``` +:::
@@ -88,21 +102,38 @@ If you've never used a build system before, I highly recommend it! It makes it e
+ :::tabs + ===Paper ```groovy dependencies { - compileOnly "dev.jorel:commandapi-bukkit-core:11.0.0-SNAPSHOT" + compileOnly "dev.jorel:commandapi-paper-core:11.0.0-SNAPSHOT" } ``` + ===Spigot + ```groovy + dependencies { + compileOnly "dev.jorel:commandapi-spigot-core:11.0.0-SNAPSHOT" + } + ``` + :::
+ :::tabs + ===Paper ```kotlin dependencies { - compileOnly("dev.jorel:commandapi-bukkit-core:11.0.0-SNAPSHOT") + compileOnly("dev.jorel:commandapi-paper-core:11.0.0-SNAPSHOT") } ``` - + ===Spigot + ```kotlin + dependencies { + compileOnly("dev.jorel:commandapi-spigot-core:11.0.0-SNAPSHOT") + } + ``` + :::
diff --git a/docs/en/dev-setup/shading.md b/docs/en/dev-setup/shading.md index c3e007b6..0c3d871e 100644 --- a/docs/en/dev-setup/shading.md +++ b/docs/en/dev-setup/shading.md @@ -37,32 +37,44 @@ The `onLoad(CommandAPIConfig)` method initializes the CommandAPI's loading seque public class CommandAPIConfig { CommandAPIConfig verboseOutput(boolean value); // Enables verbose logging CommandAPIConfig silentLogs(boolean value); // Disables ALL logging (except errors) - CommandAPIConfig useLatestNMSVersion(boolean value); // Whether the latest NMS implementation should be used or not - CommandAPIConfig beLenientForMinorVersions(boolean value); // Whether the CommandAPI should be more lenient with minor Minecraft versions - CommandAPIConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing CommandAPIConfig dispatcherFile(File file); // If not null, the CommandAPI will create a JSON file with Brigadier's command tree CommandAPIConfig setNamespace(String namespace); // The namespace to use when the CommandAPI registers a command - - CommandAPIConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info } ``` The `CommandAPIConfig` class follows a typical builder pattern (without you having to run `.build()` at the end), which lets you easily construct configuration instances. -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. +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. +:::tabs +===Bukkit ```java -public class CommandAPIBukkitConfig extends CommandAPIConfig { - CommandAPIBukkitConfig(JavaPlugin plugin); +public abstract class CommandAPIBukkitConfig extends CommandAPIConfig { + CommandAPIBukkitConfig useLatestNMSVersion(boolean value); // Whether the latest NMS implementation should be used or not + CommandAPIBukkitConfig beLenientForMinorVersions(boolean value); // Whether the CommandAPI should be more lenient with minor Minecraft versions + CommandAPIBukkitConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing + CommandAPIConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info +} +``` +===Paper +```java +public class CommandAPIPaperConfig extends CommandAPIBukkitConfig { + CommandAPIPaperConfig(LifecycleEventOwner lifecycleEventOwner); +} +``` +===Spigot +```java +public class CommandAPISpigotConfig extends CommandAPIBukkitConfig { + CommandAPISpigotConfig(JavaPlugin plugin); - CommandAPIBukkitConfig shouldHookPaperReload(boolean hooked); // Whether the CommandAPI should hook into the Paper-exclusive ServerResourcesReloadedEvent - CommandAPIBukkitConfig skipReloadDatapacks(boolean skip); // Whether the CommandAPI should reload datapacks on server load + CommandAPISpigotConfig skipReloadDatapacks(boolean skip); // Whether the CommandAPI should reload datapacks on server load } ``` +::: -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. +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. For example, to load the CommandAPI on Bukkit with all logging disabled, you can use the following: @@ -112,11 +124,12 @@ Add the CommandAPI shade dependency: dev.jorel - commandapi-bukkit-shade + commandapi-spigot-shade 11.0.0-SNAPSHOT ``` +
@@ -124,11 +137,12 @@ Add the CommandAPI shade dependency: dev.jorel - commandapi-bukkit-shade-mojang-mapped + commandapi-paper-shade 11.0.0-SNAPSHOT ``` +
You can shade the CommandAPI easily by adding the `maven-shade-plugin` to your build sequence: @@ -221,17 +235,19 @@ Next, we declare our dependencies: ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-shade:11.0.0-SNAPSHOT" + implementation "dev.jorel:commandapi-spigot-shade:11.0.0-SNAPSHOT" } ``` +
```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:11.0.0-SNAPSHOT" + implementation "dev.jorel:commandapi-paper-shade:11.0.0-SNAPSHOT" } ``` +
@@ -239,17 +255,19 @@ dependencies { ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-shade:11.0.0-SNAPSHOT") + implementation("dev.jorel:commandapi-spigot-shade:11.0.0-SNAPSHOT") } ``` +
```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:11.0.0-SNAPSHOT") + implementation("dev.jorel:commandapi-paper-shade:11.0.0-SNAPSHOT") } ``` +
diff --git a/docs/en/kotlin-dsl/intro.md b/docs/en/kotlin-dsl/intro.md index e638e51d..895930fc 100644 --- a/docs/en/kotlin-dsl/intro.md +++ b/docs/en/kotlin-dsl/intro.md @@ -15,21 +15,34 @@ This DSL provides many methods to easily add arguments to your command structure ## Installing the DSL -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: +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: ### Adding the dependency
+:::tabs +===Paper ```xml dev.jorel - commandapi-bukkit-kotlin + commandapi-kotlin-paper 11.0.0-SNAPSHOT ``` +===Spigot +```xml + + + dev.jorel + commandapi-kotlin-spigot + 11.0.0 + + +``` +::: Next, you need to add Kotlin to your project. For this, you first need to add the dependency: @@ -104,20 +117,38 @@ Next, you need to add the dependency:
+:::tabs +===Paper ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-kotlin:11.0.0-SNAPSHOT" + implementation "dev.jorel:commandapi-kotlin-paper:11.0.0" } ``` +===Spigot +```groovy +dependencies { + implementation "dev.jorel:commandapi-kotlin-spigot:11.0.0" +} +``` +:::
+:::tabs +===Paper +```kotlin +dependencies { + implementation("dev.jorel:commandapi-kotlin-paper:11.0.0") +} +``` +===Spigot ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-kotlin:11.0.0-SNAPSHOT") + implementation("dev.jorel:commandapi-kotlin-spigot:11.0.0") } ``` +:::
diff --git a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md new file mode 100644 index 00000000..05357c11 --- /dev/null +++ b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md @@ -0,0 +1,43 @@ +### CommandAPI restructure + +#### General module changes + +For 11.0.0, the `commandapi-bukkit-xxx` modules have mostly been removed in favour of new platform specific modules that have been made for Paper or Spigot respectively: + +- `commandapi-paper-xxx` +- `commandapi-spigot-xxx` + +In order to update please replace your `commandapi-bukkit-xxx` dependency with either `commandapi-paper-xxx` or `commandapi-spigot-xxx`. + +:::danger **Developer's Note:** + +The fact that Paper is a fork of Spigot does not mean that the Spigot modules work on Paper. Paper has, especially in newer versions, made changes to internal systems the CommandAPI +uses. There are no guarantees that the Spigot modules will work on Paper in any kind or form. + +Similarly, if you try to use the Paper modules on Spigot you will face registration issues and potential `NoClassDefFoundError`s, depending on the server version you use. +There again is no guarantee for any kind of compatibility. + +::: + +Additionally, the Kotlin module artifact names have changed. Instead of following the pattern `commandapi-bukkit-xxx`, they have now been updated as follows: + +- `commandapi-core-kotlin`: was changed to `commandapi-kotlin-core` +- `commandapi-bukkit-kotlin`: was changed to `commandapi-kotlin-bukkit` + +#### Code changes + +The `CommandAPIBukkitConfig` class has been converted into an abstract class and is no longer used to construct a config instance. Instead, use the new `CommandAPIPaperConfig` or +`CommandAPISpigot` classes, depending on the module you use. + +Further changes have been made to arguments that work with components. The classes `AdventureChatArgument`, `AdventureChatComponentArgument` and `AdventureChatColorArgument` have been +removed. Instead, the `ChatArgument`, `ChatComponentArgument` and `ChatColorArgument` have been implemented platform specific and return different types on Paper and Spigot. +On Paper, Adventure components are used while Spigot uses BungeeCord components. + +More argument changes have been made: + +- The `FloatRangeArgument` has been renamed to `DoubleRangeArgument` and now returns a `DoubleRange` object +- The `PlayerArgument` and `OfflinePlayerArgument` have been replaced by the `PlayerProfileArgument` which returns a `List<PlayerProfile>`. The `PlayerProfile` class changes depending on if you are on Paper or on Spigot. Use the `EntitySelectorArgument.OnePlayer` if you want a `Player` object. +- The `AsyncOfflinePlayerArgument` has been replaced by the `AsyncPlayerProfileArgument` +- The `ChatArgument`, `ChatComponentArgument` and `ChatColorArgument` do no longer have any `Adventure` prefixes and return different types depending on the platform. +- The `ChatArgument` returns a `SignedMessage` object on Paper +- The `BlockStateArgument` now returns a `BlockState` object instead of a `BlockData` object \ No newline at end of file diff --git a/docs/en/user-setup/config.md b/docs/en/user-setup/config.md index 69fb3c67..80952750 100644 --- a/docs/en/user-setup/config.md +++ b/docs/en/user-setup/config.md @@ -16,6 +16,8 @@ The default `config.yml` is shown below: ::: details **config.yml** +:::tabs +===Paper ```yaml # Verbose outputs (default: false) # If "true", outputs command registration and unregistration logs in the console @@ -85,7 +87,67 @@ other-commands-to-convert: [] # plugin to this list. skip-sender-proxy: [] ``` +===Spigot +```yaml +# Verbose outputs (default: false) +# If "true", outputs command registration and unregistration logs in the console +verbose-outputs: false + +# Silent logs (default: false) +# If "true", turns off all logging from the CommandAPI, except for errors. +silent-logs: false + +# Messages +# Controls messages that the CommandAPI displays to players +messages: + + # Missing executor implementation (default: "This command has no implementations for %s") + # The message to display to senders when a command has no executor. Available + # parameters are: + # %s - the executor class (lowercase) + # %S - the executor class (normal case) + missing-executor-implementation: This command has no implementations for %s + +# Create dispatcher JSON (default: false) +# If "true", the CommandAPI creates a command_registration.json file showing the +# mapping of registered commands. This is designed to be used by developers - +# setting this to "false" will improve command registration performance. +create-dispatcher-json: false + +# Use latest version (default: false) +# If "true", the CommandAPI will use the latest available NMS implementation +# when the CommandAPI is used. This avoids all checks to see if the latest NMS +# implementation is actually compatible with the current Minecraft version. +use-latest-nms-version: false +# Be lenient with version checks when loading for new minor Minecraft versions (default: false) +# If "true", the CommandAPI loads NMS implementations for potentially unsupported Minecraft versions. +# For example, this setting may allow updating from 1.21.1 to 1.21.2 as only the minor version is changing +# but will not allow an update from 1.21.2 to 1.22. +# Keep in mind that implementations may vary and actually updating the CommandAPI might be necessary. +be-lenient-for-minor-versions: false + +# Skips the initial datapack reload when the server loads (default: false) +# If "true", the CommandAPI will not reload datapacks when the server has finished +# loading. Datapacks will still be reloaded if performed manually when "hook-paper-reload" +# is set to "true" and /minecraft:reload is run. +skip-initial-datapack-reload: false + +# Plugins to convert (default: []) +# Controls the list of plugins to process for command conversion. +plugins-to-convert: [] + +# Other commands to convert (default: []) +# A list of other commands to convert. This should be used for commands which +# are not declared in a plugin.yml file. +other-commands-to-convert: [] + +# Skip sender proxy (default: []) +# Determines whether the proxy sender should be skipped when converting a +# command. If you are having issues with plugin command conversion, add the +# plugin to this list. +skip-sender-proxy: [] +``` ::: ## Configuration settings From 085078ec84a4b453e5ab188fedb02e5165323398 Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Mon, 17 Feb 2025 19:30:53 +0100 Subject: [PATCH 03/33] Add diff language support --- docs/.vitepress/config.mts | 7 ++++++- docs/en/upgrading-parts/10.1.2-to-11.0.0.md | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index d0ad3708..b54e7fe5 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -113,8 +113,13 @@ const vitepressOptions: UserConfig = { }] }).then(_ => { }) + shiki.loadLanguage({ + name: 'diff', + scopeName: 'source.diff' + }).then(_ => { + }) }, - config: (md) => { + config: ( md) => { tabsPlugin(md); injectUpgradingPartsPlugin(md); mermaidSpaceConverter(md); diff --git a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md index 05357c11..5a3f4701 100644 --- a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md +++ b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md @@ -9,6 +9,21 @@ For 11.0.0, the `commandapi-bukkit-xxx` modules have mostly been removed in favo In order to update please replace your `commandapi-bukkit-xxx` dependency with either `commandapi-paper-xxx` or `commandapi-spigot-xxx`. +More dependency-related changes have taken place, here they all are listed: + +```diff +commandapi-bukkit-xxx // [!code --] +commandapi-paper-xxx // [!code ++] +commandapi-spigot-xxx // [!code ++] + +commandapi-core-kotlin // [!code --] +commandapi-kotlin-core // [!code ++] + +commandapi-bukkit-kotlin // [!code --] +commandapi-kotlin-paper // [!code ++] +commandapi-kotlin-spigot // [!code ++] +``` + :::danger **Developer's Note:** The fact that Paper is a fork of Spigot does not mean that the Spigot modules work on Paper. Paper has, especially in newer versions, made changes to internal systems the CommandAPI @@ -19,11 +34,6 @@ There again is no guarantee for any kind of compatibility. ::: -Additionally, the Kotlin module artifact names have changed. Instead of following the pattern `commandapi-bukkit-xxx`, they have now been updated as follows: - -- `commandapi-core-kotlin`: was changed to `commandapi-kotlin-core` -- `commandapi-bukkit-kotlin`: was changed to `commandapi-kotlin-bukkit` - #### Code changes The `CommandAPIBukkitConfig` class has been converted into an abstract class and is no longer used to construct a config instance. Instead, use the new `CommandAPIPaperConfig` or From 2516a3aae8a9b93072094b9d0dc2a6834289c3c9 Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Fri, 22 Aug 2025 21:02:13 +0200 Subject: [PATCH 04/33] Update mappings preference switch to say "Paper" and "Spigot" instead of "Mojmap" and "Reobf" --- docs/.vitepress/theme/preference/PreferenceSwitch.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/.vitepress/theme/preference/PreferenceSwitch.vue b/docs/.vitepress/theme/preference/PreferenceSwitch.vue index 8bd96e53..64bc1ab8 100644 --- a/docs/.vitepress/theme/preference/PreferenceSwitch.vue +++ b/docs/.vitepress/theme/preference/PreferenceSwitch.vue @@ -123,14 +123,14 @@ onMounted(() => {
- + - +
From d81cac5c653e7a3fa2738e5f95bdd4ec7913fdda Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Fri, 22 Aug 2025 21:22:39 +0200 Subject: [PATCH 05/33] Document the updated config options --- docs/en/dev-setup/shading.md | 3 +-- docs/en/upgrading-parts/10.1.2-to-11.0.0.md | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/en/dev-setup/shading.md b/docs/en/dev-setup/shading.md index 0c3d871e..265b6ec6 100644 --- a/docs/en/dev-setup/shading.md +++ b/docs/en/dev-setup/shading.md @@ -52,8 +52,7 @@ However, the `CommandAPIConfig` class is abstract and can’t be used to configu ===Bukkit ```java public abstract class CommandAPIBukkitConfig extends CommandAPIConfig { - CommandAPIBukkitConfig useLatestNMSVersion(boolean value); // Whether the latest NMS implementation should be used or not - CommandAPIBukkitConfig beLenientForMinorVersions(boolean value); // Whether the CommandAPI should be more lenient with minor Minecraft versions + CommandAPIBukkitConfig fallbackToLatestNMS(boolean fallbackToLatestNMS); // Whether the CommandAPI should fall back to the latest NMS version if no implementation for the current version was found CommandAPIBukkitConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing CommandAPIConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info } diff --git a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md index 5a3f4701..1fd74134 100644 --- a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md +++ b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md @@ -43,11 +43,20 @@ Further changes have been made to arguments that work with components. The class removed. Instead, the `ChatArgument`, `ChatComponentArgument` and `ChatColorArgument` have been implemented platform specific and return different types on Paper and Spigot. On Paper, Adventure components are used while Spigot uses BungeeCord components. -More argument changes have been made: +**More argument changes have been made:** - The `FloatRangeArgument` has been renamed to `DoubleRangeArgument` and now returns a `DoubleRange` object - The `PlayerArgument` and `OfflinePlayerArgument` have been replaced by the `PlayerProfileArgument` which returns a `List<PlayerProfile>`. The `PlayerProfile` class changes depending on if you are on Paper or on Spigot. Use the `EntitySelectorArgument.OnePlayer` if you want a `Player` object. - The `AsyncOfflinePlayerArgument` has been replaced by the `AsyncPlayerProfileArgument` - The `ChatArgument`, `ChatComponentArgument` and `ChatColorArgument` do no longer have any `Adventure` prefixes and return different types depending on the platform. - The `ChatArgument` returns a `SignedMessage` object on Paper -- The `BlockStateArgument` now returns a `BlockState` object instead of a `BlockData` object \ No newline at end of file +- The `BlockStateArgument` now returns a `BlockState` object instead of a `BlockData` object + +#### Config changes + +The `use-latest-nms-version` and `be-lenient-for-minor-versions` config options have been removed and have been replaced by the new `fallback-to-latest-nms` config option. +This config options combines the functionality of the former config options by first trying to load the correct version and if it can't find a matching implementation for the current version, +it, if set to `true`, will load the latest implementation. +On Paper it is set to `true` by default and on Spigot it is set to `false`. + +Furthermore, any config options relating to reloading datapacks have been removed on Paper as they are not needed anymore. \ No newline at end of file From 7408d7ec79d92c5a1935d7d53c1a6cb8d9f66455 Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Fri, 22 Aug 2025 21:38:30 +0200 Subject: [PATCH 06/33] Update default configs --- docs/en/user-setup/config.md | 53 ++++++++---------------------------- 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/docs/en/user-setup/config.md b/docs/en/user-setup/config.md index 80952750..25bdc247 100644 --- a/docs/en/user-setup/config.md +++ b/docs/en/user-setup/config.md @@ -44,33 +44,11 @@ messages: # setting this to "false" will improve command registration performance. create-dispatcher-json: false -# Use latest version (default: false) -# If "true", the CommandAPI will use the latest available NMS implementation -# when the CommandAPI is used. This avoids all checks to see if the latest NMS -# implementation is actually compatible with the current Minecraft version. -use-latest-nms-version: false - -# Be lenient with version checks when loading for new minor Minecraft versions (default: false) -# If "true", the CommandAPI loads NMS implementations for potentially unsupported Minecraft versions. -# For example, this setting may allow updating from 1.21.1 to 1.21.2 as only the minor version is changing -# but will not allow an update from 1.21.2 to 1.22. -# Keep in mind that implementations may vary and actually updating the CommandAPI might be necessary. -be-lenient-for-minor-versions: false - -# Hook into Paper's ServerResourcesReloadedEvent (default: false) -# If "true", and the CommandAPI detects it is running on a Paper server, it will -# hook into Paper's ServerResourcesReloadedEvent to detect when /minecraft:reload is run. -# This allows the CommandAPI to automatically call its custom datapack-reloading -# function which allows CommandAPI commands to be used in datapacks. -# If you set this to false, CommandAPI commands may not work inside datapacks after -# reloading datapacks. -hook-paper-reload: false - -# Skips the initial datapack reload when the server loads (default: true) -# If "true", the CommandAPI will not reload datapacks when the server has finished -# loading. Datapacks will still be reloaded if performed manually when "hook-paper-reload" -# is set to "true" and /minecraft:reload is run. -skip-initial-datapack-reload: true +# Fallback to latest version (default: true) +# If "true", the CommandAPI will fall back to the latest available NMS +# implementation when the CommandAPI is used and no implementation for the +# current Minecraft version was found. +fallback-to-latest-nms: true # Plugins to convert (default: []) # Controls the list of plugins to process for command conversion. @@ -114,24 +92,17 @@ messages: # setting this to "false" will improve command registration performance. create-dispatcher-json: false -# Use latest version (default: false) -# If "true", the CommandAPI will use the latest available NMS implementation -# when the CommandAPI is used. This avoids all checks to see if the latest NMS -# implementation is actually compatible with the current Minecraft version. -use-latest-nms-version: false - -# Be lenient with version checks when loading for new minor Minecraft versions (default: false) -# If "true", the CommandAPI loads NMS implementations for potentially unsupported Minecraft versions. -# For example, this setting may allow updating from 1.21.1 to 1.21.2 as only the minor version is changing -# but will not allow an update from 1.21.2 to 1.22. -# Keep in mind that implementations may vary and actually updating the CommandAPI might be necessary. -be-lenient-for-minor-versions: false +# Fallback to latest version (default: false) +# If "true", the CommandAPI will fall back to the latest available NMS +# implementation when the CommandAPI is used and no implementation for the +# current Minecraft version was found. +fallback-to-latest-nms: false -# Skips the initial datapack reload when the server loads (default: false) +# Skips the initial datapack reload when the server loads (default: true) # If "true", the CommandAPI will not reload datapacks when the server has finished # loading. Datapacks will still be reloaded if performed manually when "hook-paper-reload" # is set to "true" and /minecraft:reload is run. -skip-initial-datapack-reload: false +skip-initial-datapack-reload: true # Plugins to convert (default: []) # Controls the list of plugins to process for command conversion. From 759a92c451597a5e711cd1437b79fd1ed42504f6 Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Fri, 22 Aug 2025 22:04:09 +0200 Subject: [PATCH 07/33] Rename "mappings" preference to "paper-spigot" and use that on the config page --- .../theme/preference/PreferenceSwitch.vue | 12 +++---- docs/en/dev-setup/shading.md | 14 ++++---- docs/en/user-setup/config.md | 32 ++++++------------- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/docs/.vitepress/theme/preference/PreferenceSwitch.vue b/docs/.vitepress/theme/preference/PreferenceSwitch.vue index 64bc1ab8..9810ce1f 100644 --- a/docs/.vitepress/theme/preference/PreferenceSwitch.vue +++ b/docs/.vitepress/theme/preference/PreferenceSwitch.vue @@ -122,7 +122,7 @@ onMounted(() => { /> -
+
{ \ No newline at end of file diff --git a/docs/en/create-commands/registration.md b/docs/en/create-commands/registration.md index 48bf6e49..293c18df 100644 --- a/docs/en/create-commands/registration.md +++ b/docs/en/create-commands/registration.md @@ -1,5 +1,6 @@ --- order: 1 +preferences: ["paper-spigot"] authors: - DerEchtePilz - willkroboth @@ -202,11 +203,22 @@ Register the command with the provided plugin's name. ## Command loading order -It is recommended to register commands in either the `onLoad()` or `onEnable()` method. With the CommandAPI, depending on whether you use `onLoad()` or `onEnable()` to load your commands depends on whether your plugin is used with Minecraft's functions: +Places where you can register commands are listed below: -| When to load | What to do | -|---------------------|--------------------------------------------------------------------------------------------------------------------------------| -| `onLoad()` method | Register commands to be used in Minecraft functions ([see the Function section for more info](./functions-and-tags/functions)) | -| `onEnable()` method | Register regular commands | +
-The CommandAPI does support registering commands outside of these methods while the server is running. Commands registered after the server is done loading _should_ work the same as commands registered in `onEnable`. +| When to load | What to do | +|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| +| `bootstrap(BootstrapContext)` method | Register commands to be used in Minecraft functions ([see the Function section for more info](./functions-and-tags/functions)) | +| `onLoad()`/`onEnable()` method | Register regular commands not available in datapacks by default | + +
+
+ +| When to load | What to do | +|--------------------------------|-----------------------------------------------------------------| +| `onLoad()`/`onEnable()` method | Register regular commands not available in datapacks by default | + +
+ +The CommandAPI does support registering commands outside of these methods while the server is running. Commands registered after the server is done loading _should_ work the same as commands registered in `onLoad()`/`onEnable()`. diff --git a/docs/en/create-commands/unregistration.md b/docs/en/create-commands/unregistration.md index 2a8fe0f7..b795fd7f 100644 --- a/docs/en/create-commands/unregistration.md +++ b/docs/en/create-commands/unregistration.md @@ -1,6 +1,8 @@ --- order: 2 +preferences: ["paper-spigot"] authors: + - DerEchtePilz - willkroboth - MC-XiaoHei --- @@ -17,7 +19,32 @@ CommandAPI.unregister(String commandName, boolean unregisterNamespaces); CommandAPIBukkit.unregister(String commandName, boolean unregisterNamespaces, boolean unregisterBukkit); ``` -To understand when and how to use these methods, you need to know a little about how Bukkit loads and sets up commands. This is basically the order of events when a Bukkit server starts: +
+ +To understand when and how to use these methods, you need to know a little about how Paper loads and sets up commands. This is basically the order of events when a Paper server starts: + +1. Plugins are initialized + - `PluginBootstrap#boostrap(BootstrapContext)` is called +2. Vanilla commands are registered +3. Lifecycle events for the bootstrap stage are executed +4. Bukkit commands are placed in the Bukkit CommandMap + - Given the `bukkit` namespace +5. Plugins are loaded + - `onLoad()` is called +6. Plugins are enabled + - If a plugin uses it, then + - Plugin commands are read from the [`plugin.yml` file](https://www.spigotmc.org/wiki/plugin-yml/#commands) and placed in the Bukkit CommandMap + - Given the plugin's name as their namespace (e.g. `luckperms:lp`) + - `onEnable` is called + - Repeat for each plugin +7. Bukkit's help command is registered +8. Lifecycle events for the plugin stage are executed +9. The server is done loading + +
+
+ +To understand when and how to use these methods, you need to know a little about how Spigot loads and sets up commands. This is basically the order of events when a Spigot server starts: 1. Vanilla commands are placed in the Vanilla CommandDispatcher 2. Bukkit commands are placed in the Bukkit CommandMap @@ -34,6 +61,8 @@ To understand when and how to use these methods, you need to know a little about - Given the `minecraft` namespace (e.g. `minecraft:gamemode`) 7. The server is done loading +
+ Unregistering a command only works if it happens after the command is created. Bukkit's command system is special and has two locations where commands can exist -- either the Vanilla CommandDispatcher or the Bukkit CommandMap -- so you also need to know where your command is registered. With that in mind, here is what each of the `unregister` methods do: ```java @@ -56,57 +85,133 @@ Unregisters a command from Bukkit. As before, if `unregisterNamespaces` is `true To give a better idea of how and when to use these methods, the rest of this page documents how to unregister different types of commands. +
+ +::::tip Developer's Note: +But first, let's take a look at where the CommandAPI registers commands. While you are able to call the `register()` method basically anywhere (as mentioned on the [registration page](registration.md#command-loading-order)), CommandAPI commands +are only actually registered in two places: step 3 and step 8 of the loading sequence above. + +Step 3 applies if you register commands in a bootstrap context which may look something like this: + +:::tabs +===Java +<<< @/../reference-code/paper/src/main/java/createcommands/Unregistration.java#registerBootstrapExample +===Kotlin +<<< @/../reference-code/paper/src/main/kotlin/createcommands/Unregistration.kt#registerBootstrapExample +::: + +Note that the `CommandAPI#onLoad(CommandAPIConfig)` call is now in the `bootstrap` method. + +Step 8 applies if you register commands in the `JavaPlugin#onLoad()` or the `JavaPlugin#onEnable()` methods. + +Similarly, unregistrations are also handled in a lifecycle event which runs after the events that register commands. + +:::: + +
+ ## Unregistering a Bukkit command - `/version` +
+ +:::tip Developer's Note: +Paper has recently converted some commands that were Bukkit commands before to Brigadier commands. This includes the `/version` command. For demonstration's sake we'll assume it is still a Bukkit command (which still does apply to some versions). +::: + +`/version` is a command provided by Bukkit. Looking at the sequence of events above, that means it is created during step 4, before plugins are loaded in step 5. Consequently, the command will exist when the unregistration event is ran after step 8. Here we'll unregister the command in `onLoad`, but the same would work in `onEnable` too. + +
+
+ `/version` is a command provided by Bukkit. Looking at the sequence of events above, that means it is created during step 2, before plugins are loaded in step 3. Consequently, the command will exist when our plugin's `onLoad` method is called, so we'll unregister it there. The same code will work in `onEnable` too, since step 4 is also after step 2. +
+ Since this command exists in the Bukkit CommandMap, we'll need to use `CommandAPIBukkit#unregister` with `unregisterBukkit` set to `true`. We'll also remove the namespaced version -- `/bukkit:version` -- so `unregisterNamespaces` will be `true`. All together, the code looks like this: :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterBukkitExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterBukkitExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterBukkitExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterBukkitExample ::: With this plugin, executing `/version` or `/bukkit:version` will give the unknown command message. Note that aliases like `/ver` and its namespaced version `/bukkit:ver` will still work. To remove aliases as well, you need to unregister each as its own command. For, `/ver`, that would mean calling `CommandAPIBukkit.unregister("ver", true, true)`. ## Unregistering a Vanilla command - `/gamemode` +
+ +`/gamemode` is a command provided by Vanilla Minecraft. Like the [previous example](#unregistering-a-bukkit-command-version), Vanilla commands are created in step 2, before lifecycle events for the bootstrap stage are ran and plugins are loaded in step 5. For variety, we'll unregister the command in our plugin's `onEnable` -- step 6 -- but the same code would also work in `onLoad`. + +
+
+ `/gamemode` is a command provided by Vanilla Minecraft. Like the [previous example](#unregistering-a-bukkit-command-version), Vanilla commands are created in step 1, before plugins are loaded in step 3. For variety, we'll unregister the command in our plugin's `onEnable` -- step 4 -- but the same code would also work in `onLoad`. +
+ Since this command exists in the Vanilla CommandDispatcher, we can use `CommandAPI#unregister`. That works the same as `CommandAPIBukkit#unregister` with `unregisterBukkit` set to `false`. We don't care about the namespace, so `unregisterNamespaces` will be `false`. That means we can use the simplest method, `CommandAPI.unregister(String commandName)`, since it sets `unregisterNamespaces` to `false` by default. All together, the code looks like this: :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterVanillaExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterVanillaExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaExample ::: +
+ With this code, executing `/gamemode` will give the unknown command exception as expected. However, even though `unregisterNamespaces` was `false`, `/minecraft:gamemode` can also not be run. This happens because Vanilla commands are given their namespace in step 6, after our plugin has removed `/gamemode`. When the server starts, `/gamemode` is created in step 2 inside the Vanilla CommandDispatcher. In step 4, our plugin is enabled and we remove the `/gamemode` command from that CommandDispatcher. After all the plugins enable, step 6 moves all commands in the Vanilla CommandDispatcher to the Bukkit CommandMap and gives them the `minecraft` namespace. Since `/gamemode` doesn't exist at this point, step 6 cannot create the `/minecraft:gamemode` command. So, even though `unregisterNamespaces` was `false`, `/minecraft:gamemode` doesn't exist anyway. +
+ ::::tip Example - Replacing Minecraft's `/gamemode` command +
+ +To replace a command, simply register a new implementation for that command. Any attempts to unregister first will result in the new implementation to also not be present. + +:::tabs +===Java +<<< @/../reference-code/paper/src/main/java/createcommands/Unregistration.java#unregisterVanillaAndReplaceExample +===Kotlin +<<< @/../reference-code/paper/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaAndReplaceExample +::: + +
+
+ To replace a command, first unregister the original command, then register a new implementation for that command. :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterVanillaAndReplaceExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterVanillaAndReplaceExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaAndReplaceExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaAndReplaceExample ::: +
+ Now, when `/gamemode` is executed, it will use the new implementation defined using the CommandAPI. :::: ## Unregistering a Plugin command - `/luckperms:luckperms` +
+ +The `/luckperms` command is provided by the Bukkit [LuckPerms](https://luckperms.net/) plugin. Plugin commands are created during step 6, immediately before calling the `onEnable` method of the respective plugin. Since unregistrations run after step 8, it does not matter where we unregister, however here we choose to do it in the `onEnable`. We also have to make sure that our plugin is loaded after LuckPerms. The best way to make sure that happens is to add LuckPerms as a `depend` or `softdepend` in our plugin's plugin.yml. You can read more about the different between `depend` and `softdepend` in [Spigot's documentation](https://www.spigotmc.org/wiki/plugin-yml/#optional-attributes), but that will look something like this: + +
+
+ The `/luckperms` command is provided by the Bukkit [LuckPerms](https://luckperms.net/) plugin. Plugin commands are created during step 4, immediately before calling the `onEnable` method of the respective plugin. In this case, unregistering the command in our own plugin's `onLoad` would not work, since the command wouldn't exist yet. We also have to make sure that our `onEnable` method is called after LuckPerm's. The best way to make sure that happens is to add LuckPerms as a `depend` or `softdepend` in our plugin's plugin.yml. You can read more about the different between `depend` and `softdepend` in [Spigot's documentation](https://www.spigotmc.org/wiki/plugin-yml/#optional-attributes), but that will look something like this: +
+ ```yaml name: MyPlugin main: some.package.name.Main @@ -119,15 +224,24 @@ Since plugin commands are stored in the Bukkit CommandMap, we need to use `Comma :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterPluginExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterPluginExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterPluginExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterPluginExample ::: Executing `/luckperms` will work as normal, but `/luckperms:luckperms` will give the unknown command message. ## Unregistering a CommandAPI command +
+ +Unregistering a command created by the CommandAPI is easy. + +For our example, let's say we want to unregister the `/break` command created by the [Bukkit Maven Example Project](https://github.com/CommandAPI/CommandAPI/tree/master/examples/bukkit/maven) for the CommandAPI. + +
+
+ Unregistering a command created by the CommandAPI is similar to both unregistering a Vanilla command and a plugin command. Like a Vanilla command, CommandAPI commands are stored in the Vanilla CommandDispatcher, so they should be unregistered with `unregisterBukkit` set to `false`. Like plugin commands, they may be created in `onEnable`, so you need to make sure your plugin is enabled after the plugin that adds the command. Unlike plugin commands, CommandAPI commands may be created in `onLoad`, as discussed in [Command loading order](./registration#command-loading-order). That just means you may also be able to unregister the command in you own plugin's `onLoad`. As always, simply make sure you unregister a command after it is created, and it will be removed properly. @@ -162,15 +276,19 @@ You can see that the ExamplePlugin registers its commands when `onEnable` is cal In summary, we will unregister the `/break` command in our plugin's `onEnable`. We added Example plugin to the `depend` list in our plugin.yml so that our `onEnable` method runs second. `unregisterNamespaces` and `unregisterBukkit` will be set to `false`, and those are the default values, so we can simply use `CommandAPI.unregister(String commandName)`. All together, the code looks like this: +
+ :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterCommandAPIExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterCommandAPIExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterCommandAPIExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterCommandAPIExample ::: Now, when you try to execute `/break`, you will just get the unknown command message as if it never existed. +
+ ## Special case: Unregistering Bukkit's `/help` If you look at the sequence of events at the top of this page, you might notice that Bukkit's `/help` command gets its own place in step 5. Unlike the other [Bukkit commands](#unregistering-a-bukkit-command-version), `/help` is special and gets registered after plugins are loaded and enabled (don't ask, I don't know why :P). That means unregistering `/help` in `onLoad` or `onEnable` does not work, since the command doesn't exist yet. @@ -181,9 +299,9 @@ Since `/help` is in the Bukkit CommandMap, we need to use `CommandAPIBukkit#unre :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterBukkitHelpExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterBukkitHelpExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterBukkitHelpExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterBukkitHelpExample ::: Funnily, if you try to execute `/help`, the server will still tell you: `Unknown command. Type "/help" for help.`. Luckily, `unregisterNamespaces` was `false`, so you can still use `/bukkit:help` to figure out your problem. @@ -200,9 +318,9 @@ Finally, `unregisterNamespaces` should be `false`, and since that's the default :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterVanillaNamespaceOnlyExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterVanillaNamespaceOnlyExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaNamespaceOnlyExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterVanillaNamespaceOnlyExample ::: With this code, `/gamemode` will execute as normal, but `/minecraft:gamemode` will give the unknown command message. @@ -213,9 +331,9 @@ Doing the opposite action here -- only unregistering `/gamemode` but keeping `/m :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterDelayedVanillaBadExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterDelayedVanillaBadExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterDelayedVanillaBadExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterDelayedVanillaBadExample ::: The expected outcome of this code is that `/minecraft:gamemode` would work as expected, and `/gamemode` would give the command not found message. However, that is only true for the player's commands. If you try to use `/minecraft:gamemode` in the console, it *will not work* properly. Specifically, while you can tab-complete the command's label, `minecraft:gamemode` the command's arguments will not have any suggestions. If you try to execute `/minecraft:gamemode` in the console, it will always tell you your command is unknown or incomplete. @@ -224,9 +342,11 @@ The main point is that if you ever try to unregister a Vanilla command after the :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/Unregistration.java#unregisterDelayedVanillaGoodExample +<<< @/../reference-code/spigot/src/main/java/createcommands/Unregistration.java#unregisterDelayedVanillaGoodExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt#unregisterDelayedVanillaGoodExample +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt#unregisterDelayedVanillaGoodExample ::: -:::: \ No newline at end of file +:::: + +
\ No newline at end of file diff --git a/reference-code/paper/src/main/java/createcommands/Unregistration.java b/reference-code/paper/src/main/java/createcommands/Unregistration.java new file mode 100644 index 00000000..2d493403 --- /dev/null +++ b/reference-code/paper/src/main/java/createcommands/Unregistration.java @@ -0,0 +1,137 @@ +package createcommands; + +import dev.jorel.commandapi.CommandAPI; +import dev.jorel.commandapi.CommandAPIBukkit; +import dev.jorel.commandapi.CommandAPICommand; +import dev.jorel.commandapi.CommandAPIPaperConfig; +import dev.jorel.commandapi.arguments.MultiLiteralArgument; +import io.papermc.paper.plugin.bootstrap.BootstrapContext; +import io.papermc.paper.plugin.bootstrap.PluginBootstrap; +import net.kyori.adventure.text.Component; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; +import org.jetbrains.annotations.NotNull; + +class Unregistration { + + // #region registerBootstrapExample + public class MyPluginBootstrap implements PluginBootstrap { + + @Override + public void bootstrap(@NotNull BootstrapContext context) { + CommandAPI.onLoad(new CommandAPIPaperConfig<>(context.getPluginMeta(), context)); + + new CommandAPICommand("inbootstrap") + .executes((sender, args) -> { + sender.sendMessage(Component.text("This command is registed in step 3!")); + }) + .register(); + } + } + // #endregion registerBootstrapExample + + { + new JavaPlugin() { + // #region unregisterBukkitExample + @Override + public void onLoad() { + CommandAPIBukkit.unregister("version", true, true); + } + // #endregion unregisterBukkitExample + }; + + new JavaPlugin() { + // #region unregisterVanillaExample + @Override + public void onEnable() { + CommandAPI.unregister("gamemode"); + } + // #endregion unregisterVanillaExample + }; + + new JavaPlugin() { + // #region unregisterVanillaAndReplaceExample + @Override + public void onEnable() { + // Register our new /gamemode, with survival, creative, adventure and spectator + new CommandAPICommand("gamemode") + .withArguments(new MultiLiteralArgument("gamemodes", "survival", "creative", "adventure", "spectator")) + .executes((sender, args) -> { + // Implementation of our /gamemode command + }) + .register(); + } + // #endregion unregisterVanillaAndReplaceExample + }; + + new JavaPlugin() { + // #region unregisterPluginExample + @Override + public void onEnable() { + CommandAPIBukkit.unregister("luckperms:luckperms", false, true); + } + // #endregion unregisterPluginExample + }; + + new JavaPlugin() { + // #region unregisterCommandAPIExample + @Override + public void onEnable() { + CommandAPI.unregister("break"); + } + // #endregion unregisterCommandAPIExample + }; + + new JavaPlugin() { + // #region unregisterBukkitHelpExample + @Override + public void onEnable() { + CommandAPIBukkit.unregister("help", false, true); + } + // #endregion unregisterBukkitHelpExample + }; + + new JavaPlugin() { + // #region unregisterVanillaNamespaceOnlyExample + @Override + public void onEnable() { + new BukkitRunnable() { + @Override + public void run() { + CommandAPI.unregister("minecraft:gamemode"); + } + }.runTaskLater(this, 0); + } + // #endregion unregisterVanillaNamespaceOnlyExample + }; + + new JavaPlugin() { + // #region unregisterDelayedVanillaBadExample + // NOT RECOMMENDED + @Override + public void onEnable() { + new BukkitRunnable() { + @Override + public void run() { + CommandAPI.unregister("gamemode"); + } + }.runTaskLater(this, 0); + } + // #endregion unregisterDelayedVanillaBadExample + }; + + new JavaPlugin() { + // #region unregisterDelayedVanillaGoodExample + @Override + public void onEnable() { + new BukkitRunnable() { + @Override + public void run() { + CommandAPI.unregister("gamemode", true); + } + }.runTaskLater(this, 0); + } + // #endregion unregisterDelayedVanillaGoodExample + }; + } +} diff --git a/reference-code/paper/src/main/kotlin/createcommands/Unregistration.kt b/reference-code/paper/src/main/kotlin/createcommands/Unregistration.kt new file mode 100644 index 00000000..783580ee --- /dev/null +++ b/reference-code/paper/src/main/kotlin/createcommands/Unregistration.kt @@ -0,0 +1,122 @@ +package createcommands + +import dev.jorel.commandapi.CommandAPI +import dev.jorel.commandapi.CommandAPIBukkit +import dev.jorel.commandapi.CommandAPICommand +import dev.jorel.commandapi.CommandAPIPaperConfig +import dev.jorel.commandapi.arguments.MultiLiteralArgument +import dev.jorel.commandapi.executors.CommandExecutor +import io.papermc.paper.plugin.bootstrap.BootstrapContext +import io.papermc.paper.plugin.bootstrap.PluginBootstrap +import net.kyori.adventure.text.Component +import org.bukkit.plugin.java.JavaPlugin +import org.bukkit.scheduler.BukkitRunnable + +class UnregistrationKT { + + // #region registerBootstrapExample + class MyPluginBootstrap : PluginBootstrap { + + override fun bootstrap(context: BootstrapContext) { + CommandAPI.onLoad(CommandAPIPaperConfig(context.pluginMeta, context)) + + CommandAPICommand("inbootstrap") + .executes(CommandExecutor { sender, _ -> + sender.sendMessage(Component.text("This command is registed in step 3!")) + }) + .register() + } + } + // #endregion registerBootstrapExample + + class A : JavaPlugin() { + // #region unregisterBukkitExample + override fun onLoad() { + CommandAPIBukkit.unregister("version", true, true) + } + // #endregion unregisterBukkitExample + } + + class B : JavaPlugin() { + // #region unregisterVanillaExample + override fun onEnable() { + CommandAPI.unregister("gamemode") + } + // #endregion unregisterVanillaExample + } + + class C : JavaPlugin() { + // #region unregisterVanillaAndReplaceExample + override fun onEnable() { + // Register our new /gamemode, with survival, creative, adventure and spectator + CommandAPICommand("gamemode") + .withArguments(MultiLiteralArgument("gamemodes", "survival", "creative", "adventure", "spectator")) + .executes(CommandExecutor { sender, args -> + // Implementation of our /gamemode command + }) + .register() + } + // #endregion unregisterVanillaAndReplaceExample + } + + class D : JavaPlugin() { + // #region unregisterPluginExample + override fun onEnable() { + CommandAPIBukkit.unregister("luckperms:luckperms", false, true) + } + // #endregion unregisterPluginExample + } + + class E : JavaPlugin() { + // #region unregisterCommandAPIExample + override fun onEnable() { + CommandAPI.unregister("break") + } + // #endregion unregisterCommandAPIExample + } + + class F : JavaPlugin() { + // #region unregisterBukkitHelpExample + override fun onEnable() { + CommandAPIBukkit.unregister("help", false, true) + } + // #endregion unregisterBukkitHelpExample + } + + class G : JavaPlugin() { + // #region unregisterVanillaNamespaceOnlyExample + override fun onEnable() { + object : BukkitRunnable() { + override fun run() { + CommandAPI.unregister("minecraft:gamemode") + } + }.runTaskLater(this, 0) + } + // #endregion unregisterVanillaNamespaceOnlyExample + } + + class H : JavaPlugin() { + // #region unregisterDelayedVanillaBadExample + // NOT RECOMMENDED + override fun onEnable() { + object : BukkitRunnable() { + override fun run() { + CommandAPI.unregister("gamemode") + } + }.runTaskLater(this, 0) + } + // #endregion unregisterDelayedVanillaBadExample + } + + class I : JavaPlugin() { + // #region unregisterDelayedVanillaGoodExample + override fun onEnable() { + object : BukkitRunnable() { + override fun run() { + CommandAPI.unregister("gamemode", true) + } + }.runTaskLater(this, 0) + } + // #endregion unregisterDelayedVanillaGoodExample + } +} \ No newline at end of file diff --git a/reference-code/bukkit/src/main/java/createcommands/Unregistration.java b/reference-code/spigot/src/main/java/createcommands/Unregistration.java similarity index 100% rename from reference-code/bukkit/src/main/java/createcommands/Unregistration.java rename to reference-code/spigot/src/main/java/createcommands/Unregistration.java diff --git a/reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt b/reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt similarity index 100% rename from reference-code/bukkit/src/main/kotlin/createcommands/Unregistration.kt rename to reference-code/spigot/src/main/kotlin/createcommands/Unregistration.kt From 2873d18c918f330e039fd1f756e38840172aa27a Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:29:51 +0200 Subject: [PATCH 23/33] Start dealing with the code review - Functions page needs a rewrite - The IntegerRange/DoubleRange argument page needs a new screenshot - Apparently there might be some rendering issues with the diff on the upgrade page to 11.0.0? --- .../arguments/suggestions/safe-suggestions.md | 10 +-- .../arguments/types/ranged-arguments.md | 2 +- docs/en/create-commands/registration.md | 2 +- docs/en/dev-setup/shading.md | 75 ++++++++++--------- docs/en/internal/internal.md | 4 +- docs/en/upgrading-parts/10.1.2-to-11.0.0.md | 2 +- update.sh | 2 +- 7 files changed, 52 insertions(+), 45 deletions(-) diff --git a/docs/en/create-commands/arguments/suggestions/safe-suggestions.md b/docs/en/create-commands/arguments/suggestions/safe-suggestions.md index ae364f1e..314b0510 100644 --- a/docs/en/create-commands/arguments/suggestions/safe-suggestions.md +++ b/docs/en/create-commands/arguments/suggestions/safe-suggestions.md @@ -51,16 +51,16 @@ The list of supported arguments are displayed in the following table. The parame | [`AxisArgument`](../types/position/axis-arguments) | `java.util.EnumSet` | | [`BiomeArgument`](../types/misc/biome-arguments) | `org.bukkit.block.Biome` | | [`BooleanArgument`](../types/primitive-arguments) | **`Boolean`** | -| [`ChatColorArgument`](../types/chat/spigot-chat-arguments#chat-color-argument) | `org.bukkit.ChatColor` | +| [`ChatColorArgument`](../types/chat/spigot-chat-arguments#chat-color-argument) | `net.kyori.adventure.text.format.NamedTextColor` | | [`DoubleArgument`](../types/primitive-arguments#numerical-arguments) | **`Double`** | +| [`DoubleRangeArgument`](../types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.DoubleRange` | | [`EnchantmentArgument`](../types/misc/enchantment-arguments) | `org.bukkit.enchantments.Enchantment` | | [`EntityTypeArgument`](../types/entities-arguments#entity-type-argument) | `org.bukkit.entity.EntityType` | | [`FloatArgument`](../types/primitive-arguments#numerical-arguments) | **`Float`** | -| [`FloatRangeArgument`](../types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.FloatRange` | | [`FunctionArgument`](../../functions-and-tags/function-arguments) | **`org.bukkit.NamespacedKey`** | | [`GreedyStringArgument`](../types/string-arguments#greedy-string-argument) | `String` | | [`IntegerArgument`](../types/primitive-arguments#numerical-arguments) | **`Integer`** | -| [`IntegerRangeArgument`](../types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | +| [`IntegerRangeArgument`](../types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | | [`ItemStackArgument`](../types/misc/itemstack-arguments) | `org.bukkit.inventory.ItemStack` | | [`Location2DArgument`](../types/position/location-arguments#2d-location) | `dev.jorel.commandapi.wrappers.Location2D` | | [`LocationArgument`](../types/position/location-arguments#3d-location) | `org.bukkit.Location` | @@ -91,14 +91,14 @@ The list of supported arguments are displayed in the following table. The parame | [`BooleanArgument`](../types/primitive-arguments) | **`Boolean`** | | [`ChatColorArgument`](../types/chat/spigot-chat-arguments#chat-color-argument) | `org.bukkit.ChatColor` | | [`DoubleArgument`](../types/primitive-arguments#numerical-arguments) | **`Double`** | +| [`DoubleRangeArgument`](../types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.DoubleRange` | | [`EnchantmentArgument`](../types/misc/enchantment-arguments) | `org.bukkit.enchantments.Enchantment` | | [`EntityTypeArgument`](../types/entities-arguments#entity-type-argument) | `org.bukkit.entity.EntityType` | | [`FloatArgument`](../types/primitive-arguments#numerical-arguments) | **`Float`** | -| [`FloatRangeArgument`](../types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.FloatRange` | | [`FunctionArgument`](../../functions-and-tags/function-arguments) | **`org.bukkit.NamespacedKey`** | | [`GreedyStringArgument`](../types/string-arguments#greedy-string-argument) | `String` | | [`IntegerArgument`](../types/primitive-arguments#numerical-arguments) | **`Integer`** | -| [`IntegerRangeArgument`](../types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | +| [`IntegerRangeArgument`](../types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | | [`ItemStackArgument`](../types/misc/itemstack-arguments) | `org.bukkit.inventory.ItemStack` | | [`Location2DArgument`](../types/position/location-arguments#2d-location) | `dev.jorel.commandapi.wrappers.Location2D` | | [`LocationArgument`](../types/position/location-arguments#3d-location) | `org.bukkit.Location` | diff --git a/docs/en/create-commands/arguments/types/ranged-arguments.md b/docs/en/create-commands/arguments/types/ranged-arguments.md index 7c94b932..973b5594 100644 --- a/docs/en/create-commands/arguments/types/ranged-arguments.md +++ b/docs/en/create-commands/arguments/types/ranged-arguments.md @@ -43,7 +43,7 @@ The `DoubleRange` class has the following methods: class DoubleRange { public double getLowerBound(); public double getUpperBound(); - public boolean isInRange(float); + public boolean isInRange(double); } ``` diff --git a/docs/en/create-commands/registration.md b/docs/en/create-commands/registration.md index 293c18df..44d09cc8 100644 --- a/docs/en/create-commands/registration.md +++ b/docs/en/create-commands/registration.md @@ -210,7 +210,7 @@ Places where you can register commands are listed below: | When to load | What to do | |--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | `bootstrap(BootstrapContext)` method | Register commands to be used in Minecraft functions ([see the Function section for more info](./functions-and-tags/functions)) | -| `onLoad()`/`onEnable()` method | Register regular commands not available in datapacks by default | +| `onLoad()`/`onEnable()` method | Register regular commands not available in datapacks |
diff --git a/docs/en/dev-setup/shading.md b/docs/en/dev-setup/shading.md index ad580f30..3783b604 100644 --- a/docs/en/dev-setup/shading.md +++ b/docs/en/dev-setup/shading.md @@ -33,47 +33,29 @@ If you want to handle reloading, the CommandAPI has minimal support for it with The `onLoad(CommandAPIConfig)` method initializes the CommandAPI's loading sequence. This must be called _before_ you start to access the CommandAPI and must be placed in your plugin's `onLoad()` method. The argument `CommandAPIConfig` is used to configure how the CommandAPI works. The `CommandAPIConfig` class has the following parameters which let you set how the CommandAPI works similar to the `config.yml`, which is described [here](../user-setup/config). -```java -public class CommandAPIConfig { - CommandAPIConfig verboseOutput(boolean value); // Enables verbose logging - CommandAPIConfig silentLogs(boolean value); // Disables ALL logging (except errors) - CommandAPIConfig dispatcherFile(File file); // If not null, the CommandAPI will create a JSON file with Brigadier's command tree - CommandAPIConfig setNamespace(String namespace); // The namespace to use when the CommandAPI registers a command -} -``` - The `CommandAPIConfig` class follows a typical builder pattern (without you having to run `.build()` at the end), which lets you easily construct configuration instances. -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. +
- +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 Paper server, you should use the `CommandAPIPaperConfig` class. -:::tabs -===Bukkit ```java -public abstract class CommandAPIBukkitConfig extends CommandAPIConfig { - CommandAPIBukkitConfig fallbackToLatestNMS(boolean fallbackToLatestNMS); // Whether the CommandAPI should fall back to the latest NMS version if no implementation for the current version was found - CommandAPIBukkitConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing - CommandAPIConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info -} -``` -===Paper -```java -public class CommandAPIPaperConfig extends CommandAPIBukkitConfig { - CommandAPIPaperConfig(LifecycleEventOwner lifecycleEventOwner); -} -``` -===Spigot -```java -public class CommandAPISpigotConfig extends CommandAPIBukkitConfig { - CommandAPISpigotConfig(JavaPlugin plugin); - - CommandAPISpigotConfig skipReloadDatapacks(boolean skip); // Whether the CommandAPI should reload datapacks on server load +public class CommandAPIPaperConfig { + // Create a new config object + CommandAPIPaperConfig(PluginMeta pluginMeta, LifecycleEventOwner lifecycleEventOwner); + + // General CommandAPI configuration + CommandAPIPaperConfig verboseOutput(boolean value); // Enables verbose logging + CommandAPIPaperConfig silentLogs(boolean value); // Disables ALL logging (except errors) + CommandAPIPaperConfig dispatcherFile(File file); // If not null, the CommandAPI will create a JSON file with Brigadier's command tree + CommandAPIPaperConfig setNamespace(String namespace); // The namespace to use when the CommandAPI registers a command + + // General CommandAPI configuration for Bukkit-based servers + CommandAPIPaperConfig fallbackToLatestNMS(boolean fallbackToLatestNMS); // Whether the CommandAPI should fall back to the latest NMS version if no implementation for the current version was found + CommandAPIPaperConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing + CommandAPIPaperConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info } ``` -::: - -
In order to create a `CommandAPIPaperConfig` object, you must give it a reference to your `PluginMeta` and a `LifecycleEventOwner` instance, meaning either a `JavaPlugin` or `BootstrapContext` instance. The CommandAPI always uses this to register events, so it is required when loading the CommandAPI on Paper. @@ -89,6 +71,29 @@ For example, to load the CommandAPI on Paper with all logging disabled, you can
+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 Spigot server, you should use the `CommandAPISpigotConfig` class. + +```java +public class CommandAPISpigotConfig { + // Create a new config object + CommandAPISpigotConfig(JavaPlugin plugin); + + // General CommandAPI configuration + CommandAPISpigotConfig verboseOutput(boolean value); // Enables verbose logging + CommandAPISpigotConfig silentLogs(boolean value); // Disables ALL logging (except errors) + CommandAPISpigotConfig dispatcherFile(File file); // If not null, the CommandAPI will create a JSON file with Brigadier's command tree + CommandAPISpigotConfig setNamespace(String namespace); // The namespace to use when the CommandAPI registers a command + + // General CommandAPI configuration for Bukkit-based servers + CommandAPISpigotConfig fallbackToLatestNMS(boolean fallbackToLatestNMS); // Whether the CommandAPI should fall back to the latest NMS version if no implementation for the current version was found + CommandAPISpigotConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing + CommandAPISpigotConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info + + // Spigot-specific configuration + CommandAPISpigotConfig skipReloadDatapacks(boolean skip); // Whether the CommandAPI should reload datapacks on server load +} +``` + In order to create 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 Spigot. For example, to load the CommandAPI on Spigot with all logging disabled, you can use the following: @@ -102,6 +107,8 @@ For example, to load the CommandAPI on Spigot with all logging disabled, you can
+ + ### Enabling & Disabling The `onEnable()` method initializes the CommandAPI's enabling sequence. Similar to the `onLoad(CommandAPIConfig)` method, this must be placed in your plugin's `onEnable()` method. This isn't as strict as the `onLoad(CommandAPIConfig)` method, and can be placed anywhere in your `onEnable()` method. diff --git a/docs/en/internal/internal.md b/docs/en/internal/internal.md index 1b8ca7d8..a97d7867 100644 --- a/docs/en/internal/internal.md +++ b/docs/en/internal/internal.md @@ -33,10 +33,10 @@ The CommandAPI's arguments are representations of the different arguments that t | `minecraft:entity` | [`EntitySelectorArgument`](../create-commands/arguments/types/entities-arguments#entity-selector-argument) | | `minecraft:entity_anchor` | | | `minecraft:entity_summon` | [`EntityTypeArgument`](../create-commands/arguments/types/entities-arguments#entity-type-argument) | -| `minecraft:float_range` | [`FloatRangeArgument`](../create-commands/arguments/types/ranged-arguments#the-integerrange--floatrange-class) | +| `minecraft:float_range` | [`DoubleRangeArgument`](../create-commands/arguments/types/ranged-arguments#the-integer-range-and-double-range-class) | | `minecraft:function` | [`FunctionArgument`](../create-commands/functions-and-tags/function-arguments) | | `minecraft:game_profile` | [`PlayerProfileArgument`](../create-commands/arguments/types/entities-arguments#playerprofile-argument) | -| `minecraft:int_range` | [`IntegerRangeArgument`](../create-commands/arguments/types/ranged-arguments#the-integerrange--doublerange-class) | +| `minecraft:int_range` | [`IntegerRangeArgument`](../create-commands/arguments/types/ranged-arguments#the-integer-range-and-double-range-class) | | `minecraft:item_enchantment` | [`EnchantmentArgument`](../create-commands/arguments/types/misc/enchantment-arguments) | | `minecraft:item_predicate` | [`ItemStackPredicateArgument`](../create-commands/arguments/types/predicate/itemstack-predicate-arguments) | | `minecraft:item_slot` | | diff --git a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md index 1fd74134..a30a9e43 100644 --- a/docs/en/upgrading-parts/10.1.2-to-11.0.0.md +++ b/docs/en/upgrading-parts/10.1.2-to-11.0.0.md @@ -46,7 +46,7 @@ On Paper, Adventure components are used while Spigot uses BungeeCord components. **More argument changes have been made:** - The `FloatRangeArgument` has been renamed to `DoubleRangeArgument` and now returns a `DoubleRange` object -- The `PlayerArgument` and `OfflinePlayerArgument` have been replaced by the `PlayerProfileArgument` which returns a `List<PlayerProfile>`. The `PlayerProfile` class changes depending on if you are on Paper or on Spigot. Use the `EntitySelectorArgument.OnePlayer` if you want a `Player` object. +- The `PlayerArgument` and `OfflinePlayerArgument` have been replaced by the `PlayerProfileArgument` which returns a `List`. The `PlayerProfile` class changes depending on if you are on Paper or on Spigot. Use the `EntitySelectorArgument.OnePlayer` if you want a `Player` object. - The `AsyncOfflinePlayerArgument` has been replaced by the `AsyncPlayerProfileArgument` - The `ChatArgument`, `ChatComponentArgument` and `ChatColorArgument` do no longer have any `Adventure` prefixes and return different types depending on the platform. - The `ChatArgument` returns a `SignedMessage` object on Paper diff --git a/update.sh b/update.sh index 4ccccafd..386c5da8 100644 --- a/update.sh +++ b/update.sh @@ -5,7 +5,7 @@ echo "New version:" read -r newVer # Update CommandAPI dependency versions -sed -i "s/commandApiVersion=\"$oldVer\"/commandApiVersion\"$newVer\"/" reference-code/gradle.properties +sed -i "s/commandApiVersion=$oldVer/commandApiVersion$newVer/" reference-code/gradle.properties # Update CommandAPI version in documentation files (Maven) sed -i "s/$oldVer<\/version>/$newVer<\/version>/" docs/en/dev-setup/annotations.md From d48945f2b5c32f00534c3351b93a6b3cb150b7d3 Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Wed, 24 Sep 2025 17:39:31 +0200 Subject: [PATCH 24/33] Update functions.md Also might include a fix for the diff language not being detected correctly --- docs/.vitepress/config.mts | 5 --- .../functions-and-tags/functions.md | 40 ++++++++++++++++--- .../functionsandtags/Functions.java | 25 ++++++++++++ .../functionsandtags/Functions.kt | 23 +++++++++++ .../functionsandtags/Functions.java | 7 ---- .../functionsandtags/Functions.kt | 6 --- 6 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 reference-code/paper/src/main/java/createcommands/functionsandtags/Functions.java create mode 100644 reference-code/paper/src/main/kotlin/createcommands/functionsandtags/Functions.kt rename reference-code/{bukkit => spigot}/src/main/java/createcommands/functionsandtags/Functions.java (76%) rename reference-code/{bukkit => spigot}/src/main/kotlin/createcommands/functionsandtags/Functions.kt (79%) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index b54e7fe5..147758e7 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -113,11 +113,6 @@ const vitepressOptions: UserConfig = { }] }).then(_ => { }) - shiki.loadLanguage({ - name: 'diff', - scopeName: 'source.diff' - }).then(_ => { - }) }, config: ( md) => { tabsPlugin(md); diff --git a/docs/en/create-commands/functions-and-tags/functions.md b/docs/en/create-commands/functions-and-tags/functions.md index 1901db22..b560f177 100644 --- a/docs/en/create-commands/functions-and-tags/functions.md +++ b/docs/en/create-commands/functions-and-tags/functions.md @@ -1,5 +1,6 @@ --- order: 1 +preferences: ["paper-spigot"] authors: - DerEchtePilz - willkroboth @@ -17,29 +18,58 @@ The CommandAPI has support to use Minecraft's [functions](https://minecraft.wiki Minecraft 1.16+ changes the way that datapacks are loaded on the server, so that they load before plugins are enabled. This means that non-vanilla commands that are declared in functions and tags will be detected as invalid, causing the server to throw a lot of errors at the very start. +
+ +To make commands available in datapacks, they have to be registered at the right place. More on that later. + +
+
+ The CommandAPI reloads datapacks once the server has finished loading using all declared commands, therefore **the error messages at the start of the server can be ignored**. +
+ ::: ## Using custom commands in functions -In order to use a command from your plugin in a `.mcfunction` file, you must register your command in your plugin's `onLoad()` method, instead of the `onEnable()` method. Failure to do so will not allow the command to be registered for Minecraft functions, causing the function file to fail to load during the server startup phase. +
+ +In order to use a command from your plugin in a `.mcfunction` file, you must register your command in your plugin's `bootstrap(BootstrapContext)` method, instead of the `onLoad()`/`onEnable()` method. Failure to do so will not allow the command to be registered for Minecraft functions, causing the function file to fail to load during the server startup phase. :::info -In short, if you want to register a command which can be used in Minecraft functions, register it in your plugin's `onLoad()` method. +In short, if you want to register a command which can be used in Minecraft functions, register it in your plugin's `bootstrap(BootstrapContext)` method. ::: +
+ ::::tip Example – Registering command for use in a function -Say we have a command `/killall` that simply kills all entities in all worlds on the server. If we were to register this in our `onLoad()` method, this would allow us to use the `/killall` command in Minecraft functions and tags. +
+ +Say we have a command `/killall` that simply kills all entities in all worlds on the server. To make it available in a function, we want to register the command in the `bootstrap(BootstrapContext)` method. :::tabs ===Java -<<< @/../reference-code/bukkit/src/main/java/createcommands/functionsandtags/Functions.java#functionsExample +<<< @/../reference-code/paper/src/main/java/createcommands/functionsandtags/Functions.java#functionsExample ===Kotlin -<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/functionsandtags/Functions.kt#functionsExample +<<< @/../reference-code/paper/src/main/kotlin/createcommands/functionsandtags/Functions.kt#functionsExample ::: +
+
+ +Say we have a command `/killall` that simply kills all entities in all worlds on the server. It doesn't matter where we register to make the command available in a function, but we'll just use the `onLoad()` method here. + +:::tabs +===Java +<<< @/../reference-code/spigot/src/main/java/createcommands/functionsandtags/Functions.java#functionsExample +===Kotlin +<<< @/../reference-code/spigot/src/main/kotlin/createcommands/functionsandtags/Functions.kt#functionsExample +::: + +
+ :::: \ No newline at end of file diff --git a/reference-code/paper/src/main/java/createcommands/functionsandtags/Functions.java b/reference-code/paper/src/main/java/createcommands/functionsandtags/Functions.java new file mode 100644 index 00000000..f6f6ffc2 --- /dev/null +++ b/reference-code/paper/src/main/java/createcommands/functionsandtags/Functions.java @@ -0,0 +1,25 @@ +package createcommands.functionsandtags; + +import dev.jorel.commandapi.CommandAPICommand; +import io.papermc.paper.plugin.bootstrap.BootstrapContext; +import io.papermc.paper.plugin.bootstrap.PluginBootstrap; +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +class Functions { + // #region functionsExample + public class MainBoostrap implements PluginBootstrap { + @Override + public void bootstrap(BootstrapContext context) { + // Commands which will be used in Minecraft functions are registered here + + new CommandAPICommand("killall") + .executes((sender, args) -> { + // Kills all enemies in all worlds + Bukkit.getWorlds().forEach(w -> w.getLivingEntities().forEach(e -> e.setHealth(0))); + }) + .register(); + } + } + // #endregion functionsExample +} diff --git a/reference-code/paper/src/main/kotlin/createcommands/functionsandtags/Functions.kt b/reference-code/paper/src/main/kotlin/createcommands/functionsandtags/Functions.kt new file mode 100644 index 00000000..8d59c198 --- /dev/null +++ b/reference-code/paper/src/main/kotlin/createcommands/functionsandtags/Functions.kt @@ -0,0 +1,23 @@ +package createcommands.functionsandtags + +import dev.jorel.commandapi.CommandAPICommand +import dev.jorel.commandapi.executors.CommandExecutor +import io.papermc.paper.plugin.bootstrap.BootstrapContext +import io.papermc.paper.plugin.bootstrap.PluginBootstrap +import org.bukkit.Bukkit +import org.bukkit.plugin.java.JavaPlugin + +// #region functionsExample +class MainBootstrap : PluginBootstrap { + override fun bootstrap(context: BootstrapContext) { + // Commands which will be used in Minecraft functions are registered here + + CommandAPICommand("killall") + .executes(CommandExecutor { _, _ -> + // Kills all enemies in all worlds + Bukkit.getWorlds().forEach { world -> world.livingEntities.forEach { entity -> entity.health = 0.0 } } + }) + .register() + } +} +// #endregion functionsExample \ No newline at end of file diff --git a/reference-code/bukkit/src/main/java/createcommands/functionsandtags/Functions.java b/reference-code/spigot/src/main/java/createcommands/functionsandtags/Functions.java similarity index 76% rename from reference-code/bukkit/src/main/java/createcommands/functionsandtags/Functions.java rename to reference-code/spigot/src/main/java/createcommands/functionsandtags/Functions.java index 729f93e8..3adb1387 100644 --- a/reference-code/bukkit/src/main/java/createcommands/functionsandtags/Functions.java +++ b/reference-code/spigot/src/main/java/createcommands/functionsandtags/Functions.java @@ -9,8 +9,6 @@ class Functions { public class Main extends JavaPlugin { @Override public void onLoad() { - // Commands which will be used in Minecraft functions are registered here - new CommandAPICommand("killall") .executes((sender, args) -> { // Kills all enemies in all worlds @@ -18,11 +16,6 @@ public void onLoad() { }) .register(); } - - @Override - public void onEnable() { - // Register all other commands here - } } // #endregion functionsExample } diff --git a/reference-code/bukkit/src/main/kotlin/createcommands/functionsandtags/Functions.kt b/reference-code/spigot/src/main/kotlin/createcommands/functionsandtags/Functions.kt similarity index 79% rename from reference-code/bukkit/src/main/kotlin/createcommands/functionsandtags/Functions.kt rename to reference-code/spigot/src/main/kotlin/createcommands/functionsandtags/Functions.kt index 3265a0aa..5952cc0b 100644 --- a/reference-code/bukkit/src/main/kotlin/createcommands/functionsandtags/Functions.kt +++ b/reference-code/spigot/src/main/kotlin/createcommands/functionsandtags/Functions.kt @@ -8,8 +8,6 @@ import org.bukkit.plugin.java.JavaPlugin // #region functionsExample class Main : JavaPlugin() { override fun onLoad() { - // Commands which will be used in Minecraft functions are registered here - CommandAPICommand("killall") .executes(CommandExecutor { _, _ -> // Kills all enemies in all worlds @@ -17,9 +15,5 @@ class Main : JavaPlugin() { }) .register() } - - override fun onEnable() { - // Register all other commands here - } } // #endregion functionsExample \ No newline at end of file From 74043fafcdd6a4ed367d9c1f9bf9bc9105c3760c Mon Sep 17 00:00:00 2001 From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> Date: Wed, 24 Sep 2025 17:52:08 +0200 Subject: [PATCH 25/33] Update image for ranged arguments --- .../arguments/types/ranged-arguments.md | 2 +- docs/public/images/arguments/doublerange.png | Bin 0 -> 4178 bytes docs/public/images/arguments/floatrange.png | Bin 6227 -> 0 bytes 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 docs/public/images/arguments/doublerange.png delete mode 100644 docs/public/images/arguments/floatrange.png diff --git a/docs/en/create-commands/arguments/types/ranged-arguments.md b/docs/en/create-commands/arguments/types/ranged-arguments.md index 973b5594..537afbd5 100644 --- a/docs/en/create-commands/arguments/types/ranged-arguments.md +++ b/docs/en/create-commands/arguments/types/ranged-arguments.md @@ -8,7 +8,7 @@ authors: # Ranged arguments -![A float range argument command with the argument "0.5.3.5" entered](/images/arguments/floatrange.png) +![A float range argument command with the argument "0.5.3.5" entered](/images/arguments/doublerange.png) Ranged arguments allow players to provide a range between two numbers, all within a single argument. The CommandAPI provides two ranged arguments, `IntegerRangeArgument` for ranges with only integer values, and `DoubleRangeArgument` for ranged with potential floating point values. diff --git a/docs/public/images/arguments/doublerange.png b/docs/public/images/arguments/doublerange.png new file mode 100644 index 0000000000000000000000000000000000000000..64b86d10073278ddcb5cd2015cee17a788e55de6 GIT binary patch literal 4178 zcmY*ddpwi-AAg1tm86q8xt@yU7O7mCk#cFsayNur(p;0=$EZ#?E0XJen3G&`&uo?m z#oUTH?#*Q#p|BCPVJ`bU==b`a^T(cN-|t?}_xt|5zwgic^LdtV&D?mu@G)Tk0QMuU z7+3-T{{r~kW6y5zx;zDW4&ER^md2NWif+jna3J8Ne^nmGL#1p$Ca z^VSE_7VyFY01kXX80cGvIkQILG`S8N;8UoO?Hqu1)8)H#d`(7HGFji?!5%fSgJN0X z4|>!t-IBC-uso>>xg=mLY6(ATBn!T8C#;gn-Vej9UU8uix) zfxjD_KK`|nUVSJw|0xv)_>G3?7z|H)IH3~AUQj;7vpnh==}Yg0_-KSpBOW4RdbjIvQ=S%G48cTvQh$nUk;BSO^`iZ?!BnX3Rm}Q z>r@_(`twMN5U^`&^%glBm2L1n+u(Cj0>_eFo6+{zklR9e7f(NnSe&m1WT#B|Dx5^F zwQfa~?aZEta=_(&#f4%WS`U8`NjZ`IbSpG%62Z(z|Xw(Ft=(ernn#9CZgz7gc^5G@daH_bFa$aV|5y0Ezfl7w^!-dUM1MP zHQ4yxeyf+8%!{INJ*2SQ5KIy4Xj9^cg4`c_AF4m3KWa?@ zMdW_YuMG(CIK9hNbTC(H&xHJIm2rHEkH2UdzYR(faMcE9o$j4_avcN$04KL2xq1D_ zLSN!PWxVgh)}dnTDU>dkyX8!?ezrk-aCA6|KS1)>Fex4&1$cSUz?u}Z?>0t!u zjZZtXQ{&qdtAZnKuZaZ(5|ACi*DVVlP`WB_#8r}4h1{wtkmI@Q@qA4|7zChp@IW%` zm4Jn;OMld&ZaEcM2qvD&XJMeHdmDo7GHJC4e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AcJ21)DmPoQ&JmMr|T+~IQQ zFJ$kL6za=-u+yl#YDH_!GpJnjPC%B=t~^LxSTW*?$!&C6cA8rDxZ}kbYnvILZ7i|< zmb%guL(cT-i%FFqsAH?*?2P=%fWXlg1)IsBmz!sbv?pk31BBp~b2DK2D9`Rg9@HwX z*15^2ReWOme1ZA8(VY3HIAOJTcv1T-Y4wGi%}=0S#f@NYSX&~0ne+XqnNl!ltkR}Z z+&D;JB}`FPRQFk!Hs+;An9%XXSI2ng@e=wZF5@b*1ZMdXiXLulshh3<_Re|q zB{?_mP1Jg9Kz6*bb-D>kau86rLq z0TNJUT-5$|?{w~kd7P!*kG4QYZPX1# tYQqFu7kf_%G`X3~UxSFVM}Jx6#V6O;W0Wvl@P7aRVQ6kpamn@Ge*pl*Wf%Ye literal 0 HcmV?d00001 diff --git a/docs/public/images/arguments/floatrange.png b/docs/public/images/arguments/floatrange.png deleted file mode 100644 index b15ebbc92b10b066f2e432ae17a599b3030845c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6227 zcmZu#c|4R|{~n<%rR>xoiZNu*zD%Jo7#YjRu9WP1b`y`CEHNQ_jL9;V%AUx+q{&XQ zlZ-90H5z_5z0dQ$zt89SWA2&zoO7S+dtKN0p84J<`VKo0*X3QwelDyZxecp12%vb(8!69lSEp#N<{4cybZY2Nh&ff!nkKNOv= zuWW%vUawmwUTPi>Y`pAUT`n8iJ3jzPic5+sh|4NS%3qe0RFIZdkdWUsw&Vwa*c-Ie zZyNequ4Tc>`Md8%Za7(oXs&ui)6jy@lwnsSqoOV_UXrhrx)v6}s9H^Ha#d0%>;eVj z7%kJYq^1w5s+w&PV-!qLwrM`QhOXYaMm|P9-Z}p09i@Tc-KmM1`YHe7Perf|<)6d= zSm41fwfP&SDBV4sJhzv@J&9gAx4Bik(+03^pX2%}e|_Jya{E})IU4Ys{znfB9fXKG ztJP_{Fl!JAwV*rGHwM1M23EcH*HitaY$yw2NRRVbe0NtXj=`Xwh2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Q_ssGO*Kgjj&MB0{30&%PQe@cY1+tJXZ}tL;;tku;bB z0*OYRbmYrpg~Id2o*dlm;G(=R!^YuoBJa@b4_b{UMuN@cYxAE(Il@4xt>T_kuK~&o zICk)9Pj29Wr}C#SH!q5RJXs$_Hzlw{K?81dG*w?eR?m1U@jKmJi#c+l&9^9Zw)NkV zPZcX~sL5F%8iY_OJ@{(9ITaFV8@ zm`i;sXC%w> Date: Wed, 24 Sep 2025 17:56:48 +0200 Subject: [PATCH 26/33] I forgot these --- docs/en/create-commands/arguments/arguments.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/create-commands/arguments/arguments.md b/docs/en/create-commands/arguments/arguments.md index 2a723ff3..bfe30889 100644 --- a/docs/en/create-commands/arguments/arguments.md +++ b/docs/en/create-commands/arguments/arguments.md @@ -91,7 +91,7 @@ The type to cast each argument (declared in the `dev.jorel.commandapi.arguments` | [`CommandArgument`](./types/command-arguments) | `dev.jorel.commandapi.wrappers.CommandResult` | | [`CustomArgument`](./types/custom-arguments) | `T` | | [`DoubleArgument`](./types/primitive-arguments#numerical-arguments) | `double` | -| [`DoubleRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.DoubleRange` | +| [`DoubleRangeArgument`](./types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.DoubleRange` | | [`EnchantmentArgument`](./types/misc/enchantment-arguments) | `org.bukkit.enchantments.Enchantment` | | [`EntitySelectorArgument.ManyEntities`](./types/entities-arguments#entity-selector-argument) | `Collection` | | [`EntitySelectorArgument.ManyPlayers`](./types/entities-arguments#entity-selector-argument) | `Collection` | @@ -102,7 +102,7 @@ The type to cast each argument (declared in the `dev.jorel.commandapi.arguments` | [`FunctionArgument`](../functions-and-tags/function-arguments) | `dev.jorel.commandapi.wrappers.FunctionWrapper[]` | | [`GreedyStringArgument`](./types/string-arguments#greedy-string-argument) | `String` | | [`IntegerArgument`](./types/primitive-arguments#numerical-arguments) | `int` | -| [`IntegerRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | +| [`IntegerRangeArgument`](./types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | | [`ItemStackArgument`](./types/misc/itemstack-arguments) | `org.bukkit.inventory.ItemStack` | | [`ItemStackPredicateArgument`](./types/predicate/itemstack-predicate-arguments) | `java.util.function.Predicate`
 `` | | [`ListArgument`](./types/list-arguments) | `java.util.Collection` | @@ -155,7 +155,7 @@ The type to cast each argument (declared in the `dev.jorel.commandapi.arguments` | [`CommandArgument`](./types/command-arguments) | `dev.jorel.commandapi.wrappers.CommandResult` | | [`CustomArgument`](./types/custom-arguments) | `T` | | [`DoubleArgument`](./types/primitive-arguments#numerical-arguments) | `double` | -| [`DoubleRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.DoubleRange` | +| [`DoubleRangeArgument`](./types/ranged-arguments#the-integer-range-and-float-range-class) | `dev.jorel.commandapi.wrappers.DoubleRange` | | [`EnchantmentArgument`](./types/misc/enchantment-arguments) | `org.bukkit.enchantments.Enchantment` | | [`EntitySelectorArgument.ManyEntities`](./types/entities-arguments#entity-selector-argument) | `Collection` | | [`EntitySelectorArgument.ManyPlayers`](./types/entities-arguments#entity-selector-argument) | `Collection` | @@ -166,7 +166,7 @@ The type to cast each argument (declared in the `dev.jorel.commandapi.arguments` | [`FunctionArgument`](../functions-and-tags/function-arguments) | `dev.jorel.commandapi.wrappers.FunctionWrapper[]` | | [`GreedyStringArgument`](./types/string-arguments#greedy-string-argument) | `String` | | [`IntegerArgument`](./types/primitive-arguments#numerical-arguments) | `int` | -| [`IntegerRangeArgument`](./types/ranged-arguments#the-integerrange--floatrange-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | +| [`IntegerRangeArgument`](./types/ranged-arguments#the-integer-range-and-double-range-class) | `dev.jorel.commandapi.wrappers.IntegerRange` | | [`ItemStackArgument`](./types/misc/itemstack-arguments) | `org.bukkit.inventory.ItemStack` | | [`ItemStackPredicateArgument`](./types/predicate/itemstack-predicate-arguments) | `java.util.function.Predicate`
 `` | | [`ListArgument`](./types/list-arguments) | `java.util.Collection` | From 7e50b542c49c7e8ca6edf7fe34d1dcbbbc408b4e Mon Sep 17 00:00:00 2001 From: willkroboth <46540330+willkroboth@users.noreply.github.com> Date: Sun, 7 Sep 2025 11:10:30 -0400 Subject: [PATCH 27/33] Mention spigot vs paper test toolkit TODO: load-mock-commandapi page --- README.md | 6 + .../theme/preference/PreferenceSwitch.vue | 79 +++++----- .../.vitepress/theme/preference/preference.ts | 8 +- docs/en/test/intro.md | 2 +- docs/en/test/setup.md | 148 +++++++++++++++--- docs/en/test/utils.md | 2 +- 6 files changed, 179 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index fddb14bb..f5d70f07 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,12 @@ yarn install yarn docs:build ``` +### View website changes locally + +```bash +yarn docs:dev +``` + ### Verify reference code ```bash diff --git a/docs/.vitepress/theme/preference/PreferenceSwitch.vue b/docs/.vitepress/theme/preference/PreferenceSwitch.vue index f95fbd1b..976ac733 100644 --- a/docs/.vitepress/theme/preference/PreferenceSwitch.vue +++ b/docs/.vitepress/theme/preference/PreferenceSwitch.vue @@ -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 = ref(); @@ -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, @@ -48,12 +59,6 @@ const toggleGradleDsl = useToggleFn( 'prefer-groovy' ); -const toggleMapping = useToggleFn( - preferReobfKey, - preferReobf, - 'prefer-reobf' -) - function useToggleFn( storageKey: string, state: Ref, @@ -77,9 +82,9 @@ function useToggleFn( refresh() onMounted(() => { + togglePaper(preferPaper.value); toggleMaven(preferMaven.value); toggleGradleDsl(preferGroovyInGradle.value); - toggleMapping(preferReobf.value); }); @@ -102,6 +107,16 @@ onMounted(() => { :aria-hidden="!openPreference" >
+
+ + + +
{ />
-
- - - -

@@ -270,57 +275,61 @@ onMounted(() => {