diff --git a/docs/paper/dev/api/command-api/arguments/entity-player.mdx b/docs/paper/dev/api/command-api/arguments/entity-player.mdx index 021e1cc0..d4621e41 100755 --- a/docs/paper/dev/api/command-api/arguments/entity-player.mdx +++ b/docs/paper/dev/api/command-api/arguments/entity-player.mdx @@ -3,12 +3,12 @@ slug: /dev/command-api/arguments/entity-player description: Player and Entity arguments documentation. --- -import EntityOppedMp4 from "./assets/vanilla-arguments/entity-opped.mp4" -import EntityUnoppedMp4 from "./assets/vanilla-arguments/entity-unopped.mp4" -import EntitiesMp4 from "./assets/vanilla-arguments/entities.mp4" -import PlayerMp4 from "./assets/vanilla-arguments/player.mp4" -import PlayersMp4 from "./assets/vanilla-arguments/players.mp4" -import PlayerProfilesMp4 from "./assets/vanilla-arguments/playerprofiles.mp4" +import EntityOppedMp4 from "./assets/vanilla-arguments/entity-opped.mp4"; +import EntityUnoppedMp4 from "./assets/vanilla-arguments/entity-unopped.mp4"; +import EntitiesMp4 from "./assets/vanilla-arguments/entities.mp4"; +import PlayerMp4 from "./assets/vanilla-arguments/player.mp4"; +import PlayersMp4 from "./assets/vanilla-arguments/players.mp4"; +import PlayerProfilesMp4 from "./assets/vanilla-arguments/playerprofiles.mp4"; # Entity and Player Arguments The arguments described in this section relate to arguments which you can use to retrieve entities. Their main usage is the selection of command targets. @@ -108,7 +108,7 @@ public static LiteralCommandNode playerArgument() { ## Players argument The "multiple players" argument works similarly to the "single player" argument, also returning a `PlayerSelectorArgumentResolver`. Instead of just resolving to exactly one `Player`, this -one can resolve to more than just one player - which you should account for in case of using this argument. `PlayerSelectorArgumentResolver.resolve#(ctx.getSource())` returns a +one can resolve to more than just one player - which you should account for in case of using this argument. `PlayerSelectorArgumentResolver.resolve(ctx.getSource())` returns a `List`, which you can just iterate through. ### Example usage diff --git a/docs/paper/dev/api/command-api/arguments/enums.mdx b/docs/paper/dev/api/command-api/arguments/enums.mdx index 173d22b8..0cd0d295 100755 --- a/docs/paper/dev/api/command-api/arguments/enums.mdx +++ b/docs/paper/dev/api/command-api/arguments/enums.mdx @@ -1,14 +1,14 @@ --- slug: /dev/command-api/arguments/enums -description: Documentation for EntityAnchor, GameMode, and similar enum value arguments. +description: Documentation for EntityAnchor, GameMode and similar enum value arguments. --- -import EntityAnchorMp4 from "./assets/vanilla-arguments/entityanchor.mp4" -import GameModeMp4 from "./assets/vanilla-arguments/gamemode.mp4" -import HeightMapMp4 from "./assets/vanilla-arguments/heightmap.mp4" -import ScoreboardDisplaySlotMp4 from "./assets/vanilla-arguments/scoreboarddisplayslot.mp4" -import TemplateMirrorMp4 from "./assets/vanilla-arguments/templatemirror.mp4" -import TemplateRotationMp4 from "./assets/vanilla-arguments/templaterotation.mp4" +import EntityAnchorMp4 from "./assets/vanilla-arguments/entityanchor.mp4"; +import GameModeMp4 from "./assets/vanilla-arguments/gamemode.mp4"; +import HeightMapMp4 from "./assets/vanilla-arguments/heightmap.mp4"; +import ScoreboardDisplaySlotMp4 from "./assets/vanilla-arguments/scoreboarddisplayslot.mp4"; +import TemplateMirrorMp4 from "./assets/vanilla-arguments/templatemirror.mp4"; +import TemplateRotationMp4 from "./assets/vanilla-arguments/templaterotation.mp4"; # Enum Value Arguments @@ -39,7 +39,7 @@ public static LiteralCommandNode entityAnchorArgument() { ## GameMode argument -The game mode argument works the same way as the first argument of the vanilla `/gamemode ` command. It accepts any of the 4 valid game modes, returning +The game mode argument works the same way as the first argument of the Vanilla `/gamemode ` command. It accepts any of the 4 valid game modes, returning a `GameMode` enum to use in code. ### Example usage diff --git a/docs/paper/dev/api/command-api/arguments/location.mdx b/docs/paper/dev/api/command-api/arguments/location.mdx index ff124e9f..72633b2c 100755 --- a/docs/paper/dev/api/command-api/arguments/location.mdx +++ b/docs/paper/dev/api/command-api/arguments/location.mdx @@ -1,17 +1,17 @@ --- slug: /dev/command-api/arguments/location -description: Block position, fine position, and world argument documentation. +description: BlockPosition, FinePosition and World argument documentation. --- -import BlockPositionMp4 from "./assets/vanilla-arguments/blockposition.mp4" -import FinePositionMp4 from "./assets/vanilla-arguments/fineposition.mp4" -import WorldMp4 from "./assets/vanilla-arguments/world.mp4" +import BlockPositionMp4 from "./assets/vanilla-arguments/blockposition.mp4"; +import FinePositionMp4 from "./assets/vanilla-arguments/fineposition.mp4"; +import WorldMp4 from "./assets/vanilla-arguments/world.mp4"; # Location Arguments ## Block position argument -The block position argument is used for retrieving the position of a block. It works the same way as the first argument of the `/setblock ` vanilla command. -In order to retrieve the BlockPosition variable from the +The block position argument is used for retrieving the position of a block. It works the same way as the first argument of the `/setblock ` Vanilla command. +In order to retrieve the `BlockPosition` variable from the `BlockPositionResolver`, we have to resolve it using the command source. ### Example usage diff --git a/docs/paper/dev/api/command-api/arguments/registry.mdx b/docs/paper/dev/api/command-api/arguments/registry.mdx index 5980d5bf..4de93857 100755 --- a/docs/paper/dev/api/command-api/arguments/registry.mdx +++ b/docs/paper/dev/api/command-api/arguments/registry.mdx @@ -3,32 +3,32 @@ slug: /dev/command-api/arguments/registry description: Documentation for arguments retrieving registry values. --- -import ResourceAttributes from "./assets/registry-arguments/resource-attributes.mp4" -import ResourceBannerPattern from "./assets/registry-arguments/resource-banner-pattern.mp4" -import ResourceBiome from "./assets/registry-arguments/resource-biome.mp4" -import ResourceBlock from "./assets/registry-arguments/resource-block.mp4" -import ResourceCatVariant from "./assets/registry-arguments/resource-cat-variant.mp4" -import ResourceDamageType from "./assets/registry-arguments/resource-damage-type.mp4" -import ResourceDataComponentType from "./assets/registry-arguments/resource-data-component-type.mp4" -import ResourceFluid from "./assets/registry-arguments/resource-fluid.mp4" -import ResourceFrogVariant from "./assets/registry-arguments/resource-frog-variant.mp4" -import ResourceGameEvent from "./assets/registry-arguments/resource-game-event.mp4" -import ResourceInstrument from "./assets/registry-arguments/resource-instrument.mp4" -import ResourceItem from "./assets/registry-arguments/resource-item.mp4" -import ResourceJukeboxSong from "./assets/registry-arguments/resource-jukebox-song.mp4" -import ResourceMapDecorationType from "./assets/registry-arguments/resource-map-decoration-type.mp4" -import ResourceMemoryModuleType from "./assets/registry-arguments/resource-memory-module-type.mp4" -import ResourceMenu from "./assets/registry-arguments/resource-menu.mp4" -import ResourceMobEffect from "./assets/registry-arguments/resource-mob-effect.mp4" -import ResourcePaintingVariant from "./assets/registry-arguments/resource-painting-variant.mp4" -import ResourceSoundEvent from "./assets/registry-arguments/resource-sound-event.mp4" -import ResourceStructureType from "./assets/registry-arguments/resource-structure-type.mp4" -import ResourceVillagerProfession from "./assets/registry-arguments/resource-villager-profession.mp4" -import ResourceVillagerType from "./assets/registry-arguments/resource-villager-type.mp4" -import ResourceWolfVariant from "./assets/registry-arguments/resource-wolf-variant.mp4" - -import ResourceKeyItem from "./assets/registry-arguments/resourcekey-item.mp4" -import EnchantsRegistry from "./assets/registry-arguments/enchants-registry.mp4" +import ResourceAttributes from "./assets/registry-arguments/resource-attributes.mp4"; +import ResourceBannerPattern from "./assets/registry-arguments/resource-banner-pattern.mp4"; +import ResourceBiome from "./assets/registry-arguments/resource-biome.mp4"; +import ResourceBlock from "./assets/registry-arguments/resource-block.mp4"; +import ResourceCatVariant from "./assets/registry-arguments/resource-cat-variant.mp4"; +import ResourceDamageType from "./assets/registry-arguments/resource-damage-type.mp4"; +import ResourceDataComponentType from "./assets/registry-arguments/resource-data-component-type.mp4"; +import ResourceFluid from "./assets/registry-arguments/resource-fluid.mp4"; +import ResourceFrogVariant from "./assets/registry-arguments/resource-frog-variant.mp4"; +import ResourceGameEvent from "./assets/registry-arguments/resource-game-event.mp4"; +import ResourceInstrument from "./assets/registry-arguments/resource-instrument.mp4"; +import ResourceItem from "./assets/registry-arguments/resource-item.mp4"; +import ResourceJukeboxSong from "./assets/registry-arguments/resource-jukebox-song.mp4"; +import ResourceMapDecorationType from "./assets/registry-arguments/resource-map-decoration-type.mp4"; +import ResourceMemoryModuleType from "./assets/registry-arguments/resource-memory-module-type.mp4"; +import ResourceMenu from "./assets/registry-arguments/resource-menu.mp4"; +import ResourceMobEffect from "./assets/registry-arguments/resource-mob-effect.mp4"; +import ResourcePaintingVariant from "./assets/registry-arguments/resource-painting-variant.mp4"; +import ResourceSoundEvent from "./assets/registry-arguments/resource-sound-event.mp4"; +import ResourceStructureType from "./assets/registry-arguments/resource-structure-type.mp4"; +import ResourceVillagerProfession from "./assets/registry-arguments/resource-villager-profession.mp4"; +import ResourceVillagerType from "./assets/registry-arguments/resource-villager-type.mp4"; +import ResourceWolfVariant from "./assets/registry-arguments/resource-wolf-variant.mp4"; + +import ResourceKeyItem from "./assets/registry-arguments/resourcekey-item.mp4"; +import EnchantsRegistry from "./assets/registry-arguments/enchants-registry.mp4"; # Registry Arguments Registries in Minecraft hold all sort of information - possible item materials, block materials, enchantments, potion effects, ... and more! @@ -42,7 +42,7 @@ Just like any other argument, you can get a `ArgumentType` reference to it us found below. They are accessed in a static context using the `RegistryKey` interface. Each entry in `RegistryKey` returns a `RegistryKey`. The `` generic parameter here describes the return type. This means that if we were to retrieve -`RegistryKeys.ITEM`, the return type would be an `ItemType`, since it is defined as follows: +`RegistryKey.ITEM`, the return type would be an `ItemType`, since it is defined as follows: ```java title="RegistryKey.class" public sealed interface RegistryKey extends Keyed permits RegistryKeyImpl { @@ -106,13 +106,13 @@ Due to this fact, it is advised to only use the `STRUCTURE` registry key argumen For the client, there is barely any difference between the using `ArgumentTypes.resource` or `ArgumentTypes.resourceKey`. The only difference is that using `ArgumentTypes.resourceKey` does not provide **error checking**. We can visualize this using `RegistryKey.ITEM`. -Here is the tab completion for when using `ArgumentTypes.resource(RegistryKey.ITEM)`: +Here is the tab completion when using `ArgumentTypes.resource(RegistryKey.ITEM)`:
-And here is the tab completion for when using `ArgumenTypes.resourceKey(RegistryKey.ITEM)`: +And here is the tab completion when using `ArgumentTypes.resourceKey(RegistryKey.ITEM)`:
-The resource argument provides a much cleaner user experience, whilst the resourceKey argument has one very important usecase: You get the raw +The resource argument provides a much cleaner user experience, whilst the `resourceKey` argument has one very important usecase: You get the raw `TypedKey` returned as an argument result. This object is particularly useful, as it provides all information required to be able to retrieve a value from a registry yourself. diff --git a/docs/paper/dev/api/command-api/basics/arguments-and-literals.mdx b/docs/paper/dev/api/command-api/basics/arguments-and-literals.mdx index a0768369..5947ba18 100755 --- a/docs/paper/dev/api/command-api/basics/arguments-and-literals.mdx +++ b/docs/paper/dev/api/command-api/basics/arguments-and-literals.mdx @@ -1,12 +1,12 @@ --- slug: /dev/command-api/basics/arguments-and-literals -description: An extensive guide to commands arguments and literals. +description: An extensive guide to command arguments and literals. --- -import ValidFloatInput from "./assets/valid-float.png" -import SmallFloatInput from "./assets/small-float.png" -import BigFloatInput from "./assets/big-float.png" -import StringArguments from "./assets/string-arguments.gif" +import ValidFloatInput from "./assets/valid-float.png"; +import SmallFloatInput from "./assets/small-float.png"; +import BigFloatInput from "./assets/big-float.png"; +import StringArguments from "./assets/string-arguments.gif"; # Arguments and Literals @@ -45,7 +45,7 @@ Commands.literal("plant") :::tip You may notice the usage of the `executes` method. This method declares logic to our branches. If a branch has no `executes` method defined, it will not be executable. -For more information about execution logic, [click here](./executors) +For more information about execution logic, [click here](./executors). ::: diff --git a/docs/paper/dev/api/command-api/basics/command-tree.mdx b/docs/paper/dev/api/command-api/basics/command-tree.mdx index 160abbd1..97cb8fde 100755 --- a/docs/paper/dev/api/command-api/basics/command-tree.mdx +++ b/docs/paper/dev/api/command-api/basics/command-tree.mdx @@ -3,8 +3,8 @@ slug: /dev/command-api/basics/command-tree description: An extensive guide to building up a command tree. --- -import Tree from './assets/forest/tree.png' -import DescribedTree from './assets/forest/tree-descriptions.png' +import Tree from "./assets/forest/tree.png"; +import DescribedTree from "./assets/forest/tree-descriptions.png"; # Brigadier Command Trees What is a command tree and in what way does it have anything to do with Brigadier? If you are confused, this is the page for you! Here we will take an diff --git a/docs/paper/dev/api/command-api/basics/executors.mdx b/docs/paper/dev/api/command-api/basics/executors.mdx index b12397d3..9ee310ca 100755 --- a/docs/paper/dev/api/command-api/basics/executors.mdx +++ b/docs/paper/dev/api/command-api/basics/executors.mdx @@ -95,7 +95,7 @@ Note the highlighted lines. We first retrieve the `CommandSourceStack` from our A `CommandSender` is an interface, which declares the `sendMessage(...)`, `getServer()`, and `getName()` methods. It is implemented by all entities, including players, and the ConsoleCommandSender, which is used if a console executes a command. -Next up we check whether our executor object is also instance of a Player interface. If executor were null, this would be false, which is why we require no null check. +Next up we check whether our executor object is also instance of a `Player` interface. If executor were null, this would be false, which is why we require no null check. If the expression evaluates as true, we get a new `player` variable, which represents an actual player on the server that the command was executed by. Next up, we set the player's flight speed using the value retrieved from the player-provided float argument and send them a message to confirm the operation. diff --git a/docs/paper/dev/api/command-api/basics/registration.mdx b/docs/paper/dev/api/command-api/basics/registration.mdx index b94231d7..aa23587b 100755 --- a/docs/paper/dev/api/command-api/basics/registration.mdx +++ b/docs/paper/dev/api/command-api/basics/registration.mdx @@ -113,9 +113,9 @@ this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, comman ``` ### Registering a BasicCommand -A `BasicCommand` is a bukkit-like way of defining commands. Instead of building up a command tree, we allow all user input and retrieve the arguments as a simple array of Strings. -This type of commands is particularly useful for very simple, text based commands, like a `/broadcast` command. You can read up on more details about basic commands -[here](../misc/basic-command.mdx). +A `BasicCommand` is a Bukkit-like way of defining commands. Instead of building up a command tree, +we allow all user input and retrieve the arguments as a simple array of strings. This type of commands is particularly useful for very simple, text based commands, +like a `/broadcast` command. You can read up on more details about basic commands [here](../misc/basic-command.mdx). Assuming you already have your `BasicCommand` object, we can register it like this: diff --git a/docs/paper/dev/api/command-api/basics/requirements.mdx b/docs/paper/dev/api/command-api/basics/requirements.mdx index d6377d14..9f94fcdd 100644 --- a/docs/paper/dev/api/command-api/basics/requirements.mdx +++ b/docs/paper/dev/api/command-api/basics/requirements.mdx @@ -3,7 +3,7 @@ slug: /dev/command-api/basics/requirements description: A guide to setting requirements for commands. --- -import ClientServerMismatch from "./assets/client-server-mismatch.png" +import ClientServerMismatch from "./assets/client-server-mismatch.png"; # Command Requirements Sometimes you want to limit a player's ability to use and/or view certain commands or subcommands. Exactly for this purpose, diff --git a/docs/paper/dev/api/command-api/misc/basic-command.mdx b/docs/paper/dev/api/command-api/misc/basic-command.mdx index 95a235b4..7205905d 100644 --- a/docs/paper/dev/api/command-api/misc/basic-command.mdx +++ b/docs/paper/dev/api/command-api/misc/basic-command.mdx @@ -1,12 +1,12 @@ --- slug: /dev/command-api/misc/basic-command -description: Bukkit styled command declaration. +description: An overview of a Bukkit-style command declaration using Brigadier. --- -import BroadcastCommand from "./assets/broadcast-command.png" -import BroadcastSuggestionsFinished from "./assets/broadcast-suggestions-finished.png" -import BroadcastSuggestionsUnfinished from "./assets/broadcast-suggestions-unfinished.png" -import BroadcastSuggestionsNone from "./assets/broadcast-suggestions-none.png" +import BroadcastCommand from "./assets/broadcast-command.png"; +import BroadcastSuggestionsFinished from "./assets/broadcast-suggestions-finished.png"; +import BroadcastSuggestionsUnfinished from "./assets/broadcast-suggestions-unfinished.png"; +import BroadcastSuggestionsNone from "./assets/broadcast-suggestions-none.png"; # Basic Commands For very simple commands Paper has a way to declare Bukkit-style commands by implementing the `BasicCommand` interface. @@ -60,7 +60,7 @@ With the permission method you can, similar to the `canUse` method, set the perm ## Example: Broadcast command -As an example, we can create a simple broadcast command. We start by declaring creating a class which implements BasicCommand and overrides `execute` and `permission`: +As an example, we can create a simple broadcast command. We start by declaring creating a class which implements `BasicCommand` and overrides `execute` and `permission`: ```java package your.package.name; @@ -100,9 +100,8 @@ else { This makes sure that we cover all cases and even allow the command to work correctly with `/execute as`. -Next, we retrieve all arguments and join them to a String or tell the sender that at least one argument is required in order to send a broadcast - -if they defined no arguments (meaning that `args` has a length of 0): +Next, we retrieve all arguments and join them to a string or tell the sender that at least one argument is required in order to send a broadcast in case they defined no +arguments (meaning that `args` has a length of 0): ```java if (args.length == 0) { commandSourceStack.getSender().sendRichMessage("You cannot send an empty broadcast!"); diff --git a/docs/paper/dev/api/command-api/misc/comparison-bukkit-brigadier.mdx b/docs/paper/dev/api/command-api/misc/comparison-bukkit-brigadier.mdx index 3cd530b9..c431a5df 100755 --- a/docs/paper/dev/api/command-api/misc/comparison-bukkit-brigadier.mdx +++ b/docs/paper/dev/api/command-api/misc/comparison-bukkit-brigadier.mdx @@ -3,15 +3,15 @@ slug: /dev/command-api/misc/comparison-bukkit-brigadier description: A comparison between Brigadier and Bukkit commands. --- -import BukkitPartyCommandImage from './assets/bukkitparty-command.png' -import PaperPartyCommandImage from './assets/paperparty-command.png' +import BukkitPartyCommandImage from "./assets/bukkitparty-command.png"; +import PaperPartyCommandImage from "./assets/paperparty-command.png"; # Comparing Brigadier and Bukkit Commands ## Registering commands ### The old Bukkit way -In order to register Bukkit commands, you would define a class that extends BukkitCommand, and implements the execute(...) and tabComplete(...) +In order to register Bukkit commands, you would define a class that extends `BukkitCommand`, and implements the `execute(...)` and `tabComplete(...)` methods. This might look like this: ```java title="BukkitPartyCommand.java" public class BukkitPartyCommand extends BukkitCommand { @@ -58,7 +58,7 @@ this.getServer().getCommandMap().register( ``` As you can see, you have to do a lot of manual checking in order to register a single, very simple command. But how does -the Brigadier api do it? +the Brigadier API do it? ### The new Paper way First, we need to retrieve a `LiteralCommandNode`. That's a special Brigadier class that holds some sort of [command tree](../basics/command-tree). @@ -89,7 +89,7 @@ Each `.then(...)` defines a new branch in our tree, which can either be a litera (`Commands.argument(String, ArgumentType)`). Each branch may or may not define an `.executes(Command)` executor. This is where all the logic happens. -We will take a closer look at that in different pages, but for now, how do we register it? Paper uses a LifecycleEventManager system. +We will take a closer look at that in different pages, but for now, how do we register it? Paper uses a `LifecycleEventManager` system. In a nutshell, that is a way to register commands (or tags) that get loaded each time the server reloads its resources, like using /reload. Registering our command looks like this: ```java title="PluginClass.java"