From 63673c496f3dec4b543e483de73a12c7a2d8b13e Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 14 Jan 2012 14:31:00 +0000 Subject: Nullcheck in registerEvent (thanks to an old PR by LRFLEW - I'm sorry for the wait!) --- .../org/bukkit/plugin/SimplePluginManager.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/main/java') 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"); } -- cgit v1.2.3