Migration Guide
This page shows how to move from the older manual wiring style to the current bootstrap-first setup.
1. Manual Bootstrap -> buildRuntime()
Bukkit/Paper
Before:
After:
What you gain:
- one managed shutdown handle
- consistent logger/lang/messages wiring
- optional command registry integration
- easy access through
MagicRuntime
Fabric
Before:
After:
Important: Fabric command registration still happens inside
CommandRegistrationCallback.EVENT.
Velocity
Before:
After:
2. initialize(...) -> Explicit Registry Or Bootstrap
Older code often used the static default registry:
Preferred now:
Or through bootstrap:
Why prefer this:
- easier testing
- fewer hidden globals
- clearer ownership in multi-plugin or multi-mod setups
3. CommandSpec.builder(...) -> MagicCommand.builder(...)
Older builder-based command code often produced a detached spec:
Preferred now:
This matters because builder-authored commands are now real MagicCommand
instances. They can use the same runtime adaptation API as annotation-based
commands:
withName(...)addAlias(...)addSubCommand(...)setExecute(...)mount(existingCommand)
registerSpec(...) still works for migration, but it is now the compatibility
path rather than the primary one.
4. Ad-Hoc Reload Logic -> MagicRuntime Bindings
Older reload code often looked like this:
Preferred now:
Or use the higher-level profile wrapper:
5. Manual Shutdown -> One Runtime Close
Before:
After:
That only works when the services were created through bootstrap or registered inside the runtime.
6. When Not To Migrate
Keep the manual style when:
- you are integrating MagicUtils into an unusual platform
- you need partial module wiring without the bootstrap defaults
- you intentionally manage service lifecycles yourself
Even in those cases, MagicRuntime is still useful as a local lifecycle
container.