summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-03-30 00:25:11 +0200
committerErik Broes <erikbroes@grum.nl>2011-03-30 00:25:11 +0200
commita3319e525bca93264fbedd68a6824468f32e0820 (patch)
tree2ec34b7d9fcc154cc1a7cabde98155d6cf772284 /src
parent08e33ad0c68467b9db29b95c59552c945aa88acb (diff)
downloadbukkit-a3319e525bca93264fbedd68a6824468f32e0820.tar
bukkit-a3319e525bca93264fbedd68a6824468f32e0820.tar.gz
bukkit-a3319e525bca93264fbedd68a6824468f32e0820.tar.lz
bukkit-a3319e525bca93264fbedd68a6824468f32e0820.tar.xz
bukkit-a3319e525bca93264fbedd68a6824468f32e0820.zip
Add 'NagException' to disclose plugin fail
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/plugin/AuthorNagException.java20
-rw-r--r--src/main/java/org/bukkit/plugin/SimplePluginManager.java7
2 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/plugin/AuthorNagException.java b/src/main/java/org/bukkit/plugin/AuthorNagException.java
new file mode 100644
index 00000000..d652891c
--- /dev/null
+++ b/src/main/java/org/bukkit/plugin/AuthorNagException.java
@@ -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;
+ }
+}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 47eaabc9..5cdee774 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -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);
}