Skip to content

Class endstone::Plugin

ClassList > endstone > Plugin

Represents a Plugin .

  • #include <endstone/plugin/plugin.h>

Inherits the following classes: endstone::CommandExecutor

Public Functions

Type Name
Plugin () = default
Plugin (const Plugin &) = delete
PluginCommand * getCommand (std::string name) const
Gets the command with the given name, specific to this plugin.
const std::filesystem::path & getDataFolder () const
Returns the folder that the plugin data's files are located in. The folder may not yet exist.
virtual const PluginDescription & getDescription () const = 0
Returns the details of this plugin.
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.
std::string getName () const
Returns the name of the plugin.
PluginLoader & getPluginLoader () const
Gets the associated PluginLoader responsible for this plugin.
Server & getServer () const
Returns the Server instance currently running this plugin.
bool isEnabled () const
Returns a value indicating whether this plugin is currently enabled.
virtual void onDisable ()
Called when this plugin is disabled.
virtual void onEnable ()
Called when this plugin is enabled.
virtual void onLoad ()
Called after a plugin is loaded but before it has been enabled.
Plugin & operator= (const Plugin &) = delete
void registerEvent (void(T::*)(EventType &) func, T & instance, EventPriority priority=EventPriority::Normal, bool ignore_cancelled=false)
void registerEvent (std::function< void(EventType &)> func, EventPriority priority=EventPriority::Normal, bool ignore_cancelled=false)
~Plugin () override

Public Functions inherited from endstone::CommandExecutor

See endstone::CommandExecutor

Type Name
virtual bool onCommand (CommandSender & sender, const Command & command, const std::vector< std::string > & args)
virtual ~CommandExecutor () = default

Protected Functions

Type Name
void setEnabled (bool enabled)

Public Functions Documentation

function Plugin [½]

endstone::Plugin::Plugin () = default

function Plugin [2/2]

endstone::Plugin::Plugin (
    const Plugin &
) = delete

function getCommand

Gets the command with the given name, specific to this plugin.

inline PluginCommand * endstone::Plugin::getCommand (
    std::string name
) const

Parameters:

  • name name or alias of the command

Returns:

the plugin command if found, otherwise null


function getDataFolder

Returns the folder that the plugin data's files are located in. The folder may not yet exist.

inline const std::filesystem::path & endstone::Plugin::getDataFolder () const

Returns:

The folder


function getDescription

Returns the details of this plugin.

virtual const PluginDescription & endstone::Plugin::getDescription () const = 0

Returns:

Details of this plugin


function getLogger

Returns the plugin logger associated with this server's logger. The returned logger automatically tags all log messages with the plugin's name.

inline Logger & endstone::Plugin::getLogger () const

Returns:

Logger associated with this plugin


function getName

Returns the name of the plugin.

inline std::string endstone::Plugin::getName () const

This should return the bare name of the plugin and should be used for comparison.

Returns:

name of the plugin


function getPluginLoader

Gets the associated PluginLoader responsible for this plugin.

inline PluginLoader & endstone::Plugin::getPluginLoader () const

Returns:

PluginLoader that controls this plugin


function getServer

Returns the Server instance currently running this plugin.

inline Server & endstone::Plugin::getServer () const

Returns:

Server running this plugin


function isEnabled

Returns a value indicating whether this plugin is currently enabled.

inline bool endstone::Plugin::isEnabled () const

Returns:

true if this plugin is enabled, otherwise false


function onDisable

inline virtual void endstone::Plugin::onDisable () 

function onEnable

inline virtual void endstone::Plugin::onEnable () 

function onLoad

Called after a plugin is loaded but before it has been enabled.

inline virtual void endstone::Plugin::onLoad () 

When multiple plugins are loaded, the onLoad() for all plugins is called before any onEnable() is called.


function operator=

Plugin & endstone::Plugin::operator= (
    const Plugin &
) = delete

function registerEvent [½]

template<typename EventType, typename T>
inline void endstone::Plugin::registerEvent (
    void(T::*)(EventType &) func,
    T & instance,
    EventPriority priority=EventPriority::Normal,
    bool ignore_cancelled=false
) 

function registerEvent [2/2]

template<typename EventType>
inline void endstone::Plugin::registerEvent (
    std::function< void(EventType &)> func,
    EventPriority priority=EventPriority::Normal,
    bool ignore_cancelled=false
) 

function ~Plugin

endstone::Plugin::~Plugin () override

Protected Functions Documentation

function setEnabled

inline void endstone::Plugin::setEnabled (
    bool enabled
) 

Sets the enabled state of this plugin

Parameters:

  • enabled true if enabled, otherwise false

Friends Documentation

friend EndstonePluginManager

class endstone::Plugin::EndstonePluginManager (
    detail::EndstonePluginManager
) 


The documentation for this class was generated from the following file include/endstone/plugin/plugin.h