You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`
118
118
|[`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> |
|[`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> |
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.
131
131
Any attempt to add a required argument will result in an `OptionalArgumentException`.
132
132
However, this is where the `combineWith` method comes in.
133
133
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`).
135
135
Argument `B` should only be required if argument `A` is given.
136
136
To implement that logic, we’re going to use the `combineWith` method so that we have this syntax:
137
137
@@ -144,7 +144,7 @@ This does two things:
144
144
1. When checking optional argument constraints the argument `B` will be ignored so the `OptionalArgumentException` will not be thrown
145
145
2. It allows you to define additional optional arguments afterwards which can only be entered if argument `B` has been entered
146
146
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`):
Copy file name to clipboardExpand all lines: docs/en/create-commands/arguments/suggestions/string-suggestions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ The `strings(Function<SuggestionInfo, String[]> suggestions)` method in `Argumen
39
39
40
40
::::tip Example - Friend list by replacing suggestions
41
41
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:
Copy file name to clipboardExpand all lines: docs/en/create-commands/arguments/types/misc/advancement-arguments.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Say we want to award a player an advancement. First, we need the syntax that our
20
20
/award <player> <advancement>
21
21
```
22
22
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.
Copy file name to clipboardExpand all lines: docs/en/create-commands/arguments/types/misc/potion-arguments.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Say we wanted to have a command that gives a player a potion effect. For this co
20
20
/potion <target> <potion> <duration> <strength>
21
21
```
22
22
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.
Copy file name to clipboardExpand all lines: docs/en/create-commands/command-trees.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ Say we want to take our `/sayhi` command from above and also have an argument wh
67
67
/sayhi <target> - Says "Hi!" to a target player
68
68
```
69
69
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:
71
71
72
72
:::tabs
73
73
===Java
@@ -76,7 +76,7 @@ We can do this by adding a `PlayerArgument` to our command. As described above,
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.
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:
0 commit comments