Skip to content

Commit 0980d39

Browse files
committed
Pre-final revision
1 parent 97cef6d commit 0980d39

15 files changed

+114
-155
lines changed

docs/paper/dev/api/command-api/arguments/adventure-arguments.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ import StyleMp4 from "./assets/vanilla-arguments/style.mp4"
1010
import SignedMessageMp4 from "./assets/vanilla-arguments/signedmessage.mp4"
1111

1212
# Adventure Library Arguments
13-
These arguments return a class from the `net.kyori` package. They are *technically* not native to Minecraft or Bukkit, but as Paper includes the Adventure library, they are
13+
These arguments return a class from the `net.kyori` package. They are technically not native to Minecraft or Bukkit, but as Paper includes the Adventure library, they are
1414
usually widely used in the Paper ecosystem.
1515

1616
## Component Argument
17-
The component argument is a very complicated command for the user, which is why it should not be used for usual user input. It follows the same format as the `/tellraw <player> <msg>`
18-
command for its second argument. It accepts a text component as its json representation, returning it as an Adventure component to work with.
17+
:::note
18+
19+
This argument is very technical. Following the same format as the `/tellraw <player> <component>` command for its second argument, it expects the json
20+
representation of a text component, making it inappropriate for general user input.
21+
22+
:::
23+
24+
The result is returned as an Adventure component to work with.
1925

