github DMedina559/bedrock-server-manager 4.0.0b1

pre-release3 hours ago

Try the new async version of Bedrock Server Manager now! This major release transitions BSM to a fully asynchronous architecture, introduces Pydantic V2 state management with transactional storage, adds live world backups & exports, and updates the plugin system for improved safety and performance.

Warning

Breaking Changes for Plugins

  • Plugins must migrate to async/await methods.
  • Direct app_context access has been restricted from plugins for isolation and security.
  • API methods with an _api suffix have been renamed to remove the suffix (e.g., self.api.add_server_ban_api ➔ self.api.add_server_ban).

⚠️ Breaking Changes & Plugin Migration Guide

1. Async / Await Methods

All core API calls and plugin lifecycle hooks/events are now asynchronous (async def). Plugins calling API methods must await their execution.

2. Renamed API Methods (_api Suffix Removed)

To streamline the API interface, method names ending in _api have been shortened:

  • start_server_api(...) ➔ start_server(...)
  • stop_server_api(...) ➔ stop_server(...)
  • get_settings_api(...) ➔ get_settings(...)
  • ...and all other domain API calls.

3. Restricted app_context Access

Plugins no longer have direct access to internal BSM app_context, state, or database internals. Instead, plugins interact with BSM through clean, scoped capability namespaces:

  • self.api.server: Server management operations (start, stop, restart, backup, etc.)
  • self.api.settings: Application and server configuration state
  • self.api.player: Player data and monitoring
    ...

💡 Plugin Migration Code Example

Before (v3.x - Synchronous & app_context / _api suffix):

from bedrock_server_manager.plugins import PluginBase

class MyPlugin(PluginBase):
    def on_enable(self):
        # Sync API call with _api suffix
        server_info = self.api.get_server_info_api("my-server")
        
        # Legacy direct app_context access
        settings = self.app_context.settings.get("general")
        
        # Sync server start
        self.api.start_server_api("my-server")

After (v4.0.0b1 - Asynchronous & Scoped Namespaces):

from bedrock_server_manager.plugins import PluginBase

class MyPlugin(PluginBase):
    async def on_enable(self):
        # Async API call using scoped namespace (no _api suffix)
        server_info = await self.api.server.get_server_info("my-server")
        
        # Scoped settings API access
        settings = await self.api.get_all_global_settings("general")
        
        # Async server start via scoped namespace
        await self.api.server.start_server("my-server")

🚀 Key Features & Architectural Upgrades

📦 Live World Backups & Exports

  • Perform world backups and export .mcworld files without taking the server process offline!
  • BSM uses Bedrock server CLI commands (save hold, save query, save resume) under the hood to ensure zero server downtime or play interruption during backups.

⚡ Async Core & Pydantic V2 State Management

  • Full Async Core: Bedrock process management, WebSockets, background tasks, and FastAPI endpoints run natively on the asyncio event loop.
  • Pydantic V2 State Models: Fast, typed in-memory state management via AppState (ServerState, PluginState, UserState, SettingsState).
  • Atomic Storage Persistence: Snapshot-based dirty tracking (Storage.apply_changeset / Storage.flush) ensures database transactions are atomic and isolated.

🔒 Enhanced Security & Isolation

  • Decoupled state and database access via specialized repositories (ServerRepository, PlayerRepository, UserRepository, AuditLogRepository, ServerBanRepository).
  • Optimized user authentication token verification using in-memory state lookups to prevent database lock contention.

What's Changed

⚠️ Breaking Changes

🚀 Features

⬆️ Dependencies

  • dep: update mysqlclient requirement from <2.3,>=2.2.7 to >=2.2.7,<2.4 by @dependabot[bot] in #407
  • dep: update uvicorn requirement from <0.53,>=0.35.0 to >=0.35.0,<0.54 by @dependabot[bot] in #406
  • dep: update httpx2 requirement from <2.13,>=2.5.0 to >=2.5.0,<2.14 by @dependabot[bot] in #405
  • dep: update alembic requirement from <1.20,>=1.16 to >=1.16,<1.21 by @dependabot[bot] in #403
  • dep: update bsm-test-utils requirement from <0.2,>=0.1.0b2 to >=0.1.0b2,<1.1 by @dependabot[bot] in #409
  • dep: update types-aiofiles requirement from <24.2,>=24.1.0 to >=24.1.0,<25.2 by @dependabot[bot] in #410

Full Changelog: 3.10.6...4.0.0b1

Don't miss a new bedrock-server-manager release

NewReleases is sending notifications on new releases.