summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 14:31:00 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 14:31:00 +0000
commit63673c496f3dec4b543e483de73a12c7a2d8b13e (patch)
tree351f8231e9ea5267709c7ffa6fadfb8fba1a1ab2
parent682988ca75247514e5e9cf7a7081d0712713ea56 (diff)
downloadbukkit-63673c496f3dec4b543e483de73a12c7a2d8b13e.tar
bukkit-63673c496f3dec4b543e483de73a12c7a2d8b13e.tar.gz
bukkit-63673c496f3dec4b543e483de73a12c7a2d8b13e.tar.lz
bukkit-63673c496f3dec4b543e483de73a12c7a2d8b13e.tar.xz
bukkit-63673c496f3dec4b543e483de73a12c7a2d8b13e.zip
Nullcheck in registerEvent (thanks to an old PR by LRFLEW - I'm sorry for the wait!)
-rw-r--r--src/main/java/org/bukkit/plugin/SimplePluginManager.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index addbca3e..3e89adf8 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -373,6 +373,18 @@ public final class SimplePluginManager implements PluginManager {
* @param plugin Plugin to register
*/
public void registerEvent(Event.Type type, Listener listener, Priority priority, Plugin plugin) {
+ if (type == null) {
+ throw new IllegalArgumentException("Type cannot be null");
+ }
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
+ if (priority == null) {
+ throw new IllegalArgumentException("Priority cannot be null");
+ }
+ if (plugin == null) {
+ throw new IllegalArgumentException("Priority cannot be null");
+ }
if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register " + type + " while not enabled");
}
@@ -390,6 +402,18 @@ public final class SimplePluginManager implements PluginManager {
* @param plugin Plugin to register
*/
public void registerEvent(Event.Type type, Listener listener, EventExecutor executor, Priority priority, Plugin plugin) {
+ if (type == null) {
+ throw new IllegalArgumentException("Type cannot be null");
+ }
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
+ if (priority == null) {
+ throw new IllegalArgumentException("Priority cannot be null");
+ }
+ if (plugin == null) {
+ throw new IllegalArgumentException("Priority cannot be null");
+ }
if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register " + type + " while not enabled");
}