Skip to content

Commit a6ce6ad

Browse files
committed
Replace PlayerArgument with EntitySelectorArgument.OnePlayer where applicable
1 parent 8390216 commit a6ce6ad

File tree

13 files changed

+20
-23
lines changed

13 files changed

+20
-23
lines changed

docs/en/annotations/annotations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The annotations for arguments are really simple, there are just two things you n
8888

8989
$$\begin{align}
9090
\texttt{StringArgument}&\xrightarrow{A}\texttt{@AStringArgument}\\\\
91-
\texttt{PlayerArgument}&\xrightarrow{A}\texttt{@APlayerArgument}\\\\
91+
\texttt{IntegerArgument}&\xrightarrow{A}\texttt{@AIntegerArgument}\\\\
9292
\texttt{AdvancementArgument}&\xrightarrow{A}\texttt{@AAdvancementArgument}\\\\
9393
&\hspace{0.75em}\vdots
9494
\end{align}$$

docs/en/create-commands/arguments/arguments.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Adding arguments for registration is simple:
2222
// Create a List
2323
List<Argument> arguments = new ArrayList<>();
2424

25-
// Add an argument with the node "target", which is a PlayerArgument
26-
arguments.add(new PlayerArgument("target"));
25+
// Add an argument with the node "target", which is a EntitySelectorArgument.OnePlayer
26+
arguments.add(new EntitySelectorArgument.OnePlayer("target"));
2727
```
2828

2929
The String value is the node that is registered into Minecraft's internal command graph. This name is also used as a prompt that is shown to a player when they are entering the command.
@@ -118,9 +118,8 @@ The type to cast each argument (declared in the `dev.jorel.commandapi.arguments`
118118
| [`NBTCompoundArgument<T>`](./types/nbt-arguments) | The cast type changes depending on whether you're shading the CommandAPI or using the CommandAPI as a plugin:<br /><ul><li>Shading:<br />`T` (implemented yourself)</li><br /><li>Plugin:<br />`dev.jorel.commandapi.nbtapi.NBTContainer`</li></ul> |
119119
| [`ObjectiveArgument`](./types/scoreboard/objective-arguments#objective-argument) | `org.bukkit.scoreboard.Objective` |
120120
| [`ObjectiveCriteriaArgument`](./types/scoreboard/objective-arguments#objective-criteria-argument) | `String` |
121-
| [`OfflinePlayerArgument`](./types/entities-arguments#offlineplayer-argument) | `org.bukkit.OfflinePlayer` |
122121
| [`ParticleArgument`](./types/misc/particle-arguments) | `dev.jorel.commandapi.wrappers.ParticleData` |
123-
| [`PlayerArgument`](./types/entities-arguments#player-argument) | `org.bukkit.entity.Player` |
122+
| [`PlayerProfileArgument`](./types/entities-arguments#playerprofile-argument) | `org.bukkit.entity.Player` |
124123
| [`PotionEffectArgument`](./types/misc/potion-arguments) | `org.bukkit.potion.PotionEffectType` |
125124
| [`PotionEffectArgument.NamespacedKey`](./types/misc/potion-arguments) | `org.bukkit.NamespacedKey` |
126125
| [`RecipeArgument`](./types/misc/recipe-arguments) | The cast type changes depending on your Minecraft version:<br><ul><li>Version 1.14.4 and below:<br />`org.bukkit.inventory.Recipe`</li><br /><li>1.15 and above:<br />`org.bukkit.inventory.ComplexRecipe` </li></ul> |

docs/en/create-commands/arguments/optional-arguments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ When using the `withOptionalArguments` method it might be interesting to know th
6565

6666
```java
6767
new CommandAPICommand("optional")
68-
.withOptionalArguments(new PlayerArgument("target"))
68+
.withOptionalArguments(new EntitySelectorArgument.OnePlayer("target"))
6969
```
7070

7171
```java
7272
new CommandAPICommand("optional")
73-
.withArguments(new PlayerArgument("target").setOptional(true))
73+
.withArguments(new EntitySelectorArgument.OnePlayer("target").setOptional(true))
7474
```
7575

7676
However, calling `withOptionalArguments` is safer because it makes sure that the argument is optional because of that internal call.
@@ -131,7 +131,7 @@ At this point, your command is basically done.
131131
Any attempt to add a required argument will result in an `OptionalArgumentException`.
132132
However, this is where the `combineWith` method comes in.
133133
This method allows you to combine arguments.
134-
Let's say you have an optional `StringArgument` (here simplified to `A`) and you want a required `PlayerArgument` (here simplified to `B`).
134+
Let's say you have an optional `StringArgument` (here simplified to `A`) and you want a required `EntitySelectorArgument.OnePlayer` (here simplified to `B`).
135135
Argument `B` should only be required if argument `A` is given.
136136
To implement that logic, we’re going to use the `combineWith` method so that we have this syntax:
137137

@@ -144,7 +144,7 @@ This does two things:
144144
1. When checking optional argument constraints the argument `B` will be ignored so the `OptionalArgumentException` will not be thrown
145145
2. It allows you to define additional optional arguments afterwards which can only be entered if argument `B` has been entered
146146

147-
This is how you would add another optional `PlayerArgument` (here simplified to `C`):
147+
This is how you would add another optional `EntitySelectorArgument.OnePlayer` (here simplified to `C`):
148148

149149
```java
150150
new CommandAPICommand("mycommand")

