endstone::PluginManager
Represents a plugin manager that handles all plugins from the Server .
Functions:
PluginManager
PluginManager() = defaultPluginManager(PluginManager const &) = delete addPermission
Permission *addPermission(std::unique_ptr<Permission> perm)Adds a Permission to this plugin manager.
Parameters:
permPermission to add
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:
eventEvent 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:
pluginPlugin to disable
disablePlugins
void disablePlugins()Disables all the loaded plugins
enablePlugin
void enablePlugin(Plugin &plugin) constEnables the specified plugin Attempting to enable a plugin that is already enabled will have no effect
Parameters:
pluginPlugin to enable
enablePlugins
void enablePlugins() constEnable all the loaded plugins
getDefaultPermSubscriptions
std::unordered_set<Permissible *>
getDefaultPermSubscriptions(PermissionLevel level) constGets a set containing all subscribed Permissibles to the given default list, by permission level
Parameters:
levelDefault list to query for
Returns:
Set containing all subscribed permissions
getDefaultPermissions
std::vector<Permission *> getDefaultPermissions(PermissionLevel level) constGets the default permissions for the given permission level
Parameters:
levelWhich set of default permissions to get
Returns:
The default permissions
getPermission
Permission *getPermission(std::string name) constGets a Permission from its fully qualified name
Parameters:
nameName of the permission
Returns:
Permission, or null if none
getPermissionSubscriptions
std::unordered_set<Permissible *>
getPermissionSubscriptions(std::string permission) constGets a set containing all subscribed Permissibles to the given permission, by name
Parameters:
permissionPermission to query for
Returns:
Set containing all subscribed permissions
getPermissions
std::unordered_set<Permission *> getPermissions() constGets 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) constChecks if the given plugin is loaded and returns it when applicable. Please note that the name of the plugin is case-sensitive
Parameters:
nameName of the plugin to check
Returns:
Plugin if it exists, otherwise nullptr
getPlugins
std::vector<Plugin *> getPlugins() constGets a list of all currently loaded plugins
Returns:
List of Plugins
isPluginEnabled
bool isPluginEnabled(const std::string &name) constChecks if the given plugin is enabled or not Please note that the name of the plugin is case-sensitive.
Parameters:
nameName of the plugin to check
Returns:
true if the plugin is enabled, otherwise false
bool isPluginEnabled(Plugin *plugin) constChecks if the given plugin is enabled or not
Parameters:
pluginPlugin to check
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:
fileFile 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:
directoryDirectory 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:
filesList 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:
permPermission to recalculate
registerEvent
void registerEvent(std::string event, std::function<void(Event &)> executor,
EventPriority priority, Plugin &plugin,
bool ignore_cancelled)Registers the given event
Parameters:
eventEvent name to registerexecutorEventExecutor to registerpriorityPriority of this eventpluginPlugin to registerignore_cancelledDo not call executor if event was already cancelled
registerLoader
void registerLoader(std::unique_ptr<PluginLoader> loader)Registers the specified plugin loader
Parameters:
loaderPluginLoader to register
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:
permPermission to remove
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:
namePermission to remove
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:
levelDefault list to subscribe topermissiblePermissible 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:
permissionPermission to subscribe topermissiblePermissible subscribing
unsubscribeFromDefaultPerms
void unsubscribeFromDefaultPerms(PermissionLevel level,
Permissible &permissible)Unsubscribes from the given Default permissions by permission level
Parameters:
levelDefault list to unsubscribe frompermissiblePermissible subscribing
unsubscribeFromPermission
void unsubscribeFromPermission(std::string permission, Permissible &permissible)Unsubscribes the given Permissible for information about the requested Permission, by name.
Parameters:
permissionPermission to unsubscribe frompermissiblePermissible subscribing