Skip to content

feat(plugin): implement load and unload functionality for plugins - #477

Open
MengHanLOVE1027 wants to merge 3 commits into
EndstoneMC:developfrom
MengHanLOVE1027:refactor/plugin-load-unload-reload
Open

feat(plugin): implement load and unload functionality for plugins#477
MengHanLOVE1027 wants to merge 3 commits into
EndstoneMC:developfrom
MengHanLOVE1027:refactor/plugin-load-unload-reload

Conversation

@MengHanLOVE1027

@MengHanLOVE1027 MengHanLOVE1027 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Adds runtime per-plugin load, unload and reload commands, so operators can swap
a single plugin without a full server reload. Works for both C++ and Python plugins.

Changes

  • Added /load <plugin> — loads and enables a single plugin by name.
  • Added /unload <plugin> — disables and unloads a single plugin.
  • Added /reload <plugin> — reloads a single plugin (unload + load).
  • /load with no arguments loads all plugins; /unload with no arguments unloads all.
  • Plugin names resolve against the plugins/ directory (case-sensitive):
    .dll/.so files strip the endstone_ prefix, .whl files resolve the distribution name.
  • Unloading a plugin that another loaded plugin hard-depends on is refused and
    reported to the sender. The force parameter is reserved in the API for future use.
  • New permission nodes: endstone.command.load, endstone.command.unload.
  • Refactored reload() into reusable unloadAllPlugins() / loadAllPlugins().

API

  • PluginManager::unloadPlugin(const std::string &name, bool force = false)
  • PluginLoader::unloadPlugin(Plugin &plugin) (default no-op)

Both are additive and non-breaking.

Motivation

Lets operators hot-swap a single plugin during development or debugging without
restarting the whole server, and complements the existing full reload.

Testing (not finish yet)

  • Built successfully (clang-cl / clang++)
  • Manual: /unload removes the plugin and its commands; /load restores them
image image
  • C++ plugin DLL is released on unload and can be reloaded
  • Python plugin: sys.modules cleared so a reloaded plugin picks up new code
  • Dependency refusal: /unload B is rejected while plugin A hard-depends on B
  • reload (full reload) still works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant