Class SimplePlugin
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
me.hsgamer.hscore.bukkit.simpleplugin.SimplePlugin
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor,org.bukkit.command.TabCompleter,org.bukkit.command.TabExecutor,org.bukkit.plugin.Plugin
public class SimplePlugin
extends org.bukkit.plugin.java.JavaPlugin
A convenient
JavaPlugin implementation-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDisableFunction(Runnable disableFunction) Add a function that will be called when the plugin is disabled.voidaddPostEnableRunnable(Runnable runnable) Add a runnable that will be called after enabling the pluginvoiddisable()Execute when disabling the pluginvoidenable()Execute when enabling the plugin<T> Collection<org.bukkit.plugin.RegisteredServiceProvider<T>>getAllProviders(Class<T> service) Get all providers of the service<T> org.bukkit.plugin.RegisteredServiceProvider<T>getProvider(Class<T> service) Get the registered provider of the servicevoidload()Execute when loading the plugin<T> TloadProvider(Class<T> service) Load the provider of the servicevoidvoidonEnable()voidonLoad()voidExecute after disabling all tasks, listeners and commandsvoidExecute after enabling all pluginsvoidpreLoad()Execute on the constructorvoidregisterListener(org.bukkit.event.Listener listener) Register the listener<T> voidregisterProvider(Class<T> service, T provider) Register a provider for the service in the normal priority<T> voidregisterProvider(Class<T> service, T provider, org.bukkit.plugin.ServicePriority priority) Register a provider for the serviceMethods inherited from class org.bukkit.plugin.java.JavaPlugin
getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getPluginMeta, getProvidingPlugin, getResource, getServer, getTextResource, init, init, isEnabled, isNaggable, onCommand, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toStringMethods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.plugin.Plugin
getComponentLogger, getLog4JLogger, getSLF4JLogger
-
Constructor Details
-
SimplePlugin
public SimplePlugin()
-
-
Method Details
-
onLoad
public void onLoad()- Specified by:
onLoadin interfaceorg.bukkit.plugin.Plugin- Overrides:
onLoadin classorg.bukkit.plugin.java.JavaPlugin
-
onEnable
public void onEnable()- Specified by:
onEnablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onEnablein classorg.bukkit.plugin.java.JavaPlugin
-
onDisable
public void onDisable()- Specified by:
onDisablein interfaceorg.bukkit.plugin.Plugin- Overrides:
onDisablein classorg.bukkit.plugin.java.JavaPlugin
-
preLoad
public void preLoad()Execute on the constructor -
load
public void load()Execute when loading the plugin -
enable
public void enable()Execute when enabling the plugin -
postEnable
public void postEnable()Execute after enabling all plugins -
disable
public void disable()Execute when disabling the plugin -
postDisable
public void postDisable()Execute after disabling all tasks, listeners and commands -
registerListener
public void registerListener(org.bukkit.event.Listener listener) Register the listener- Parameters:
listener- the listener
-
registerProvider
public <T> void registerProvider(Class<T> service, T provider, org.bukkit.plugin.ServicePriority priority) Register a provider for the service- Type Parameters:
T- the type of the service- Parameters:
service- the serviceprovider- the providerpriority- the priority of the provider
-
registerProvider
Register a provider for the service in the normal priority- Type Parameters:
T- the type of the service- Parameters:
service- the serviceprovider- the provider
-
loadProvider
Load the provider of the service- Type Parameters:
T- the type of the service- Parameters:
service- the service- Returns:
- the provider
-
getProvider
Get the registered provider of the service- Type Parameters:
T- the type of the service- Parameters:
service- the service- Returns:
- the provider
-
getAllProviders
public <T> Collection<org.bukkit.plugin.RegisteredServiceProvider<T>> getAllProviders(Class<T> service) Get all providers of the service- Type Parameters:
T- the type of the service- Parameters:
service- the service- Returns:
- the collection of providers
-
addDisableFunction
Add a function that will be called when the plugin is disabled. When the plugin is disabled, the added functions will be called and then removed from the list.- Parameters:
disableFunction- the disable function
-
addPostEnableRunnable
Add a runnable that will be called after enabling the plugin- Parameters:
runnable- the runnable
-