diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index d0ad3708a..b54e7fe56 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/.vitepress/theme/upgrading/upgrading.ts b/docs/.vitepress/theme/upgrading/upgrading.ts index 7cfbc9ec4..43f38f886 100644 --- a/docs/.vitepress/theme/upgrading/upgrading.ts +++ b/docs/.vitepress/theme/upgrading/upgrading.ts @@ -18,6 +18,7 @@ export const upgradingInfos: UpgradingInfo[] = [ {from: '9.0.1', to: '9.0.2'}, {from: '9.0.3', to: '9.1.0'}, {from: '9.2.0', to: '9.3.0'}, + {from: '9.7.1', to: '10.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 ebdf46940..419a7cb79 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 6b38e1977..15ccea2c3 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 3cbb98e20..a96aab5b2 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 9.7.0 provided ``` +===Spigot + ```xml + + + dev.jorel + commandapi-spigot-core + 9.7.0 + 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:9.7.0" + compileOnly "dev.jorel:commandapi-paper-core:9.7.0" } ``` + ===Spigot + ```groovy + dependencies { + compileOnly "dev.jorel:commandapi-spigot-core:9.7.0" + } + ``` + :::
+ :::tabs + ===Paper ```kotlin dependencies { - compileOnly("dev.jorel:commandapi-bukkit-core:9.7.0") + compileOnly("dev.jorel:commandapi-paper-core:9.7.0") } ``` - + ===Spigot + ```kotlin + dependencies { + compileOnly("dev.jorel:commandapi-spigot-core:9.7.0") + } + ``` + :::
diff --git a/docs/en/dev-setup/shading.md b/docs/en/dev-setup/shading.md index 6266baa18..f7bd08dfb 100644 --- a/docs/en/dev-setup/shading.md +++ b/docs/en/dev-setup/shading.md @@ -50,20 +50,36 @@ public class CommandAPIConfig { 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 { +public abstract class CommandAPIBukkitConfig extends CommandAPIConfig { CommandAPIBukkitConfig(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 } ``` +===Paper +```java +public class CommandAPIPaperConfig extends CommandAPIBukkitConfig { + CommandAPIPaperConfig(JavaPlugin plugin); + + CommandAPIPaperConfig shouldHookPaperReload(boolean hooked); // Whether the CommandAPI should hook into the Paper-exclusive ServerResourcesReloadedEvent +} +``` +===Spigot +```java +public class CommandAPISpigotConfig extends CommandAPIBukkitConfig { + CommandAPISpigotConfig(JavaPlugin plugin); +} +``` +::: -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: @@ -109,27 +125,55 @@ Add the CommandAPI shade dependency:
+:::tabs +===Paper ```xml dev.jorel - commandapi-bukkit-shade + commandapi-paper-shade 9.7.0 ``` +===Spigot +```xml + + + dev.jorel + commandapi-spigot-shade + 9.7.0 + + +``` +::: +
+:::tabs +===Paper +```xml + + + dev.jorel + commandapi-paper-shade-mojang-mapped + 9.7.0 + + +``` +===Spigot ```xml dev.jorel - commandapi-bukkit-shade-mojang-mapped + commandapi-spigot-shade-mojang-mapped 9.7.0 ``` +::: +
You can shade the CommandAPI easily by adding the `maven-shade-plugin` to your build sequence: @@ -220,37 +264,77 @@ Next, we declare our dependencies:
+:::tabs +===Paper +```groovy +dependencies { + implementation "dev.jorel:commandapi-paper-shade:9.7.0" +} +``` +===Spigot ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-shade:9.7.0" + implementation "dev.jorel:commandapi-spigot-shade:9.7.0" } ``` +::: +
+:::tabs +===Paper ```groovy dependencies { - implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0" + implementation "dev.jorel:commandapi-paper-shade-mojang-mapped:9.7.0" } ``` +===Spigot +```groovy +dependencies { + implementation "dev.jorel:commandapi-spigot-shade-mojang-mapped:9.7.0" +} +``` +::: +
+:::tabs +===Paper ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-shade:9.7.0") + implementation("dev.jorel:commandapi-paper-shade:9.7.0") } ``` +===Spigot +```kotlin +dependencies { + implementation("dev.jorel:commandapi-spigot-shade:9.7.0") +} +``` +::: +
+:::tabs +===Paper ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0") + implementation("dev.jorel:commandapi-paper-shade-mojang-mapped:9.7.0") } ``` +===Spigot +```kotlin +dependencies { + implementation("dev.jorel:commandapi-spigot-shade-mojang-mapped:9.7.0") +} +``` +::: +
diff --git a/docs/en/kotlin-dsl/intro.md b/docs/en/kotlin-dsl/intro.md index fef7ea7d5..4fc6314d4 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 9.7.0 ``` +===Spigot +```xml + + + dev.jorel + commandapi-kotlin-spigot + 9.7.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:9.7.0" + implementation "dev.jorel:commandapi-kotlin-paper:9.7.0" } ``` +===Spigot +```groovy +dependencies { + implementation "dev.jorel:commandapi-kotlin-spigot:9.7.0" +} +``` +:::
+:::tabs +===Paper +```kotlin +dependencies { + implementation("dev.jorel:commandapi-kotlin-paper:9.7.0") +} +``` +===Spigot ```kotlin dependencies { - implementation("dev.jorel:commandapi-bukkit-kotlin:9.7.0") + implementation("dev.jorel:commandapi-kotlin-spigot:9.7.0") } ``` +:::
diff --git a/docs/en/upgrading-parts/9.7.1-to-10.0.0.md b/docs/en/upgrading-parts/9.7.1-to-10.0.0.md new file mode 100644 index 000000000..f3da2b6f4 --- /dev/null +++ b/docs/en/upgrading-parts/9.7.1-to-10.0.0.md @@ -0,0 +1,44 @@ +### CommandAPI restructure + +#### General module changes + +For 10.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`. + +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 +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. + +::: + +#### 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. \ No newline at end of file diff --git a/docs/en/user-setup/config.md b/docs/en/user-setup/config.md index d14e7fd1f..29fc830be 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