13
0
geforkt von Mirrors/Paper

Add 'NagException' to disclose plugin fail

By: Erik Broes <erikbroes@grum.nl>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2011-03-30 00:25:11 +02:00
Ursprung ac1bef5739
Commit 2e99a0f17d
2 geänderte Dateien mit 27 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,20 @@
package org.bukkit.plugin;
public class AuthorNagException extends RuntimeException {
private final String message;
/**
* Constructs a new UnknownDependencyException based on the given Exception
*
* @param message Brief message explaining the cause of the exception
* @param throwable Exception that triggered this Exception
*/
public AuthorNagException(final String message) {
this.message = message;
}
@Override
public String getMessage() {
return message;
}
}

Datei anzeigen

@ -253,6 +253,13 @@ public final class SimplePluginManager implements PluginManager {
for (RegisteredListener registration : eventListeners) {
try {
registration.callEvent( event );
} catch (AuthorNagException ex) {
server.getLogger().log(Level.SEVERE, String.format(
"Nag author: %s of %s about the following:",
registration.getPlugin().getDescription().getAuthors().get(0),
registration.getPlugin().getDescription().getName(),
ex.getMessage()
));
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getType() + " to " + registration.getPlugin().getDescription().getName(), ex);
}