Start the Plugin interfaces
This commit is contained in:
parent
008700b6be
commit
6ec2d4bc66
33
src/org/bukkit/plugin/Plugin.java
Normal file
33
src/org/bukkit/plugin/Plugin.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
package org.bukkit.plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a plugin
|
||||||
|
*/
|
||||||
|
public abstract class Plugin {
|
||||||
|
private boolean isEnabled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when this plugin is disabled
|
||||||
|
*/
|
||||||
|
protected abstract void onDisable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when this plugin is first initialized
|
||||||
|
*/
|
||||||
|
protected abstract void onInitialize();
|
||||||
|
}
|
48
src/org/bukkit/plugin/PluginLoader.java
Normal file
48
src/org/bukkit/plugin/PluginLoader.java
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
package org.bukkit.plugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a plugin loader, which provides access and management for all plugins
|
||||||
|
* currently loaded on a server instance
|
||||||
|
*/
|
||||||
|
public interface PluginLoader {
|
||||||
|
/**
|
||||||
|
* Checks if the given plugin is loaded and returns it when applicable
|
||||||
|
*
|
||||||
|
* Please note that the name of the plugin is case-sensitive
|
||||||
|
*
|
||||||
|
* @param name Name of the plugin to check
|
||||||
|
* @return Plugin if it exists, otherwise null
|
||||||
|
*/
|
||||||
|
public Plugin getPlugin(String name);
|
||||||
|
/**
|
||||||
|
* Checks if the given plugin is enabled or not
|
||||||
|
*
|
||||||
|
* Please note that the name of the plugin is case-sensitive.
|
||||||
|
*
|
||||||
|
* @param name Name of the plugin to check
|
||||||
|
* @return true if the plugin is enabled, otherwise false
|
||||||
|
*/
|
||||||
|
public boolean isPluginEnabled(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given plugin is enabled or not
|
||||||
|
*
|
||||||
|
* @param plugin Plugin to check
|
||||||
|
* @return true if the plugin is enabled, otherwise false
|
||||||
|
*/
|
||||||
|
public boolean isPluginEnabled(Plugin plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the plugin contained in the specified file
|
||||||
|
*
|
||||||
|
* File must be a .jar and contain a valid plugin.yaml file
|
||||||
|
*
|
||||||
|
* @param file File to attempt to load
|
||||||
|
* @return Plugin that was contained in the specified file, or null if
|
||||||
|
* unsuccessful
|
||||||
|
*/
|
||||||
|
public Plugin loadPlugin(File file);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user