mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
Add 'NagException' to disclose plugin fail
This commit is contained in:
parent
08e33ad0c6
commit
a3319e525b
2 changed files with 27 additions and 0 deletions
20
src/main/java/org/bukkit/plugin/AuthorNagException.java
Normal file
20
src/main/java/org/bukkit/plugin/AuthorNagException.java
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -253,6 +253,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
for (RegisteredListener registration : eventListeners) {
|
for (RegisteredListener registration : eventListeners) {
|
||||||
try {
|
try {
|
||||||
registration.callEvent( event );
|
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) {
|
} catch (Throwable ex) {
|
||||||
server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getType() + " to " + registration.getPlugin().getDescription().getName(), ex);
|
server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getType() + " to " + registration.getPlugin().getDescription().getName(), ex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue