Dieser Commit ist enthalten in:
dordsor21 2021-10-25 15:04:59 +01:00
Ursprung 47f25c4f31
Commit 1b1f3bbcbe
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -112,6 +112,7 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.internal.command.CommandArgParser; import com.sk89q.worldedit.internal.command.CommandArgParser;
@ -910,11 +911,22 @@ public final class PlatformCommandManager {
try { try {
suggestions = commandManager.getSuggestions(access, argStrings); suggestions = commandManager.getSuggestions(access, argStrings);
} catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters } catch (Throwable t) { // catch errors which are *not* command exceptions generated by parsers/suggesters
if (!(t instanceof CommandException)) { if (!(t instanceof InputParseException) && !(t instanceof CommandException)) {
LOGGER.error("Unexpected error occurred while generating suggestions for input: {}", arguments, t); Throwable cause = t;
return; // These exceptions can be very nested, and should not be printed as they are not an actual error.
boolean printError = true;
while ((cause = cause.getCause()) != null) {
if (cause instanceof InputParseException || cause instanceof CommandException) {
printError = false;
break;
}
}
if (printError) {
LOGGER.error("Unexpected error occurred while generating suggestions for input: {}", arguments, t);
return;
}
} }
throw t; return;
} }
event.setSuggestions(suggestions.stream() event.setSuggestions(suggestions.stream()