Skip to content

Commit

Permalink
Resolve scorps review
Browse files Browse the repository at this point in the history
  • Loading branch information
Strokkur424 committed Jan 15, 2025
1 parent 0905958 commit 522f71c
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 78 deletions.
14 changes: 7 additions & 7 deletions docs/paper/dev/api/command-api/arguments/entity-player.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -108,7 +108,7 @@ public static LiteralCommandNode<CommandSourceStack> 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<Player>`, which you can just iterate through.

### Example usage
Expand Down
16 changes: 8 additions & 8 deletions docs/paper/dev/api/command-api/arguments/enums.mdx
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -39,7 +39,7 @@ public static LiteralCommandNode<CommandSourceStack> entityAnchorArgument() {


## GameMode argument
The game mode argument works the same way as the first argument of the vanilla `/gamemode <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 <gamemode>` command. It accepts any of the 4 valid game modes, returning
a <Javadoc name='org.bukkit.GameMode'>`GameMode`</Javadoc> enum to use in code.

### Example usage
Expand Down
12 changes: 6 additions & 6 deletions docs/paper/dev/api/command-api/arguments/location.mdx
Original file line number Diff line number Diff line change
@@ -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 <position> <block>` 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 <position> <block>` Vanilla command.
In order to retrieve the `BlockPosition` variable from the
<Javadoc name='io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver'>`BlockPositionResolver`</Javadoc>, we have to resolve it using the command source.

### Example usage
Expand Down
60 changes: 30 additions & 30 deletions docs/paper/dev/api/command-api/arguments/registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -42,7 +42,7 @@ Just like any other argument, you can get a `ArgumentType<T>` reference to it us
found below. They are accessed in a static context using the <Javadoc name='io.papermc.paper.registry.RegistryKey'>`RegistryKey`</Javadoc> interface.

Each entry in `RegistryKey` returns a `RegistryKey<T>`. The `<T>` generic parameter here describes the return type. This means that if we were to retrieve
<Javadoc name='io.papermc.paper.registry.RegistryKey#ITEM'>`RegistryKeys.ITEM`</Javadoc>, the return type would be an `ItemType`, since it is defined as follows:
<Javadoc name='io.papermc.paper.registry.RegistryKey#ITEM'>`RegistryKey.ITEM`</Javadoc>, the return type would be an `ItemType`, since it is defined as follows:

```java title="RegistryKey.class"
public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
Expand Down Expand Up @@ -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)`:
<FullWidthVideo src={ResourceItem}/><br/>

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)`:
<FullWidthVideo src={ResourceKeyItem}/><br/>

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

Expand Down
12 changes: 6 additions & 6 deletions docs/paper/dev/api/command-api/basics/arguments-and-literals.mdx
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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).

:::

Expand Down
4 changes: 2 additions & 2 deletions docs/paper/dev/api/command-api/basics/command-tree.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/paper/dev/api/command-api/basics/executors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docs/paper/dev/api/command-api/basics/registration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, comman
```

### Registering a BasicCommand
A <Javadoc name='io.papermc.paper.command.brigadier.BasicCommand'>`BasicCommand`</Javadoc> 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 <Javadoc name='io.papermc.paper.command.brigadier.BasicCommand'>`BasicCommand`</Javadoc> 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:

Expand Down
2 changes: 1 addition & 1 deletion docs/paper/dev/api/command-api/basics/requirements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 8 additions & 9 deletions docs/paper/dev/api/command-api/misc/basic-command.mdx
Original file line number Diff line number Diff line change
@@ -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 <Javadoc name='io.papermc.paper.command.brigadier.BasicCommand'>`BasicCommand`</Javadoc> interface.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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("<red>You cannot send an empty broadcast!");
Expand Down
Loading

0 comments on commit 522f71c

Please sign in to comment.