Skip to content

Class endstone::PluginManager

ClassList > endstone > PluginManager

Represents a plugin manager that handles all plugins from the Server .

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

Public Functions

Type Name
PluginManager () = default
PluginManager (PluginManager const &) = delete
virtual Permission & addPermission (std::unique_ptr< Permission > perm) = 0
Adds a Permission to this plugin manager.
virtual void callEvent (Event & event) = 0
Calls an event which will be passed to plugins.
virtual void clearPlugins () = 0
Disables and removes all plugins.
virtual void disablePlugin (Plugin & plugin) = 0
Disables the specified plugin.
virtual void disablePlugins () = 0
Disables all the loaded plugins.
virtual void enablePlugin (Plugin & plugin) const = 0
Enables the specified plugin.
virtual void enablePlugins () const = 0
Enable all the loaded plugins.
virtual std::unordered_set< Permissible * > getDefaultPermSubscriptions (PermissionLevel level) const = 0
Gets a set containing all subscribed Permissibles to the given default list, by permission level.
virtual std::vector< Permission * > getDefaultPermissions (PermissionLevel level) const = 0
Gets the default permissions for the given permission level.
virtual Permission * getPermission (std::string name) const = 0
Gets a Permission from its fully qualified name.
virtual std::unordered_set< Permissible * > getPermissionSubscriptions (std::string permission) const = 0
Gets a set containing all subscribed Permissibles to the given permission, by name.
virtual std::unordered_set< Permission * > getPermissions () const = 0
Gets a set of all registered permissions.
virtual Plugin * getPlugin (const std::string & name) const = 0
Checks if the given plugin is loaded and returns it when applicable.
virtual std::vector< Plugin * > getPlugins () const = 0
Gets a list of all currently loaded plugins.
virtual bool isPluginEnabled (const std::string & name) const = 0
Checks if the given plugin is enabled or not.
virtual bool isPluginEnabled (Plugin * plugin) const = 0
Checks if the given plugin is enabled or not.
virtual Plugin * loadPlugin (std::string file) = 0
Loads the plugin in the specified file.
virtual std::vector< Plugin * > loadPlugins (std::string directory) = 0
Loads the plugin contained within the specified directory.
virtual std::vector< Plugin * > loadPlugins (std::vector< std::string > files) = 0
Loads the plugins in the list of the files.
PluginManager & operator= (PluginManager const &) = delete
virtual void recalculatePermissionDefaults (Permission & perm) = 0
Recalculates the defaults for the given Permission .
virtual void registerEvent (std::string event, std::function< void(Event &)> executor, EventPriority priority, Plugin & plugin, bool ignore_cancelled) = 0
Registers the given event.
virtual void registerLoader (std::unique_ptr< PluginLoader > loader) = 0
Registers the specified plugin loader.
virtual void removePermission (Permission & perm) = 0
Removes a Permission registration from this plugin manager.
virtual void removePermission (std::string name) = 0
Removes a Permission registration from this plugin manager.
virtual void subscribeToDefaultPerms (PermissionLevel level, Permissible & permissible) = 0
Subscribes to the given Default permissions by permission level.
virtual void subscribeToPermission (std::string permission, Permissible & permissible) = 0
Subscribes the given Permissible for information about the requestedPermission , by name.
virtual void unsubscribeFromDefaultPerms (PermissionLevel level, Permissible & permissible) = 0
Unsubscribes from the given Default permissions by permission level.
virtual void unsubscribeFromPermission (std::string permission, Permissible & permissible) = 0
Unsubscribes the given Permissible for information about the requestedPermission , by name.
virtual ~PluginManager () = default

Public Functions Documentation

function PluginManager [½]

endstone::PluginManager::PluginManager () = default

function PluginManager [2/2]

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

function addPermission

Adds a Permission to this plugin manager.

virtual Permission & endstone::PluginManager::addPermission (
    std::unique_ptr< Permission > perm
) = 0

Parameters:

Returns:

A reference to the newly added permission.

Exception:

  • std::runtime_error if a permission with the same name is already defined.

function callEvent

Calls an event which will be passed to plugins.

virtual void endstone::PluginManager::callEvent (
    Event & event
) = 0

Parameters:

  • event Event to be called

function clearPlugins

Disables and removes all plugins.

virtual void endstone::PluginManager::clearPlugins () = 0


function disablePlugin

Disables the specified plugin.

virtual void endstone::PluginManager::disablePlugin (
    Plugin & plugin
) = 0

Attempting to disable a plugin that is not enabled will have no effect.

Parameters:


function disablePlugins

Disables all the loaded plugins.

virtual void endstone::PluginManager::disablePlugins () = 0


function enablePlugin

Enables the specified plugin.

virtual void endstone::PluginManager::enablePlugin (
    Plugin & plugin
) const = 0

Attempting to enable a plugin that is already enabled will have no effect.

Parameters:


function enablePlugins

Enable all the loaded plugins.

virtual void endstone::PluginManager::enablePlugins () const = 0


function getDefaultPermSubscriptions

Gets a set containing all subscribed Permissibles to the given default list, by permission level.

virtual std::unordered_set< Permissible * > endstone::PluginManager::getDefaultPermSubscriptions (
    PermissionLevel level
) const = 0

Parameters:

  • level Default list to query for

Returns:

Set containing all subscribed permissions


function getDefaultPermissions

Gets the default permissions for the given permission level.

virtual std::vector< Permission * > endstone::PluginManager::getDefaultPermissions (
    PermissionLevel level
) const = 0

Parameters:

  • level Which set of default permissions to get

