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() = default
Plugin(const Plugin &) = delete
getCommand
PluginCommand *getCommand(std::string name) const
Gets the command with the given name, specific to this plugin.
Parameters:
name
name or alias of the command
Returns:
the plugin command if found, otherwise null
getDataFolder
const std::filesystem::path &getDataFolder() const
Returns the folder that the plugin data’s files are located in. The folder may not yet exist.
Returns:
The folder
getDescription
const PluginDescription &getDescription() const
Returns the details of this plugin.
Returns:
Details of this plugin
getLogger
Logger &getLogger() const
Returns 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() const
Returns 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() const
Gets the associated PluginLoader responsible for this plugin.
Returns:
PluginLoader that controls this plugin
getServer
Server &getServer() const
Returns the Server instance currently running this plugin.
Returns:
Server running this plugin
isEnabled
bool isEnabled() const
Returns 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)