Skip to content

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

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

api_version class-attribute instance-attribute

api_version = None

authors class-attribute instance-attribute

authors = None

commands class-attribute instance-attribute

commands = None

config property

config: dict

contributors class-attribute instance-attribute

contributors = None

data_folder property

data_folder: Path

Returns the folder that the plugin data's files are located in.

default_permission class-attribute instance-attribute

default_permission = None

depend class-attribute instance-attribute

depend = None

description class-attribute instance-attribute

description = None

is_enabled property

is_enabled: bool

Returns a value indicating whether this plugin is currently enabled

load class-attribute instance-attribute

load = None

load_before class-attribute instance-attribute

load_before = None

logger property

logger: Logger

Returns the plugin logger associated with this server's logger.

name property

name: str

Returns the name of the plugin.

permissions class-attribute instance-attribute

permissions = None

plugin_loader property

plugin_loader: PluginLoader

Gets the associated PluginLoader responsible for this plugin

prefix class-attribute instance-attribute

prefix = None

provides class-attribute instance-attribute

provides = None

server property

server: Server

Returns the Server instance currently running this plugin

soft_depend class-attribute instance-attribute

soft_depend = None

version class-attribute instance-attribute

version = None

website class-attribute instance-attribute

website = None

get_command

get_command(name: str) -> PluginCommand

Gets the command with the given name, specific to this plugin.

on_disable

on_disable() -> None

Called when this plugin is disabled

on_enable

on_enable() -> None

Called when this plugin is enabled

on_load

on_load() -> None

Called after a plugin is loaded but before it has been enabled.

register_events

register_events(listener: object) -> None

reload_config

reload_config() -> dict

save_config

save_config() -> None

save_default_config

save_default_config() -> None

save_resources

save_resources(path: str, replace: bool = False) -> None

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

plugin property

plugin: Plugin

The owner of this PluginCommand

PluginLoadOrder

Bases: Enum

Represents the order in which a plugin should be initialized and enabled.

Attributes:

Name Type Description
POSTWORLD PluginLoadOrder
STARTUP PluginLoadOrder

POSTWORLD class-attribute

POSTWORLD: PluginLoadOrder

STARTUP class-attribute

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

plugin_file_filters: list[str]

Returns a list of all filename filters expected by this PluginLoader

server property

server: Server

Retrieves the Server object associated with the PluginLoader.

disable_plugin

disable_plugin(plugin: Plugin) -> None

Disables the specified plugin

enable_plugin

enable_plugin(plugin: Plugin) -> None

Enables the specified plugin

load_plugin

load_plugin(file: str) -> Plugin

Loads the plugin contained in the specified file

load_plugins

load_plugins(directory: str) -> list[Plugin]

Loads the plugin contained within the specified directory

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

permissions property

permissions: set[Permission]

Gets a set of all registered permissions.

plugins property

plugins: list[Plugin]

Gets a list of all currently loaded plugins

call_event

call_event(event: Event) -> None

Calls an event which will be passed to plugins.

clear_plugins

clear_plugins() -> None

Disables and removes all plugins

disable_plugin

disable_plugin(plugin: Plugin) -> None

Disables the specified plugin

disable_plugins

disable_plugins() -> None

Disables all the loaded plugins

enable_plugin

enable_plugin(plugin: Plugin) -> None

Enables the specified plugin

enable_plugins

enable_plugins() -> None

Enable all the 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

get_plugin(name: str) -> Plugin

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

is_plugin_enabled

is_plugin_enabled(plugin: str) -> bool

Checks if the given plugin is enabled or not

is_plugin_enabled(plugin: Plugin) -> bool

Checks if the given plugin is enabled or not

load_plugin

load_plugin(file: str) -> Plugin

Loads the plugin in the specified file

load_plugins

load_plugins(directory: str) -> list[Plugin]

Loads the plugin contained within the specified directory

load_plugins(files: list[str]) -> list[Plugin]

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.

Service

Service()

Represents a list of methods.

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.

load

load(name: str) -> Service

register

register(
    name: str,
    provider: Service,
    plugin: Plugin,
    priority: ServicePriority,
) -> None

Register a provider of a service.

unregister

unregister(name: str, provider: Service) -> None

Unregister a particular provider for a particular service.

unregister(provider: Service) -> None

Unregister a particular provider.

unregister_all

unregister_all(plugin: Plugin) -> None

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

HIGH class-attribute

HIGHEST class-attribute

HIGHEST: ServicePriority

LOW class-attribute

LOWEST class-attribute

NORMAL class-attribute