Returns:

The default permissions


function getPermission

Gets a Permission from its fully qualified name.

virtual Permission * endstone::PluginManager::getPermission (
    std::string name
) const = 0

Parameters:

  • name Name of the permission

Returns:

Permission, or nullptr if none


function getPermissionSubscriptions

Gets a set containing all subscribed Permissibles to the given permission, by name.

virtual std::unordered_set< Permissible * > endstone::PluginManager::getPermissionSubscriptions (
    std::string permission
) const = 0

Parameters:

Returns:

Set containing all subscribed permissions


function getPermissions

Gets a set of all registered permissions.

virtual std::unordered_set< Permission * > endstone::PluginManager::getPermissions () const = 0

This set is a copy and will not be modified live.

Returns:

Set containing all current registered permissions


function getPlugin

Checks if the given plugin is loaded and returns it when applicable.

virtual Plugin * endstone::PluginManager::getPlugin (
    const std::string & name
) const = 0

Please note that the name of the plugin is case-sensitive.

Parameters:

  • name Name of the plugin to check

Returns:

Plugin if it exists, otherwise nullptr


function getPlugins

Gets a list of all currently loaded plugins.

virtual std::vector< Plugin * > endstone::PluginManager::getPlugins () const = 0

Returns:

List of Plugins


function isPluginEnabled [½]

Checks if the given plugin is enabled or not.

virtual bool endstone::PluginManager::isPluginEnabled (
    const std::string & name
) const = 0

Please note that the name of the plugin is case-sensitive.

Parameters:

  • name Name of the plugin to check

Returns:

true if the plugin is enabled, otherwise false


function isPluginEnabled [2/2]

Checks if the given plugin is enabled or not.

virtual bool endstone::PluginManager::isPluginEnabled (
    Plugin * plugin
) const = 0

Parameters:

Returns:

true if the plugin is enabled, otherwise false


function loadPlugin

Loads the plugin in the specified file.

virtual Plugin * endstone::PluginManager::loadPlugin (
    std::string file
) = 0

File must be valid according to the current enabled Plugin interfaces

Parameters:

  • file File containing the plugin to load

Returns:

The Plugin loaded, or nullptr if it was invalid


function loadPlugins [½]

Loads the plugin contained within the specified directory.

virtual std::vector< Plugin * > endstone::PluginManager::loadPlugins (
    std::string directory
) = 0

Parameters:

  • directory Directory to check for plugins

Returns:

A list of all plugins loaded


function loadPlugins [2/2]

Loads the plugins in the list of the files.

virtual std::vector< Plugin * > endstone::PluginManager::loadPlugins (
    std::vector< std::string > files
) = 0

Parameters:

  • files List of files containing plugins to load

Returns:

A list of all plugins loaded


function operator=

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

function recalculatePermissionDefaults

Recalculates the defaults for the given Permission .

virtual void endstone::PluginManager::recalculatePermissionDefaults (
    Permission & perm
) = 0

This will have no effect if the specified permission is not registered here.

Parameters:


function registerEvent

Registers the given event.

virtual void endstone::PluginManager::registerEvent (
    std::string event,
    std::function< void ( Event &)> executor,
    EventPriority priority,
    Plugin & plugin,
    bool ignore_cancelled
) = 0

Parameters:

  • event Event name to register
  • executor EventExecutor to register
  • priority Priority of this event
  • plugin Plugin to register
  • ignore_cancelled Do not call executor if event was already cancelled

function registerLoader

Registers the specified plugin loader.

virtual void endstone::PluginManager::registerLoader (
    std::unique_ptr< PluginLoader > loader
) = 0

Parameters:


function removePermission [½]

Removes a Permission registration from this plugin manager.

virtual void endstone::PluginManager::removePermission (
    Permission & perm
) = 0

If the specified permission does not exist in this plugin manager, nothing will happen. Removing a permission registration will not remove the permission from any Permissibles that have it.

Parameters:


function removePermission [2/2]

Removes a Permission registration from this plugin manager.

virtual void endstone::PluginManager::removePermission (
    std::string name
) = 0

If the specified permission does not exist in this plugin manager, nothing will happen. Removing a permission registration will not remove the permission from any Permissibles that have it.

Parameters:


function subscribeToDefaultPerms

Subscribes to the given Default permissions by permission level.

virtual void endstone::PluginManager::subscribeToDefaultPerms (
    PermissionLevel level,
    Permissible & permissible
) = 0

If the specified defaults change in any form, the Permissible will be asked to recalculate.

Parameters:

  • level Default list to subscribe to
  • permissible Permissible subscribing

function subscribeToPermission

Subscribes the given Permissible for information about the requestedPermission , by name.

virtual void endstone::PluginManager::subscribeToPermission (
    std::string permission,
    Permissible & permissible
) = 0

If the specified Permission changes in any form, the Permissible will be asked to recalculate.

Parameters:


function unsubscribeFromDefaultPerms

Unsubscribes from the given Default permissions by permission level.

virtual void endstone::PluginManager::unsubscribeFromDefaultPerms (
    PermissionLevel level,
    Permissible & permissible
) = 0

Parameters:

  • level Default list to unsubscribe from
  • permissible Permissible subscribing

function unsubscribeFromPermission

Unsubscribes the given Permissible for information about the requestedPermission , by name.

virtual void endstone::PluginManager::unsubscribeFromPermission (
    std::string permission,
    Permissible & permissible
) = 0

Parameters:


function ~PluginManager

virtual endstone::PluginManager::~PluginManager () = default


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