@@ -65,14 +65,17 @@ public BuilderCommand(@NotNull CommandBuilder commandBuilder, List<String> usage
65
65
Result <CommandNode <?>, List <String >> resultNode = current .node ;
66
66
if (resultNode .isError ()) {
67
67
if (current .extraInput ) {
68
- return Result .error (Collections .singletonList ("Expected end of input, but got extra args instead" ));
68
+ return Result .error (Collections .singletonList ("Expected end of input, but got extra parameters instead" ));
69
69
}
70
70
List <String > exceptions = resultNode .unwrapError ();
71
- List <String > messages = new ArrayList <>();
72
- List <String > matches = current .args ;
73
- messages .add ("Invalid parameter '" + matches .get (matches .size () - 1 ) + "' at position " + matches .size () + ": " );
74
- messages .addAll (exceptions );
75
- return Result .error (messages );
71
+ if (exceptions .isEmpty ()) exceptions .add ("Incorrect argument '" + reader .splice (reader .index ()) + "'" );
72
+ String rootCommand = CommandCore .getInstance ().getOptions ().getRootCommand ();
73
+ String label = context .getLabel ();
74
+ String correctSection = ChatColor .GRAY + rootCommand + " " + label + " " + reader .splice (0 , reader .index ());
75
+ String incorrectParameter = ChatColor .RED .toString () + ChatColor .UNDERLINE + reader .splice (reader .index ());
76
+ exceptions .add (correctSection + incorrectParameter + ChatColor .RESET + ChatColor .RED + ChatColor .ITALIC + " <--[HERE]" );
77
+ exceptions .add ("" );
78
+ return Result .error (exceptions );
76
79
}
77
80
CommandNode <?> node = resultNode .unwrap ();
78
81
CommandContext newContext = buildContext (context , current );
0 commit comments