geforkt von Mirrors/Paper
Start the Plugin interfaces
By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Ursprung
94c43fd0fa
Commit
1df4f74b79
33
paper-api/src/org/bukkit/plugin/Plugin.java
Normale Datei
33
paper-api/src/org/bukkit/plugin/Plugin.java
Normale Datei
@ -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
Normale Datei
48
paper-api/src/org/bukkit/plugin/PluginLoader.java
Normale Datei
@ -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);
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren