geforkt von Mirrors/Paper
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).
Dieser Commit ist enthalten in:
Ursprung
af964c8331
Commit
f859d45727
@ -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() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren