diff --git a/paper-api/src/org/bukkit/plugin/Plugin.java b/paper-api/src/org/bukkit/plugin/Plugin.java index 78cb7dc633..ba781ce261 100644 --- a/paper-api/src/org/bukkit/plugin/Plugin.java +++ b/paper-api/src/org/bukkit/plugin/Plugin.java @@ -1,11 +1,44 @@ package org.bukkit.plugin; +import org.bukkit.Server; + /** * Represents a plugin */ public abstract class Plugin { private boolean isEnabled = false; + private final PluginLoader loader; + private final Server server; + + /** + * Constructs a new plugin instance + * + * @param pluginLoader PluginLoader that is responsible for this plugin + * @param instance Server instance that is running this plugin + */ + protected Plugin(PluginLoader pluginLoader, Server instance) { + loader = pluginLoader; + server = instance; + } + + /** + * Gets the associated PluginLoader responsible for this plugin + * + * @return PluginLoader that controls this plugin + */ + protected final PluginLoader getPluginLoader() { + return loader; + } + + /** + * Returns the Server instance currently running this plugin + * + * @return Server running this plugin + */ + public final Server getServer() { + return server; + } /** * Returns a value indicating whether or not this plugin is currently enabled diff --git a/paper-api/src/org/bukkit/plugin/PluginManager.java b/paper-api/src/org/bukkit/plugin/PluginManager.java index 1185440731..de710414cf 100644 --- a/paper-api/src/org/bukkit/plugin/PluginManager.java +++ b/paper-api/src/org/bukkit/plugin/PluginManager.java @@ -26,8 +26,9 @@ public final class PluginManager { * Registers the specified plugin loader * * @param loader Class name of the PluginLoader to register + * @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader */ - public void RegisterInterface(Class loader) { + public void RegisterInterface(Class loader) throws IllegalArgumentException { PluginLoader instance; if (PluginLoader.class.isAssignableFrom(loader)) {