mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-23 08:41:27 +01:00
Nullcheck in registerEvent (thanks to an old PR by LRFLEW - I'm sorry for the wait!)
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
35da0ddfa3
commit
d87866b158
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user