mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 22:40:21 +01:00
Start the Plugin interfaces
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
94c43fd0fa
commit
1df4f74b79
2 changed files with 81 additions and 0 deletions
33
paper-api/src/org/bukkit/plugin/Plugin.java
Normal file
33
paper-api/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
paper-api/src/org/bukkit/plugin/PluginLoader.java
Normal file
48
paper-api/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…
Reference in a new issue