Refactored Plugin into an interface, make Javaplugin and relevant code to attempt to actually load plugins
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
@@ -4,63 +4,49 @@ package org.bukkit.plugin;
|
||||
import org.bukkit.Server;
|
||||
|
||||
/**
|
||||
* Represents a plugin
|
||||
* Represents a Plugin
|
||||
*/
|
||||
public abstract class Plugin {
|
||||
private boolean isEnabled = false;
|
||||
private final PluginLoader loader;
|
||||
private final Server server;
|
||||
|
||||
public interface Plugin {
|
||||
/**
|
||||
* Constructs a new plugin instance
|
||||
* Returns the plugin.yaml file containing the details for this plugin
|
||||
*
|
||||
* @param pluginLoader PluginLoader that is responsible for this plugin
|
||||
* @param instance Server instance that is running this plugin
|
||||
* @return Contents of the plugin.yaml file
|
||||
*/
|
||||
protected Plugin(PluginLoader pluginLoader, Server instance) {
|
||||
loader = pluginLoader;
|
||||
server = instance;
|
||||
}
|
||||
public PluginDescriptionFile getDescription();
|
||||
|
||||
/**
|
||||
* Gets the associated PluginLoader responsible for this plugin
|
||||
*
|
||||
* @return PluginLoader that controls this plugin
|
||||
*/
|
||||
protected final PluginLoader getPluginLoader() {
|
||||
return loader;
|
||||
}
|
||||
public PluginLoader getPluginLoader();
|
||||
|
||||
/**
|
||||
* Returns the Server instance currently running this plugin
|
||||
*
|
||||
* @return Server running this plugin
|
||||
*/
|
||||
public final Server getServer() {
|
||||
return server;
|
||||
}
|
||||
public Server getServer();
|
||||
|
||||
/**
|
||||
* Returns a value indicating whether or not this plugin is currently enabled
|
||||
*
|
||||
*
|
||||
* @return true if this plugin is enabled, otherwise false
|
||||
*/
|
||||
public final boolean isEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this plugin is enabled
|
||||
*/
|
||||
protected abstract void onEnable();
|
||||
public boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Called when this plugin is disabled
|
||||
*/
|
||||
protected abstract void onDisable();
|
||||
public void onDisable();
|
||||
|
||||
/**
|
||||
* Called when this plugin is enabled
|
||||
*/
|
||||
public void onEnable();
|
||||
|
||||
/**
|
||||
* Called when this plugin is first initialized
|
||||
*/
|
||||
protected abstract void onInitialize();
|
||||
public void onInitialize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user