mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Add numeric string completion suggestions as int suggestions (#6360)
This commit is contained in:
parent
68ef4d7878
commit
b8b48567ae
1 changed files with 3 additions and 2 deletions
|
@ -35,8 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- completions.forEach(builder::suggest);
|
- completions.forEach(builder::suggest);
|
||||||
+ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1);
|
+ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1);
|
||||||
+ completions.forEach(completion -> {
|
+ completions.forEach(completion -> {
|
||||||
+ if (completion.tooltip() == null) {
|
+ final Integer intSuggestion = com.google.common.primitives.Ints.tryParse(completion.suggestion());
|
||||||
+ builder.suggest(completion.suggestion());
|
+ if (intSuggestion != null) {
|
||||||
|
+ builder.suggest(intSuggestion, PaperAdventure.asVanilla(completion.tooltip()));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
|
+ builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
|
||||||
+ }
|
+ }
|
||||||
|
|
Loading…
Reference in a new issue