3 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 1
1
[versions ]
2
2
adventure = " 4.17.0"
3
- bluecommands = " 1.3.3 "
3
+ bluecommands = " 1.3.4 "
4
4
bstats = " 2.2.1"
5
5
configurate = " 4.1.2"
6
6
junit = " 5.8.2"
Original file line number Diff line number Diff line change 36
36
import org .bukkit .event .server .TabCompleteEvent ;
37
37
import org .jetbrains .annotations .NotNull ;
38
38
39
- import java .util .ArrayList ;
40
- import java .util .Collection ;
41
- import java .util .Comparator ;
42
- import java .util .List ;
39
+ import java .util .*;
43
40
44
41
import static de .bluecolored .bluemap .common .commands .TextFormat .NEGATIVE_COLOR ;
45
42
import static net .kyori .adventure .text .Component .text ;
@@ -114,9 +111,15 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLab
114
111
CommandExecutor .ExecutionResult executionResult = commandExecutor .execute (result );
115
112
116
113
if (executionResult .parseFailure ()) {
117
- result .getFailures ().stream ()
118
- .max (Comparator .comparing (ParseFailure ::getPosition ))
119
- .ifPresent (failure -> context .sendMessage (text (failure .getReason ()).color (NEGATIVE_COLOR )));
114
+ Optional <ParseFailure <CommandSource , Object >> failure = result .getFailures ().stream ()
115
+ .max (Comparator .comparing (ParseFailure ::getPosition ));
116
+
117
+ if (failure .isPresent ()) {
118
+ context .sendMessage (text (failure .get ().getReason ()).color (NEGATIVE_COLOR ));
119
+ } else {
120
+ context .sendMessage (text ("Unknown command!" ).color (NEGATIVE_COLOR ));
121
+ }
122
+
120
123
return false ;
121
124
}
122
125
Original file line number Diff line number Diff line change @@ -78,9 +78,15 @@ public CommandResult process(CommandCause cause, ArgumentReader.Mutable argument
78
78
CommandExecutor .ExecutionResult executionResult = commandExecutor .execute (result );
79
79
80
80
if (executionResult .parseFailure ()) {
81
- result .getFailures ().stream ()
82
- .max (Comparator .comparing (ParseFailure ::getPosition ))
83
- .ifPresent (failure -> context .sendMessage (text (failure .getReason ()).color (NEGATIVE_COLOR )));
81
+ Optional <ParseFailure <CommandSource , Object >> failure = result .getFailures ().stream ()
82
+ .max (Comparator .comparing (ParseFailure ::getPosition ));
83
+
84
+ if (failure .isPresent ()) {
85
+ context .sendMessage (text (failure .get ().getReason ()).color (NEGATIVE_COLOR ));
86
+ } else {
87
+ context .sendMessage (text ("Unknown command!" ).color (NEGATIVE_COLOR ));
88
+ }
89
+
84
90
return CommandResult .builder ()
85
91
.result (0 )
86
92
.build ();
0 commit comments