Skip to content

Commit 7a4f358

Browse files
committed
fix(stellar): incorrect phrase argument code
1 parent 8d7a1cb commit 7a4f358

File tree

1 file changed

+14
-3
lines changed
  • content/docs/stellar/latest/arguments/basic

1 file changed

+14
-3
lines changed

content/docs/stellar/latest/arguments/basic/string.mdx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,27 @@ You can type anything you want using this, the only problem here is that **it's
6565

6666
To be able to use a Phrase argument and handle each word independently, use the `PhraseArgument`. It contains a list of `WordArgument`, which you can customize:
6767

68-
```kotlin
68+
```kotlin tab="Kotlin"
6969
StellarCommand("server")
7070
.addPhraseArgument("args")
71-
.onWord(index = 0) { // Extension function of WordArgument
71+
.addWordArgument(index = 0) { // Extension function of WordArgument
7272
addExecution<Player> { // extension function of PhraseCommandContext
7373
getArgument(0)
7474
this[0]
7575
}
7676
}
77-
.addWordSuggestions(index = 1, suggestions = "first, "second")
77+
.addWordSuggestions(index = 1, "first", "second")
78+
```
79+
```java tab="Java"
80+
new StellarCommand("server")
81+
.addPhraseArgument("args")
82+
.addWordArgument(0, argument -> {
83+
argument.addExecution(context -> {
84+
context.getArgument(0);
85+
// ...
86+
});
87+
})
88+
.addWordSuggestions(1, "first", "second");
7889
```
7990

8091
[//]: # (<ArgumentParser placeholder="You can write anything you want here!" regex="^.*$" />)

0 commit comments

Comments
 (0)