2026
### Example usage
2127
```java
@@ -39,7 +45,6 @@ public static LiteralCommandNode<CommandSourceStack> componentArgument() {
3945
<FullWidthVideo src={ComponentMp4}/>
4046

4147

42-
4348
## Key Argument
4449
The key argument allows a user to put in any artificial (namespaced) key, ensuring its validity. This returns a `net.kyori.adventure.key.Key` from the adventure library,
4550
which can be used at various other places in the Bukkit/Paper API.
@@ -66,11 +71,9 @@ public static LiteralCommandNode<CommandSourceStack> keyArgument() {
6671
<FullWidthVideo src={KeyMp4}/>
6772

6873

69-
7074
## Named Color Argument
71-
This argument provides the user with the ability to select between the 16 build-in "named" text colors. This argument returns a `net.kyori.adventure.text.format.NamedTextColor` that
72-
73-
you can use for styling components.
75+
This argument provides the user with the ability to select between the 16 build-in "named" text colors. This argument returns a
76+
`net.kyori.adventure.text.format.NamedTextColor` which you can use for styling components.
7477

7578
### Example usage
7679
```java
@@ -95,18 +98,16 @@ public static LiteralCommandNode<CommandSourceStack> namedColorArgument() {
9598
<FullWidthVideo src={NamedColorMp4}/>
9699

97100

98-
99101
## Adventure Style Argument
100102
:::note
101103

102104
Similar to the component argument, this argument is not really appropriate for general user input, as it also follows the json format for displaying components. Most users
103-
do not know how to use that format and thus its public usage is not advised.
105+
do not know how to use that format and thus its general usage is not advised.
104106

105107
:::
106108

107109
The style argument returns its value in form of an `net.kyori.adventure.text.format.Style` object. This can be applied to any component using `Component#style(Style)`.
108-
109-
Whilst the json input allows for the `text` field, it does not actually do anything.
110+
Whilst the json input allows for the `text` field, its content is completely ignored.
110111

111112
### Example usage
112113
```java
@@ -131,9 +132,8 @@ public static LiteralCommandNode<CommandSourceStack> styleArgument() {
131132
<FullWidthVideo src={StyleMp4}/>
132133

133134

134-
135135
## Signed Message Argument
136-
The signed message argument allows a player (not a console!!) to send an argument in form of a **signed message** to the server. This signed message is a special type - it
136+
The signed message argument allows a player to send an argument in form of a **signed message** to the server. This signed message is a special type - it
137137
allows the server to send that message, without the ability to directly modify it, to any player. The visible difference is that unsigned messages have a white bar at the left,
138138
whilst signed messages don't.
139139

docs/paper/dev/api/command-api/arguments/bukkit-arguments.mdx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ The arguments described in this section return objects oftentime used in Bukkit
1515
non-bukkit object described here is the [UUID Argument](#uuid-argument).
1616

1717
## Block State Argument
18-
The block state argument is a very useful argument for getting use input on an exact block type and its data. It is particularly used for commands that modify blocks
19-
in some way, which requires precise input.
18+
The block state argument can be used for getting a block type and explicit, assosiated data.
2019

2120
### Example usage
2221
```java
@@ -37,9 +36,8 @@ public static LiteralCommandNode<CommandSourceStack> blockStateArgument() {
3736
<FullWidthVideo src={BlockStateMp4}/>
3837

3938

40-
4139
## ItemStack Argument
42-
The item stack argument is a way to retrieve an <Javadoc name={'org.bukkit.inventory.ItemStack'}>`ItemStack`</Javadoc> following the same argument format as the vanilla `/give <player> <item> [<amount>]`
40+
The item stack argument is the way to retrieve an <Javadoc name={'org.bukkit.inventory.ItemStack'}>`ItemStack`</Javadoc> following the same argument format as the vanilla `/give <player> <item> [<amount>]`
4341
command as its second argument. The user may also define components to further customize the `ItemStack`. If you only require a <Javadoc name={'org.bukkit.Material'}>`Material`</Javadoc>, you should instead
4442
check out the [registry arguments](./registry-arguments.mdx).
4543

@@ -72,10 +70,9 @@ public static LiteralCommandNode<CommandSourceStack> itemStackArgument() {
7270
<FullWidthVideo src={ItemStackMp4}/>
7371

7472

75-
7673
## Bukkit NamespacedKey Argument
77-
Similar to the **Key** argument, this argument allows the user to provide any artificial (namespaced) key. The difference is that the return value of this argument is instead a
78-
<Javadoc name={'org.bukkit.NamespacedKey'}>`NamespacedKey`</Javadoc>, which makes it particularly useful when dealing with Bukkit API.
74+
This argument allows the user to provide any artificial (namespaced) key. The return value of this argument is a
75+
<Javadoc name={'org.bukkit.NamespacedKey'}>`NamespacedKey`</Javadoc>, which makes it useful when dealing with Bukkit API.
7976

8077
### Example usage
8178
```java
@@ -98,7 +95,6 @@ public static LiteralCommandNode<CommandSourceStack> namespacedKeyArgument() {
9895
<FullWidthVideo src={NamespacedKeyMp4}/>
9996

10097

101-
10298
## Time Argument
10399
The time argument allows the user to define a time frame, similar to the vanilla `/time <set|time> <time>` time argument. The user has 4 possible ways of inputting time:
104100
* Just as a number: This resolves to as usual ticks (`/timearg 1` --> 1 tick)
@@ -137,7 +133,6 @@ public static LiteralCommandNode<CommandSourceStack> timeArgument() {
137133
<FullWidthVideo src={TimeMp4}/>
138134

139135

140-
141136
## UUID Argument
142137
The uuid argument allows the user to input a valid uuid. You can retrieve that value as a `UUID` object, which is used in various places, like `Bukkit.getOfflinePlayer(UUID)`.
143138
This argument is not very user-friendly, which is why it is suggested to only use this as a moderation or debug argument. For user input regarding offline player
@@ -167,10 +162,8 @@ public static LiteralCommandNode<CommandSourceStack> uuidArgument() {
167162
<FullWidthVideo src={UuidMp4}/>
168163

169164

170-
171165
## Objective Criteria Argument
172-
This argument has wide usage when dealing with scoreboard objectives and scores. You can retrieve the argument value as a `Criteria` enum value, which can be
173-
used with Scoreboard objects.
166+
You can retrieve the argument value as a `Criteria` enum value, which can be used with Scoreboard objects.
174167

175168
### Example usage
176169
```java

docs/paper/dev/api/command-api/arguments/entity-player-arguments.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ If the executing player is opped:
4646
<FullWidthVideo src={EntityOppedMp4}/>
4747

4848

49-
5049
## Entities Argument
5150
In contrast to the single entity argument, this multi entity argument accepts any amount of entities, with the minimum amount of entities being 1. They can, once again, be resolved using
5251
<Javadoc name="io.papermc.paper.command.brigadier.argument.resolvers.ArgumentResolver#resolve(io.papermc.paper.command.brigadier.CommandSourceStack)">`ArgumentResolver#resolve(CommandSourceStack)`</Javadoc>,
@@ -75,14 +74,14 @@ public static LiteralCommandNode<CommandSourceStack> entities() {
7574
<FullWidthVideo src={EntitiesMp4}/>
7675

7776

78-
7977
## Player Argument
80-
The player argument allows you to be given some player input. Running `ctx.getArgument` return a `PlayerSelectorArgumentResolver` for player arguments.
78+
The player argument allows to retrieve a `PlayerSelectorArgumentResolver` for player arguments.
8179
For this "single player" argument, you can safely get the target player by running `PlayerSelectorArgumentResolver.resolve(ctx.getSource()).getFirst()`,
82-
which returns a Bukkit <Javadoc name='org.bukkit.entity.Player'>`Player`</Javadoc> object.
80+
which returns a <Javadoc name='org.bukkit.entity.Player'>Player</Javadoc> object.
8381

8482
### Example usage
8583
This command yeets the targeted player into the air!
84+
8685
```java
8786
public static LiteralCommandNode<CommandSourceStack> playerArgument() {
8887
return Commands.literal("player")
@@ -107,14 +106,14 @@ public static LiteralCommandNode<CommandSourceStack> playerArgument() {
107106
<FullWidthVideo src={PlayerMp4}/>
108107

109108

110-
111109
## Players Argument
112-
The "multiple players" argument works similarly to the Player argument, also returning a `PlayerSelectorArgumentResolver`. Instead of just resolving to exactly one `Player`, this
110+
The "multiple players" argument works similarly to the "single player" argument, also returning a `PlayerSelectorArgumentResolver`. Instead of just resolving to exactly one `Player`, this
113111
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
114112
`List<Player>`, which you can just iterate through.
115113

116114
### Example usage
117-
Extending the "single player" yeet command to support multiple targets
115+
Extending the "single player" yeet command to support multiple targets can look like this:
116+
118117
```java
119118
public static LiteralCommandNode<CommandSourceStack> playersArgument() {
120119
return Commands.literal("players")
@@ -142,15 +141,16 @@ public static LiteralCommandNode<CommandSourceStack> playersArgument() {
142141
<FullWidthVideo src={PlayersMp4}/>
143142

144143

145-
146144
## Player Profiles Argument
147145
The player profiles argument is a very powerful argument which can retrieve both offline and online players. It returns the result of the argument as a `PlayerProfileListResolver`,
148146
which resolves to a `Collection<PlayerProfile>`. This collection can be iterated to get the resulting profile(s). Usually, it only returns a single `PlayerProfile` if retrieving
149147
a player by name, but it can return multiple if using the entity selectors (like `@a` on online players). Thus it always makes sense to run whatever operation you want to run on
150148
all entries in the collection instead of just the first one.
151149

152-
Sometimes, the API call to players, which are currently offline and have no yet logged onto the server, may fail. This is also visible in the in-game preview down below. This
153-
weird behavior also explains why the `/whitelist add` command sometimes fails.
150+
This argument will run API calls to Mojang servers in order to retrieve player information for players which have never joined the server before. Due to this operation sometimes
151+
taking a bit longer, it is suggested to resolve this argument in an asynchronous context in order to not cause any server lag.
152+
153+
Sometimes, theese API calls may fail. This is also visible in the in-game preview down below. This behavior is also the reason for `/whitelist add` sometimes.
154154

155155
### Example usage - Player lookup command
156156
```java

docs/paper/dev/api/command-api/arguments/enum-value-arguments.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import TemplateMirrorMp4 from "./assets/vanilla-arguments/templatemirror.mp4"
1111
import TemplateRotationMp4 from "./assets/vanilla-arguments/templaterotation.mp4"
1212

1313
# Enum Value Arguments
14-
These arguments return a value from an enum class.
1514

1615
## Entity Anchor Argument
1716
The entity anchor argument has two valid inputs: `feet` and `eyes`. The resulting <Javadoc name='io.papermc.paper.entity.LookAnchor'>`LookAnchor`</Javadoc> is mainly used for methods like
@@ -122,7 +121,7 @@ public static LiteralCommandNode<CommandSourceStack> scoreboardDisplaySlotArgume
122121

123122

124123
## Template Mirror Argument
125-
This argument is a very simple enum argument. The user has 3 valid input possibilities: `front_back`, `left_right`, and `none`. You can retrieve the result of
124+
Here, the user has 3 valid input possibilities: `front_back`, `left_right`, and `none`. You can retrieve the result of
126125
the argument as a <Javadoc name='org.bukkit.block.structure.Mirror'>`Mirror`</Javadoc> enum value.
127126

128127
### Example usage

docs/paper/dev/api/command-api/arguments/location-arguments.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import FinePositionMp4 from "./assets/vanilla-arguments/fineposition.mp4"
88
import WorldMp4 from "./assets/vanilla-arguments/world.mp4"
99

1010
# Location Arguments
11-
With the arguments described in this page, you can retrieve positional input from a user.
12-
1311

1412
## Block Position Argument
1513
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.
@@ -38,7 +36,7 @@ public static LiteralCommandNode<CommandSourceStack> blockPositionArgument() {
3836

3937
## Fine Position Argument
4038
The fine position argument works similarly to the block position argument, with the only difference being that it can accept decimal (precise) location input. The optional
41-
overload (`ArgumentTypes.finePosition(boolean centerIntegers)`), which defaults to false if not set, will center whole input, meaning 5 becomes 5.5 (5.0 would stay as 5.5 though),
39+
overload (`ArgumentTypes.finePosition(boolean centerIntegers)`), which defaults to false if not set, will center whole input, meaning 5 becomes 5.5 (5.0 would stay as 5.0 though),
4240
as that is the "middle" of a block. This only applies to X/Z. The y coordinate is untouched by this operation.
4341

4442
This argument returns a <Javadoc name='io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver'>`FinePositionResolver`</Javadoc>. You can resolve that by running `FinePositionResolver#resolve(CommandSourceStack)` to get the resulting

docs/paper/dev/api/command-api/arguments/minecraft-arguments.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toc_max_heading_level: 4
66
---
77

88
# Minecraft Arguments
9-
The [Arguments and Literals](../basics/arguments-and-literals) page covers the most used, native Brigadier arguments. But Minecraft (and Paper) defines a few more. These can be accessed
9+
The [Arguments and Literals](../basics/arguments-and-literals) page covers the most used, native Brigadier arguments. But Minecraft (and Paper) define a few more. These can be accessed
1010
in a static context using the <Javadoc name='io.papermc.paper.command.brigadier.argument.ArgumentTypes'>`ArgumentTypes`</Javadoc> class. We will go over all of those in this section.
1111

1212
## Quick overview

docs/paper/dev/api/command-api/arguments/predicate-arguments.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ A predicate allows for checking for valid values. These arguments are dedicated
1212

1313

1414
## Double Range argument
15-
With the double range argument you can define a double, or a range/amount of doubles, which can act as a predicate for numbers. This could be used for an
16-
argument which kill all enemies in a specific range or for clearing items in a range of slots. As this argument is rather technical, it is not used very often.
15+
This argument can be used as a predicate for numbers, which require precise input.
1716

1817
### Example usage
1918
```java
@@ -40,7 +39,6 @@ public static LiteralCommandNode<CommandSourceStack> doubleRange() {
4039
<FullWidthVideo src={DoubleRangeMp4}/>
4140

4241

43-
4442
## Integer Range Argument
4543
This argument works very similarly to the double range argument, with the only difference being that this argument only accepts integers.
4644

@@ -77,7 +75,6 @@ private static int runIntegerRangeCommand(final CommandContext<CommandSourceStac
7775
<FullWidthVideo src={IntegerRangeMp4}/>
7876

7977

80-
8178
## Item Predicate Argument
8279
This argument allows for checking whether an item fits some predicate. It is useful for filtering out certain items based on some criteria.
8380

docs/paper/dev/api/command-api/arguments/registry-arguments.mdx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ import EnchantsRegistry from "./assets/registry-arguments/enchants-registry.mp4"
3232

3333
# Registry Arguments
3434
Registries in Minecraft hold all sort of information - possible item materials, block materials, enchantments, potion effects, ... and more!
35-
These arguments are particularly useful for retrieving type values.
3635

37-
There are **two** types of registry arguments: `resource` and `resourceKey`.
36+
There are two types of registry arguments: `resource` and `resourceKey`.
3837
The main difference between those arguments is the return value: The `resource` argument returns the parsed value, whilst the `resourceKey` only returns a `TypedKey`, which
3938
you can use to retrieve the value yourself.
4039

41-
For more information on the `resourceKey` argument, check out [its dedicated segment](#resource-key-argument).
42-
43-
4440
## Resource Argument
4541
Just like any other argument, you can get a `ArgumentType<T>` reference to it using `ArgumentTypes.resource(RegistryKey<T>)`. A selection of possible registry keys can be
4642
found below. They are accessed in a static context using the <Javadoc name='io.papermc.paper.registry.RegistryKey'>`RegistryKey`</Javadoc> interface.
@@ -96,14 +92,13 @@ There are certain edge-cases, where this argument, due to missing registries on
9692
Basically, the only argument where this is the case right now is with the `STRUCTURE` registry key.
9793

9894
```java
99-
// Registering this command will cause client to not be able to connect to the server.
95+
// Registering this command will cause clients to not be able to connect to the server.
10096
final LiteralCommandNode<CommandSourceStack> invalidRegistryArgument = Commands.literal("registry-structure")
10197
.then(Commands.argument("value", ArgumentTypes.resource(RegistryKey.STRUCTURE)))
10298
.build();
10399
```
104100

105101
Due to this fact, it is advised to only use the `STRUCTURE` registry key argument with a `resourceKey(...)` argument type and parse the values yourself.
106-
[More information on resource key arguments can be found by clicking here.](#resource-key-argument).
107102

108103
:::
109104

0 commit comments

Comments
 (0)