diff options
author | Wesley Wolfe <weswolf@aol.com> | 2013-03-31 15:37:17 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-03-31 15:37:17 -0500 |
commit | f859d457271dd941b99568ec144b626e65ae25b2 (patch) | |
tree | fcf005f220b94b9e668017d3cae59f623b57cc05 /src/main | |
parent | af964c83319d02b4847ea6d5f9fa26e8caa17012 (diff) | |
download | craftbukkit-f859d457271dd941b99568ec144b626e65ae25b2.tar craftbukkit-f859d457271dd941b99568ec144b626e65ae25b2.tar.gz craftbukkit-f859d457271dd941b99568ec144b626e65ae25b2.tar.lz craftbukkit-f859d457271dd941b99568ec144b626e65ae25b2.tar.xz craftbukkit-f859d457271dd941b99568ec144b626e65ae25b2.zip |
Throw exception for disabled plugin tasks. Fixes BUKKIT-3951
Without this check, any non-null reference to a plugin is considered
'valid' for registering a task in the scheduler. This is obviously
unintentional behavior and has been changed to throw an
IllegalPluginAccessException. It is now consistent with the
SimplePluginManager event registration contract.
This in affect also addresses BUKKIT-3950 for uninitialized plugin
references (ones without a description).
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 0a5c61a8..84dcfcca 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -15,6 +15,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Level; import org.apache.commons.lang.Validate; +import org.bukkit.plugin.IllegalPluginAccessException; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; @@ -389,6 +390,9 @@ public class CraftScheduler implements BukkitScheduler { private static void validate(final Plugin plugin, final Object task) { Validate.notNull(plugin, "Plugin cannot be null"); Validate.notNull(task, "Task cannot be null"); + if (!plugin.isEnabled()) { + throw new IllegalPluginAccessException("Plugin attempted to register task while disabled"); + } } private int nextId() { |