endstone::Plugin
Represents a Plugin .
Bases: endstone::CommandExecutor
Functions:
| Name | Description |
|---|---|
Plugin | |
Plugin | |
getCommand | Gets the command with the given name, specific to this plugin. |
getDataFolder | Returns the folder that the plugin data’s files are located in. The folder may not yet exist. |
getDescription | Returns the details of this plugin. |
getLogger | Returns the plugin logger associated with this server’s logger. The returned logger automatically tags all log messages with the plugin’s name. |
getName | Returns the name of the plugin. |
getPluginLoader | Gets the associated PluginLoader responsible for this plugin. |
getServer | Returns the Server instance currently running this plugin. |
isEnabled | Returns a value indicating whether this plugin is currently enabled. |
onDisable | Called when this plugin is disabled. |
onEnable | Called when this plugin is enabled. |
onLoad | Called after a plugin is loaded but before it has been enabled. |
registerEvent | |
registerEvent |
Plugin
Plugin() = defaultPlugin(const Plugin &) = delete getCommand
PluginCommand *getCommand(std::string name) constGets the command with the given name, specific to this plugin.
Parameters:
namename or alias of the command
Returns:
the plugin command if found, otherwise null
getDataFolder
const std::filesystem::path &getDataFolder() constReturns the folder that the plugin data’s files are located in. The folder may not yet exist.
Returns:
The folder
getDescription
const PluginDescription &getDescription() constReturns the details of this plugin.
Returns:
Details of this plugin
getLogger
Logger &getLogger() constReturns the plugin logger associated with this server’s logger. The returned logger automatically tags all log messages with the plugin’s name.
Returns:
Logger associated with this plugin
getName
std::string getName() constReturns the name of the plugin.
This should return the bare name of the plugin and should be used for comparison.
Returns:
name of the plugin
getPluginLoader
PluginLoader &getPluginLoader() constGets the associated PluginLoader responsible for this plugin.
Returns:
PluginLoader that controls this plugin
getServer
Server &getServer() constReturns the Server instance currently running this plugin.
Returns:
Server running this plugin
isEnabled
bool isEnabled() constReturns a value indicating whether this plugin is currently enabled.
Returns:
true if this plugin is enabled, otherwise false
onDisable
void onDisable()Called when this plugin is disabled.
onEnable
void onEnable()Called when this plugin is enabled.
onLoad
void onLoad()Called after a plugin is loaded but before it has been enabled.
When multiple plugins are loaded, the onLoad() for all plugins is called before any onEnable() is called.
registerEvent
template <typename EventType, typename T>
void registerEvent(void (T::*)(EventType &) func, T &instance,
EventPriority priority = EventPriority::Normal,
bool ignore_cancelled = false)template <typename EventType>
void registerEvent(std::function<void(EventType &)> func,
EventPriority priority = EventPriority::Normal,
bool ignore_cancelled = false)