Application API Documentation

Provides API functions for application-wide information and actions.

This module offers endpoints to retrieve general details about the Bedrock Server Manager application itself and to perform operations that span across multiple server instances. It primarily interfaces with the BedrockServerManager core class.

Key functionalities include:

These functions are exposed to the plugin system via plugin_method() and are intended for use by UIs, CLIs, or other high-level components.

bedrock_server_manager.api.application.get_application_info_api(settings=None, app_context: AppContext | None = None) Dict[str, Any]

Retrieves general information about the application.

Accesses properties from the global BedrockServerManager instance.

Returns:

A dictionary with the operation result. On success: {"status": "success", "data": ApplicationInfoDict} where ApplicationInfoDict contains keys like: "application_name" (str), "version" (str), "os_type" (str), "base_directory" (str, path to servers), "content_directory" (str, path to global content), "config_directory" (str, path to app config). On error (unexpected): {"status": "error", "message": "<error_message>"}.

Return type:

Dict[str, Any]

bedrock_server_manager.api.application.list_available_worlds_api(settings=None, app_context: AppContext | None = None) Dict[str, Any]

Lists available .mcworld files from the content directory.

Calls list_available_worlds() to scan the worlds sub-folder within the application’s global content directory.

Returns:

A dictionary with the operation result. On success: {"status": "success", "files": List[str]} where files is a list of absolute paths to .mcworld files. On error: {"status": "error", "message": "<error_message>"}.

Return type:

Dict[str, Any]

Raises:

FileError – If the content directory is not configured or accessible.

bedrock_server_manager.api.application.list_available_addons_api(settings=None, app_context: AppContext | None = None) Dict[str, Any]

Lists available .mcaddon and .mcpack files from the content directory.

Calls list_available_addons() to scan the addons sub-folder within the application’s global content directory.

Returns:

A dictionary with the operation result. On success: {"status": "success", "files": List[str]} where files is a list of absolute paths to .mcaddon or .mcpack files. On error: {"status": "error", "message": "<error_message>"}.

Return type:

Dict[str, Any]

Raises:

FileError – If the content directory is not configured or accessible.

bedrock_server_manager.api.application.get_all_servers_data(settings=None, app_context: AppContext | None = None) Dict[str, Any]

Retrieves status and version for all detected servers.

This function acts as an API orchestrator, calling the core get_servers_data() to gather data from all individual server instances. It can handle partial failures, where data for some servers is retrieved successfully while others fail (errors for individual servers are included in the message). The status of each server is also reconciled with its live state during this call.

Returns:

A dictionary with the operation result.

On full success (all servers processed without error):

{"status": "success", "servers": List[ServerDataDict]}

On partial success (some individual server errors occurred during scan):

{"status": "success", "servers": List[ServerDataDict], "message": "Completed with errors: <details>"} The servers list contains data for successfully processed servers.

On total failure (e.g., cannot access base server directory):

{"status": "error", "message": "<error_message>"}

Each ServerDataDict contains keys like “name”, “status”, “version”.

Return type:

Dict[str, Any]

Raises:

BSMError – If there’s a fundamental issue accessing the base server directory (e.g., AppFileNotFoundError).