13
0
geforkt von Mirrors/Paper

Few additions to Plugin for retrieving the Server and PluginLoader responsible for the plugin

By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2010-12-24 13:06:44 +00:00
Ursprung 118fbe5d87
Commit e3d491491a
2 geänderte Dateien mit 35 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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)) {