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; private String message;
CommandFrameworkException(InvocationTargetException invocationTargetException, String alias, String[] args) { CommandFrameworkException(InvocationTargetException invocationTargetException, String alias, String[] args) {
super(invocationTargetException);
this.invocationTargetException = invocationTargetException; this.invocationTargetException = invocationTargetException;
this.alias = alias; this.alias = alias;
this.args = args; this.args = args;

Datei anzeigen

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

Datei anzeigen

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