Skip to Content
⚠ Under Construction
ReferenceC++ APIPluginManager

endstone::PluginManager

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

Functions:

PluginManager

PluginManager() = default
PluginManager(PluginManager const &) = delete

addPermission

Permission *addPermission(std::unique_ptr<Permission> perm)

Adds a Permission to this plugin manager.

Parameters:

Returns:

Permission, or nullptr if a permission is already defined with the given name of the new permission

callEvent

void callEvent(Event &event)

Calls an event which will be passed to plugins.

Parameters:

  • event Event to be called

clearPlugins

void clearPlugins()

Disables and removes all plugins

disablePlugin

void disablePlugin(Plugin &plugin)

Disables the specified plugin Attempting to disable a plugin that is not enabled will have no effect

Parameters:

disablePlugins

void disablePlugins()

Disables all the loaded plugins

enablePlugin

void enablePlugin(Plugin &plugin) const

Enables the specified plugin Attempting to enable a plugin that is already enabled will have no effect

Parameters:

enablePlugins

void enablePlugins() const

Enable all the loaded plugins

getDefaultPermSubscriptions

std::unordered_set<Permissible *> getDefaultPermSubscriptions(PermissionLevel level) const

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

Parameters:

  • level Default list to query for

Returns:

Set containing all subscribed permissions

getDefaultPermissions

std::vector<Permission *> getDefaultPermissions(PermissionLevel level) const

Gets the default permissions for the given permission level

Parameters:

  • level Which set of default permissions to get

Returns:

The default permissions

getPermission

Permission *getPermission(std::string name) const

Gets a Permission from its fully qualified name

Parameters:

  • name Name of the permission

Returns:

Permission, or null if none

getPermissionSubscriptions

std::unordered_set<Permissible *> getPermissionSubscriptions(std::string permission) const

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

Parameters:

Returns:

Set containing all subscribed permissions

getPermissions

std::unordered_set<Permission *> getPermissions() const

Gets a set of all registered permissions.

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

Returns:

Set containing all current registered permissions

getPlugin

Plugin *getPlugin(const std::string &name) const

Checks if the given plugin is loaded and returns it when applicable. 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

getPlugins

std::vector<Plugin *> getPlugins() const

Gets a list of all currently loaded plugins

Returns:

List of Plugins

isPluginEnabled

bool isPluginEnabled(const std::string &name) const

Checks if the given plugin is enabled or not 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

bool isPluginEnabled(Plugin *plugin) const

Checks if the given plugin is enabled or not

Parameters:

Returns:

true if the plugin is enabled, otherwise false

loadPlugin

Plugin *loadPlugin(std::string file)

Loads the plugin in the specified file

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

loadPlugins

std::vector<Plugin *> loadPlugins(std::string directory)

Loads the plugin contained within the specified directory

Parameters:

  • directory Directory to check for plugins

Returns:

A list of all plugins loaded

std::vector<Plugin *> loadPlugins(std::vector<std::string> files)

Loads the plugins in the list of the files

Parameters:

  • files List of files containing plugins to load

Returns:

A list of all plugins loaded

recalculatePermissionDefaults

void recalculatePermissionDefaults(Permission &perm)

Recalculates the defaults for the given Permission.

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

Parameters:

registerEvent

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

Registers the given event

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

registerLoader

void registerLoader(std::unique_ptr<PluginLoader> loader)

Registers the specified plugin loader

Parameters:

removePermission

void removePermission(Permission &perm)

Removes a Permission registration from this plugin manager.

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:

void removePermission(std::string name)

Removes a Permission registration from this plugin manager.

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:

subscribeToDefaultPerms

void subscribeToDefaultPerms(PermissionLevel level, Permissible &permissible)

Subscribes to the given Default permissions by permission level

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

subscribeToPermission

void subscribeToPermission(std::string permission, Permissible &permissible)

Subscribes the given Permissible for information about the requested Permission, by name. If the specified Permission changes in any form, the Permissible will be asked to recalculate.

Parameters:

unsubscribeFromDefaultPerms

void unsubscribeFromDefaultPerms(PermissionLevel level, Permissible &permissible)

Unsubscribes from the given Default permissions by permission level

Parameters:

  • level Default list to unsubscribe from
  • permissible Permissible subscribing

unsubscribeFromPermission

void unsubscribeFromPermission(std::string permission, Permissible &permissible)

Unsubscribes the given Permissible for information about the requested Permission, by name.

Parameters:

Last updated on