mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
Make suggestions more robust.
And fix potential errors in the ^[] pattern parser.
This commit is contained in:
@ -569,7 +569,16 @@ public final class PlatformCommandManager {
|
||||
.map(Substring::getSubstring)
|
||||
.collect(Collectors.toList());
|
||||
MemoizingValueAccess access = initializeInjectedValues(() -> arguments, event.getActor());
|
||||
ImmutableSet<Suggestion> suggestions = commandManager.getSuggestions(access, argStrings);
|
||||
ImmutableSet<Suggestion> suggestions;
|
||||
try {
|
||||
suggestions = commandManager.getSuggestions(access, argStrings);
|
||||
} catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters
|
||||
if (!(t instanceof CommandException)) {
|
||||
log.debug("Unexpected error occurred while generating suggestions for input: " + arguments, t);
|
||||
return;
|
||||
}
|
||||
throw t;
|
||||
}
|
||||
|
||||
event.setSuggestions(suggestions.stream()
|
||||
.map(suggestion -> {
|
||||
@ -588,8 +597,6 @@ public final class PlatformCommandManager {
|
||||
if (e.getCondition() instanceof PermissionCondition) {
|
||||
event.setSuggestions(new ArrayList<>());
|
||||
}
|
||||
} catch (CommandException e) {
|
||||
event.getActor().printError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user