mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Few additions to Plugin for retrieving the Server and PluginLoader responsible for the plugin
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
118fbe5d87
commit
e3d491491a
@ -1,11 +1,44 @@
|
|||||||
|
|
||||||
package org.bukkit.plugin;
|
package org.bukkit.plugin;
|
||||||
|
|
||||||
|
import org.bukkit.Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a plugin
|
* Represents a plugin
|
||||||
*/
|
*/
|
||||||
public abstract class Plugin {
|
public abstract class Plugin {
|
||||||
private boolean isEnabled = false;
|
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
|
* Returns a value indicating whether or not this plugin is currently enabled
|
||||||
|
@ -26,8 +26,9 @@ public final class PluginManager {
|
|||||||
* Registers the specified plugin loader
|
* Registers the specified plugin loader
|
||||||
*
|
*
|
||||||
* @param loader Class name of the PluginLoader to register
|
* @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;
|
PluginLoader instance;
|
||||||
|
|
||||||
if (PluginLoader.class.isAssignableFrom(loader)) {
|
if (PluginLoader.class.isAssignableFrom(loader)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user