Plugin
endstone.plugin
¶
Classes relating to loading and managing plugins.
Modules:
Name | Description |
---|---|
plugin_loader |
|
Classes:
Name | Description |
---|---|
Plugin |
Represents a Plugin |
PluginCommand |
Represents a Command belonging to a Plugin |
PluginLoadOrder |
Represents the order in which a plugin should be initialized and enabled. |
PluginLoader |
Represents a plugin loader, which handles direct access to specific types of plugins |
PluginManager |
Represents a plugin manager that handles all plugins from the Server |
Service |
Represents a list of methods. |
ServiceManager |
Represent a service manager that manages services and service providers. |
ServicePriority |
Represents various priorities of a provider. |
Plugin
¶
Bases: Plugin
Represents a Plugin
Methods:
Name | Description |
---|---|
get_command |
Gets the command with the given name, specific to this plugin. |
on_disable |
Called when this plugin is disabled |
on_enable |
Called when this plugin is enabled |
on_load |
Called after a plugin is loaded but before it has been enabled. |
register_events |
|
reload_config |
|
save_config |
|
save_default_config |
|
save_resources |
|
Attributes:
Name | Type | Description |
---|---|---|
api_version |
|
|
authors |
|
|
commands |
|
|
config |
dict
|
|
contributors |
|
|
data_folder |
Path
|
Returns the folder that the plugin data's files are located in. |
default_permission |
|
|
depend |
|
|
description |
|
|
is_enabled |
bool
|
Returns a value indicating whether this plugin is currently enabled |
load |
|
|
load_before |
|
|
logger |
Logger
|
Returns the plugin logger associated with this server's logger. |
name |
str
|
Returns the name of the plugin. |
permissions |
|
|
plugin_loader |
PluginLoader
|
Gets the associated PluginLoader responsible for this plugin |
prefix |
|
|
provides |
|
|
server |
Server
|
Returns the Server instance currently running this plugin |
soft_depend |
|
|
version |
|
|
website |
|
data_folder
property
¶
data_folder: Path
Returns the folder that the plugin data's files are located in.
is_enabled
property
¶
is_enabled: bool
Returns a value indicating whether this plugin is currently enabled
plugin_loader
property
¶
plugin_loader: PluginLoader
Gets the associated PluginLoader responsible for this plugin
get_command
¶
get_command(name: str) -> PluginCommand
Gets the command with the given name, specific to this plugin.
PluginCommand
¶
PluginCommand(
name: str,
description: str | None = None,
usages: list[str] | None = None,
aliases: list[str] | None = None,
permissions: list[str] | None = None,
*args,
**kwargs
)
Bases: Command
Represents a Command belonging to a Plugin
Attributes:
Name | Type | Description |
---|---|---|
executor |
CommandExecutor
|
The CommandExecutor to run when parsing this command |
plugin |
Plugin
|
The owner of this PluginCommand |
executor
property
writable
¶
executor: CommandExecutor
The CommandExecutor to run when parsing this command
PluginLoadOrder
¶
Bases: Enum
Represents the order in which a plugin should be initialized and enabled.
Attributes:
Name | Type | Description |
---|---|---|
POSTWORLD |
PluginLoadOrder
|
|
STARTUP |
PluginLoadOrder
|
|
PluginLoader
¶
PluginLoader(server: Server)
Represents a plugin loader, which handles direct access to specific types of plugins
Methods:
Name | Description |
---|---|
disable_plugin |
Disables the specified plugin |
enable_plugin |
Enables the specified plugin |
load_plugin |
Loads the plugin contained in the specified file |
load_plugins |
Loads the plugin contained within the specified directory |
Attributes:
Name | Type | Description |
---|---|---|
plugin_file_filters |
list[str]
|
Returns a list of all filename filters expected by this PluginLoader |
server |
Server
|
Retrieves the Server object associated with the PluginLoader. |
plugin_file_filters
property
¶
Returns a list of all filename filters expected by this PluginLoader
PluginManager
¶
Represents a plugin manager that handles all plugins from the Server
Methods:
Name | Description |
---|---|
call_event |
Calls an event which will be passed to plugins. |
clear_plugins |
Disables and removes all plugins |
disable_plugin |
Disables the specified plugin |
disable_plugins |
Disables all the loaded plugins |
enable_plugin |
Enables the specified plugin |
enable_plugins |
Enable all the loaded plugins |
get_default_perm_subscriptions |
Gets a set containing all subscribed Permissibles to the given default list, by permission level. |
get_default_permissions |
Gets the default permissions for the given permission level. |
get_permission |
Gets a Permission from its fully qualified name. |
get_permission_subscriptions |
Gets a set containing all subscribed Permissibles to the given permission. |
get_plugin |
Checks if the given plugin is loaded and returns it when applicable. |
is_plugin_enabled |
|
load_plugin |
Loads the plugin in the specified file |
load_plugins |
|
recalculate_permission_defaults |
Recalculates the defaults for the given Permission. |
register_event |
Registers the given event |
remove_permission |
|
subscribe_to_default_perms |
Subscribes to the given Default permissions by permission level. |
subscribe_to_permission |
Subscribes the given Permissible for information about the requested Permission. |
unsubscribe_from_default_perms |
Unsubscribes from the given Default permissions by permission level. |
unsubscribe_from_permission |
Unsubscribes the given Permissible for information about the requested Permission. |
Attributes:
Name | Type | Description |
---|---|---|
permissions |
set[Permission]
|
Gets a set of all registered permissions. |
plugins |
list[Plugin]
|
Gets a list of all currently loaded plugins |
get_default_perm_subscriptions
¶
get_default_perm_subscriptions(
level: PermissionLevel,
) -> set[Permissible]
Gets a set containing all subscribed Permissibles to the given default list, by permission level.
get_default_permissions
¶
get_default_permissions(
level: PermissionLevel,
) -> list[Permission]
Gets the default permissions for the given permission level.
get_permission
¶
get_permission(name: str) -> Permission
Gets a Permission from its fully qualified name.
get_permission_subscriptions
¶
get_permission_subscriptions(
permission: str,
) -> set[Permissible]
Gets a set containing all subscribed Permissibles to the given permission.
get_plugin
¶
Checks if the given plugin is loaded and returns it when applicable.
is_plugin_enabled
¶
Checks if the given plugin is enabled or not
Checks if the given plugin is enabled or not
load_plugins
¶
Loads the plugin contained within the specified directory
Loads the plugins in the list of the files
recalculate_permission_defaults
¶
recalculate_permission_defaults(perm: Permission) -> None
Recalculates the defaults for the given Permission.
register_event
¶
register_event(
name: str,
executor: Callable[[Event], None],
priority: EventPriority,
plugin: Plugin,
ignore_cancelled: bool,
) -> None
Registers the given event
remove_permission
¶
remove_permission(perm: Permission) -> None
Removes a Permission registration from this plugin manager by permission object.
remove_permission(name: str) -> None
Removes a Permission registration from this plugin manager by name.
subscribe_to_default_perms
¶
subscribe_to_default_perms(
level: PermissionLevel, permissible: Permissible
) -> None
Subscribes to the given Default permissions by permission level.
subscribe_to_permission
¶
subscribe_to_permission(
permission: str, permissible: Permissible
) -> None
Subscribes the given Permissible for information about the requested Permission.
unsubscribe_from_default_perms
¶
unsubscribe_from_default_perms(
level: PermissionLevel, permissible: Permissible
) -> None
Unsubscribes from the given Default permissions by permission level.
unsubscribe_from_permission
¶
unsubscribe_from_permission(
permission: str, permissible: Permissible
) -> None
Unsubscribes the given Permissible for information about the requested Permission.
ServiceManager
¶
Represent a service manager that manages services and service providers.
Methods:
Name | Description |
---|---|
load |
|
register |
Register a provider of a service. |
unregister |
|
unregister_all |
Unregister all the services registered by a particular plugin. |
ServicePriority
¶
Bases: IntEnum
Represents various priorities of a provider.
Attributes:
Name | Type | Description |
---|---|---|
HIGH |
ServicePriority
|
|
HIGHEST |
ServicePriority
|
|
LOW |
ServicePriority
|
|
LOWEST |
ServicePriority
|
|
NORMAL |
ServicePriority
|
|