docs/en/create-commands/arguments/suggestions/safe-suggestions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ The list of supported arguments are displayed in the following table. The parame
6666
| [`MathOperationArgument`](../types/misc/mathoperation-arguments) | `dev.jorel.commandapi.wrappers.MathOperation` |
6767
| [`NBTCompoundArgument`](../types/nbt-arguments) | `de.tr7zw.nbtapi.NBTContainer` |
6868
| [`ObjectiveArgument`](../types/scoreboard/objective-arguments#objective-argument) | **`org.bukkit.scoreboard.Objective`** |
69-
| [`OfflinePlayerArgument`](../types/entities-arguments#player-argument) | `org.bukkit.OfflinePlayer` |
7069
| [`ParticleArgument`](../types/misc/particle-arguments) | `org.bukkit.Particle` |
71-
| [`PlayerArgument`](../types/entities-arguments#player-argument) | `org.bukkit.entity.Player` |
70+
| [`PlayerProfileArgument`](../types/entities-arguments#playerprofile-argument) | `org.bukkit.entity.Player` |
7271
| [`PotionEffectArgument`](../types/misc/potion-arguments) | `org.bukkit.potion.PotionEffectType` |
7372
| [`RecipeArgument`](../types/misc/recipe-arguments) | `org.bukkit.inventory.Recipe` |
7473
| [`RotationArgument`](../types/position/rotation-arguments) | `dev.jorel.commandapi.wrappers.Rotation` |

docs/en/create-commands/arguments/suggestions/string-suggestions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The `strings(Function<SuggestionInfo, String[]> suggestions)` method in `Argumen
3939

4040
::::tip Example - Friend list by replacing suggestions
4141

42-
Say you have a plugin which has a "friend list" for players. If you want to teleport to a friend in that list, you could use a `PlayerArgument`, which has the list of suggestions replaced with the list of friends that that player has. Since the list of friends _depends on the sender_, we can use the function to determine what our suggestions should be. Let's use the following command to teleport to a friend from our friend list:
42+
Say you have a plugin which has a "friend list" for players. If you want to teleport to a friend in that list, you could use a `EntitySelectorArgument.OnePlayer`, which has the list of suggestions replaced with the list of friends that that player has. Since the list of friends _depends on the sender_, we can use the function to determine what our suggestions should be. Let's use the following command to teleport to a friend from our friend list:
4343

4444
```mccmd
4545
/friendtp <friend>

docs/en/create-commands/arguments/types/misc/advancement-arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Say we want to award a player an advancement. First, we need the syntax that our
2020
/award <player> <advancement>
2121
```
2222

23-
Since we require a player, we will use the `PlayerArgument` for this example. Given a player, we can simply get the `AdvancementProgress` for that player, and then award the criteria required to fully complete the provided advancement.
23+
Since we require a player, we will use the `EntitySelectorArgument.OnePlayer` for this example. Given a player, we can simply get the `AdvancementProgress` for that player, and then award the criteria required to fully complete the provided advancement.
2424

2525
:::tabs
2626
===Java

docs/en/create-commands/arguments/types/misc/potion-arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Say we wanted to have a command that gives a player a potion effect. For this co
2020
/potion <target> <potion> <duration> <strength>
2121
```
2222

23-
In this example, we utilize some of the other arguments that we've described earlier, such as the `PlayerArgument` and `TimeArgument`. Since duration for the `PotionEffect` constructor is in ticks, this is perfectly fit for the `TimeArgument`, which is represented in ticks.
23+
In this example, we utilize some of the other arguments that we've described earlier, such as the `EntitySelectorArgument.OnePlayer` and `TimeArgument`. Since duration for the `PotionEffect` constructor is in ticks, this is perfectly fit for the `TimeArgument`, which is represented in ticks.
2424

2525
#### Use `PotionEffectArgument`
2626

docs/en/create-commands/command-trees.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Say we want to take our `/sayhi` command from above and also have an argument wh
6767
/sayhi <target> - Says "Hi!" to a target player
6868
```
6969

70-
We can do this by adding a `PlayerArgument` to our command. As described above, to add this argument, we must use the `then()` method:
70+
We can do this by adding an `EntitySelectorArgument.OnePlayer` to our command. As described above, to add this argument, we must use the `then()` method:
7171

7272
:::tabs
7373
===Java
@@ -76,7 +76,7 @@ We can do this by adding a `PlayerArgument` to our command. As described above,
7676
<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/CommandTrees.kt#commandTreesExample
7777
:::
7878

79-
In this example, we have our normal `/sayhi` command using the `executes()` method. We then add a new argument (a new "branch" in our "tree"), the `PlayerArgument`, using the `then()` method. **We want to make this branch executable, so we also use the `executes()` method _on the argument itself_**. To register the full command tree (which includes both `/sayhi` and `/sayhi <target>`), we call `register()` on the `CommandTree` object.
79+
In this example, we have our normal `/sayhi` command using the `executes()` method. We then add a new argument (a new "branch" in our "tree"), the `EntitySelectorArgument.OnePlayer`, using the `then()` method. **We want to make this branch executable, so we also use the `executes()` method _on the argument itself_**. To register the full command tree (which includes both `/sayhi` and `/sayhi <target>`), we call `register()` on the `CommandTree` object.
8080

8181
::::
8282

docs/en/create-commands/permissions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ We first declare the command as normal. Nothing fancy is going on here:
7979
<<< @/../reference-code/bukkit/src/main/kotlin/createcommands/Permissions.kt#argumentPermissionExampleStep1
8080
:::
8181

82-
Now we declare our command with arguments. We use a `PlayerArgument` and apply the permission _to the argument_. After that, we register our command as normal:
82+
Now we declare our command with arguments. We use a `EntitySelectorArgument.OnePlayer` and apply the permission _to the argument_. After that, we register our command as normal:
8383

8484
:::tabs
8585
===Java

docs/en/create-commands/unregistration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ For the ExamplePlugin, setting `verbose-outputs` to `true` gives this:
152152
```log
153153
[Server thread/INFO]: [ExamplePlugin] Enabling ExamplePlugin v0.0.1
154154
[Server thread/INFO]: [CommandAPI] Registering command /break block<LocationArgument>
155-
[Server thread/INFO]: [CommandAPI] Registering command /myeffect target<PlayerArgument> potion<PotionEffectArgument>
155+
[Server thread/INFO]: [CommandAPI] Registering command /myeffect target<EntitySelectorArgument.OnePlayer> potion<PotionEffectArgument>
156156
[Server thread/INFO]: [CommandAPI] Registering command /nbt nbt<NBTCompoundArgument>
157157
```
158158

0 commit comments

Comments
 (0)