SteamWar/SpigotCore
Archiviert
13
0

Improve CommandFramework Exception readability
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-01-03 00:42:00 +01:00
Ursprung a9a8a83c46
Commit c0d3edd4b0
3 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -32,6 +32,7 @@ public class CommandFrameworkException extends RuntimeException {
private String message;
CommandFrameworkException(InvocationTargetException invocationTargetException, String alias, String[] args) {
super(invocationTargetException);
this.invocationTargetException = invocationTargetException;
this.alias = alias;
this.args = args;

Datei anzeigen

@ -102,7 +102,9 @@ public abstract class SWCommand {
} catch (CommandNoHelpException e) {
// Ignored
} catch (CommandFrameworkException e) {
Bukkit.getLogger().log(Level.SEVERE, e.getBuildStackTrace());
if (Bukkit.getServer() != null) {
Bukkit.getLogger().log(Level.SEVERE, e.getBuildStackTrace());
}
throw e;
}
}

Datei anzeigen

@ -39,9 +39,9 @@ public class SimpleCommandTest {
public void testCommandParsing() {
try {
simpleCommand.execute(new TestCommandSender(), "", new String[]{});
} catch (SecurityException securityException) {
if (securityException.getCause().getCause() instanceof ExecutionIdentifier) {
ExecutionIdentifier executionIdentifier = (ExecutionIdentifier) securityException.getCause().getCause();
} catch (CommandFrameworkException commandFrameworkException) {
if (commandFrameworkException.getCause().getCause() instanceof ExecutionIdentifier) {
ExecutionIdentifier executionIdentifier = (ExecutionIdentifier) commandFrameworkException.getCause().getCause();
assertThat(executionIdentifier.getMessage(), is("Simple execute without any parameters"));
return;
}