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:
perm
Permission 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:
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:
plugin
Plugin to disable
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:
plugin
Plugin to enable
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:
permission
Permission to query for
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:
plugin
Plugin 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:
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:
perm
Permission 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:
event
Event name to registerexecutor
EventExecutor to registerpriority
Priority of this eventplugin
Plugin to registerignore_cancelled
Do not call executor if event was already cancelled
registerLoader
void registerLoader(std::unique_ptr<PluginLoader> loader)
Registers the specified plugin loader
Parameters:
loader
PluginLoader 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:
perm
Permission 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:
name
Permission 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:
level
Default list to subscribe topermissible
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:
permission
Permission to subscribe topermissible
Permissible subscribing
unsubscribeFromDefaultPerms
void unsubscribeFromDefaultPerms(PermissionLevel level,
Permissible &permissible)
Unsubscribes from the given Default permissions by permission level
Parameters:
level
Default list to unsubscribe frompermissible
Permissible subscribing
unsubscribeFromPermission
void unsubscribeFromPermission(std::string permission, Permissible &permissible)
Unsubscribes the given Permissible for information about the requested Permission, by name.
Parameters:
permission
Permission to unsubscribe frompermissible
Permissible subscribing