[{"data":1,"prerenderedAt":256},["ShallowReactive",2],{"docs-\u002Fgetting-started\u002Fquickstart":3},{"id":4,"title":5,"body":6,"description":246,"extension":247,"meta":248,"navTitle":249,"navigation":250,"path":251,"rawbody":252,"seo":253,"stem":254,"__hash__":255},"docs\u002Fgetting-started\u002Fquickstart.md","Quickstart",{"type":7,"value":8,"toc":235},"minimark",[9,13,36,47,62,67,77,101,105,111,116,120,126,135,139,150,156,164,168,178,184,187,191,197,203,207],[10,11,5],"h1",{"id":12},"quickstart",[14,15,16,17,21,22,21,25,28,29,21,32,35],"p",{},"The recommended path is bootstrap-first: use the platform bootstrap helper, keep\nthe returned runtime handle, and close it when the platform shuts down. Every\nplatform has one (",[18,19,20],"code",{},"BukkitBootstrap",", ",[18,23,24],{},"BungeeBootstrap",[18,26,27],{},"VelocityBootstrap",",\n",[18,30,31],{},"FabricBootstrap",[18,33,34],{},"NeoForgeBootstrap",").",[14,37,38,39,42,43,46],{},"If most of your logic lives directly in ",[18,40,41],{},"magicutils-core",", keep the platform\nentrypoint thin and move the shared services behind ",[18,44,45],{},"MagicRuntime",".",[14,48,49,50,53,54,57,58,61],{},"That does not mean ",[18,51,52],{},"common"," should call ",[18,55,56],{},"forPlugin(...)"," or ",[18,59,60],{},"forMod(...)",".\nThose bootstrap helpers stay in the platform module, which then hands the\nruntime into shared code.",[63,64,66],"h2",{"id":65},"bukkitpaper","Bukkit\u002FPaper",[68,69,75],"pre",{"className":70,"code":72,"language":73,"meta":74},[71],"language-java","public final class MyPlugin extends JavaPlugin {\n    private BukkitBootstrap.RuntimeResult magic;\n\n    @Override\n    public void onEnable() {\n        magic = BukkitBootstrap.forPlugin(this)\n                .enableCommands()\n                .configureCommands(registry -> registry.registerCommand(new ExampleCommand()))\n                .buildRuntime();\n\n        magic.logger().info(\"Ready.\");\n    }\n\n    @Override\n    public void onDisable() {\n        if (magic != null) {\n            magic.runtime().close();\n            magic = null;\n        }\n    }\n}\n","java","",[18,76,72],{"__ignoreMap":74},[14,78,79,81,82,21,85,21,88,28,91,21,94,97,98,46],{},[18,80,20],{}," wires ",[18,83,84],{},"Platform",[18,86,87],{},"ConfigManager",[18,89,90],{},"Logger",[18,92,93],{},"LanguageManager",[18,95,96],{},"Messages",", and an optional ",[18,99,100],{},"CommandRegistry",[63,102,104],{"id":103},"fabric","Fabric",[68,106,109],{"className":107,"code":108,"language":73,"meta":74},[71],"public final class MyMod implements ModInitializer {\n    private static final String MOD_ID = \"mymod\";\n\n    private MinecraftServer server;\n    private FabricBootstrap.RuntimeResult magic;\n\n    @Override\n    public void onInitialize() {\n        magic = FabricBootstrap.forMod(MOD_ID, () -> server)\n                .enableCommands()\n                .buildRuntime();\n\n        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {\n            if (magic.commandRegistry() != null) {\n                magic.commandRegistry().registerCommand(dispatcher, new ExampleCommand());\n            }\n        });\n\n        ServerLifecycleEvents.SERVER_STARTED.register(server -> this.server = server);\n        ServerLifecycleEvents.SERVER_STOPPING.register(server -> {\n            this.server = null;\n            if (magic != null) {\n                magic.runtime().close();\n                magic = null;\n            }\n        });\n    }\n}\n",[18,110,108],{"__ignoreMap":74},[14,112,113,115],{},[18,114,31],{}," sets up the shared services early, while actual command\nregistration still happens inside Fabric's Brigadier callback.",[63,117,119],{"id":118},"velocity","Velocity",[68,121,124],{"className":122,"code":123,"language":73,"meta":74},[71],"@Plugin(id = \"myplugin\", name = \"MyPlugin\", version = \"1.0.0\")\npublic final class MyPlugin {\n    private final ProxyServer proxy;\n    private final org.slf4j.Logger slf4j;\n    private final Path dataDirectory;\n    private VelocityBootstrap.RuntimeResult magic;\n\n    @Inject\n    public MyPlugin(ProxyServer proxy,\n                    org.slf4j.Logger slf4j,\n                    @DataDirectory Path dataDirectory) {\n        this.proxy = proxy;\n        this.slf4j = slf4j;\n        this.dataDirectory = dataDirectory;\n    }\n\n    @Subscribe\n    public void onProxyInitialize(ProxyInitializeEvent event) {\n        magic = VelocityBootstrap.forPlugin(proxy, this, \"MyPlugin\", dataDirectory)\n                .slf4j(slf4j)\n                .enableCommands()\n                .configureCommands(registry -> registry.registerCommand(new ExampleCommand()))\n                .buildRuntime();\n\n        magic.logger().info(\"Ready.\");\n    }\n\n    @Subscribe\n    public void onProxyShutdown(ProxyShutdownEvent event) {\n        if (magic != null) {\n            magic.runtime().close();\n            magic = null;\n        }\n    }\n}\n",[18,125,123],{"__ignoreMap":74},[14,127,128,130,131,134],{},[18,129,27],{}," creates a managed ",[18,132,133],{},"LoggerCore",", registers shutdown cleanup,\nand can wire the Velocity command registry for you.",[63,136,138],{"id":137},"neoforge","NeoForge",[14,140,141,142,145,146,149],{},"NeoForge is bootstrap-first too, via ",[18,143,144],{},"NeoForgeBootstrap.forMod(...)",". Pass a\nsupplier for the current ",[18,147,148],{},"MinecraftServer"," so the runtime can resolve it lazily.",[68,151,154],{"className":152,"code":153,"language":73,"meta":74},[71],"@Mod(\"mymod\")\npublic final class MyMod {\n    private MinecraftServer server;\n    private NeoForgeBootstrap.RuntimeResult magic;\n\n    public MyMod() {\n        magic = NeoForgeBootstrap.forMod(\"mymod\", () -> server)\n                .enableCommands()\n                .buildRuntime();\n\n        magic.logger().info(\"Ready.\");\n    }\n\n    @SubscribeEvent\n    public void onServerStarting(ServerStartingEvent event) {\n        this.server = event.getServer();\n    }\n\n    @SubscribeEvent\n    public void onRegisterCommands(RegisterCommandsEvent event) {\n        if (magic.commandRegistry() != null) {\n            magic.commandRegistry().registerCommand(event.getDispatcher(), new ExampleCommand());\n        }\n    }\n}\n",[18,155,153],{"__ignoreMap":74},[14,157,158,159,163],{},"See ",[160,161,138],"a",{"href":162},"..\u002Fplatforms\u002Fneoforge"," for options and manual wiring as an\nalternative.",[63,165,167],{"id":166},"using-the-runtime-handle","Using The Runtime Handle",[14,169,170,171,174,175,177],{},"Every ",[18,172,173],{},"buildRuntime()"," call returns ",[18,176,45],{},", which exposes the shared\nservices as typed components:",[68,179,182],{"className":180,"code":181,"language":73,"meta":74},[71],"MagicRuntime runtime = magic.runtime();\nConfigManager configManager = runtime.requireComponent(ConfigManager.class);\nLoggerCore logger = runtime.requireComponent(LoggerCore.class);\nLanguageManager languages = runtime.findComponent(LanguageManager.class).orElse(null);\n",[18,183,181],{"__ignoreMap":74},[14,185,186],{},"Use named resources and config bindings when you want runtime-managed clients or\nother reloadable services.",[63,188,190],{"id":189},"core-common-logic","Core \u002F Common Logic",[14,192,193,194,196],{},"If your plugin or mod is mostly shared logic plus a thin platform bootstrap,\nkeep the common layer built around ",[18,195,45],{}," and platform-agnostic\nservices.",[14,198,158,199,202],{},[160,200,190],{"href":201},"..\u002Fplatforms\u002Fcore"," for the recommended split\nbetween platform glue and shared code.",[63,204,206],{"id":205},"next-steps","Next Steps",[208,209,210,214,217,220,226,229],"ul",{},[211,212,213],"li",{},"Pick the modules you need from the Modules section.",[211,215,216],{},"Use the platform pages for more detailed bootstrap notes.",[211,218,219],{},"Use the Core \u002F Common Logic page for shared\u002Fcommon module structure.",[211,221,222,223,225],{},"Read the Runtime guide for ",[18,224,45],{},", managed resources, and config bindings.",[211,227,228],{},"Use the Migration guide if you are moving from older manual wiring examples.",[211,230,231,232,234],{},"See the HTTP client page for ",[18,233,45],{},"-bound profiles.",{"title":74,"searchDepth":236,"depth":236,"links":237},3,[238,240,241,242,243,244,245],{"id":65,"depth":239,"text":66},2,{"id":103,"depth":239,"text":104},{"id":118,"depth":239,"text":119},{"id":137,"depth":239,"text":138},{"id":166,"depth":239,"text":167},{"id":189,"depth":239,"text":190},{"id":205,"depth":239,"text":206},"Get MagicUtils running fast with the bootstrap-first setup: create a MagicRuntime, wire config, logger, lang, and commands, then close it on shutdown.","md",{},null,true,"\u002Fgetting-started\u002Fquickstart","---\ntitle: Quickstart\ndescription: 'Get MagicUtils running fast with the bootstrap-first setup: create a MagicRuntime, wire config, logger, lang, and commands, then close it on shutdown.'\n---\n\n# Quickstart\n\nThe recommended path is bootstrap-first: use the platform bootstrap helper, keep\nthe returned runtime handle, and close it when the platform shuts down. Every\nplatform has one (`BukkitBootstrap`, `BungeeBootstrap`, `VelocityBootstrap`,\n`FabricBootstrap`, `NeoForgeBootstrap`).\n\nIf most of your logic lives directly in `magicutils-core`, keep the platform\nentrypoint thin and move the shared services behind `MagicRuntime`.\n\nThat does not mean `common` should call `forPlugin(...)` or `forMod(...)`.\nThose bootstrap helpers stay in the platform module, which then hands the\nruntime into shared code.\n\n## Bukkit\u002FPaper\n\n```java\npublic final class MyPlugin extends JavaPlugin {\n    private BukkitBootstrap.RuntimeResult magic;\n\n    @Override\n    public void onEnable() {\n        magic = BukkitBootstrap.forPlugin(this)\n                .enableCommands()\n                .configureCommands(registry -> registry.registerCommand(new ExampleCommand()))\n                .buildRuntime();\n\n        magic.logger().info(\"Ready.\");\n    }\n\n    @Override\n    public void onDisable() {\n        if (magic != null) {\n            magic.runtime().close();\n            magic = null;\n        }\n    }\n}\n```\n\n`BukkitBootstrap` wires `Platform`, `ConfigManager`, `Logger`,\n`LanguageManager`, `Messages`, and an optional `CommandRegistry`.\n\n## Fabric\n\n```java\npublic final class MyMod implements ModInitializer {\n    private static final String MOD_ID = \"mymod\";\n\n    private MinecraftServer server;\n    private FabricBootstrap.RuntimeResult magic;\n\n    @Override\n    public void onInitialize() {\n        magic = FabricBootstrap.forMod(MOD_ID, () -> server)\n                .enableCommands()\n                .buildRuntime();\n\n        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {\n            if (magic.commandRegistry() != null) {\n                magic.commandRegistry().registerCommand(dispatcher, new ExampleCommand());\n            }\n        });\n\n        ServerLifecycleEvents.SERVER_STARTED.register(server -> this.server = server);\n        ServerLifecycleEvents.SERVER_STOPPING.register(server -> {\n            this.server = null;\n            if (magic != null) {\n                magic.runtime().close();\n                magic = null;\n            }\n        });\n    }\n}\n```\n\n`FabricBootstrap` sets up the shared services early, while actual command\nregistration still happens inside Fabric's Brigadier callback.\n\n## Velocity\n\n```java\n@Plugin(id = \"myplugin\", name = \"MyPlugin\", version = \"1.0.0\")\npublic final class MyPlugin {\n    private final ProxyServer proxy;\n    private final org.slf4j.Logger slf4j;\n    private final Path dataDirectory;\n    private VelocityBootstrap.RuntimeResult magic;\n\n    @Inject\n    public MyPlugin(ProxyServer proxy,\n                    org.slf4j.Logger slf4j,\n                    @DataDirectory Path dataDirectory) {\n        this.proxy = proxy;\n        this.slf4j = slf4j;\n        this.dataDirectory = dataDirectory;\n    }\n\n    @Subscribe\n    public void onProxyInitialize(ProxyInitializeEvent event) {\n        magic = VelocityBootstrap.forPlugin(proxy, this, \"MyPlugin\", dataDirectory)\n                .slf4j(slf4j)\n                .enableCommands()\n                .configureCommands(registry -> registry.registerCommand(new ExampleCommand()))\n                .buildRuntime();\n\n        magic.logger().info(\"Ready.\");\n    }\n\n    @Subscribe\n    public void onProxyShutdown(ProxyShutdownEvent event) {\n        if (magic != null) {\n            magic.runtime().close();\n            magic = null;\n        }\n    }\n}\n```\n\n`VelocityBootstrap` creates a managed `LoggerCore`, registers shutdown cleanup,\nand can wire the Velocity command registry for you.\n\n## NeoForge\n\nNeoForge is bootstrap-first too, via `NeoForgeBootstrap.forMod(...)`. Pass a\nsupplier for the current `MinecraftServer` so the runtime can resolve it lazily.\n\n```java\n@Mod(\"mymod\")\npublic final class MyMod {\n    private MinecraftServer server;\n    private NeoForgeBootstrap.RuntimeResult magic;\n\n    public MyMod() {\n        magic = NeoForgeBootstrap.forMod(\"mymod\", () -> server)\n                .enableCommands()\n                .buildRuntime();\n\n        magic.logger().info(\"Ready.\");\n    }\n\n    @SubscribeEvent\n    public void onServerStarting(ServerStartingEvent event) {\n        this.server = event.getServer();\n    }\n\n    @SubscribeEvent\n    public void onRegisterCommands(RegisterCommandsEvent event) {\n        if (magic.commandRegistry() != null) {\n            magic.commandRegistry().registerCommand(event.getDispatcher(), new ExampleCommand());\n        }\n    }\n}\n```\n\nSee [NeoForge](..\u002Fplatforms\u002Fneoforge.md) for options and manual wiring as an\nalternative.\n\n## Using The Runtime Handle\n\nEvery `buildRuntime()` call returns `MagicRuntime`, which exposes the shared\nservices as typed components:\n\n```java\nMagicRuntime runtime = magic.runtime();\nConfigManager configManager = runtime.requireComponent(ConfigManager.class);\nLoggerCore logger = runtime.requireComponent(LoggerCore.class);\nLanguageManager languages = runtime.findComponent(LanguageManager.class).orElse(null);\n```\n\nUse named resources and config bindings when you want runtime-managed clients or\nother reloadable services.\n\n## Core \u002F Common Logic\n\nIf your plugin or mod is mostly shared logic plus a thin platform bootstrap,\nkeep the common layer built around `MagicRuntime` and platform-agnostic\nservices.\n\nSee [Core \u002F Common Logic](..\u002Fplatforms\u002Fcore.md) for the recommended split\nbetween platform glue and shared code.\n\n## Next Steps\n\n- Pick the modules you need from the Modules section.\n- Use the platform pages for more detailed bootstrap notes.\n- Use the Core \u002F Common Logic page for shared\u002Fcommon module structure.\n- Read the Runtime guide for `MagicRuntime`, managed resources, and config bindings.\n- Use the Migration guide if you are moving from older manual wiring examples.\n- See the HTTP client page for `MagicRuntime`-bound profiles.\n",{"title":5,"description":246},"getting-started\u002Fquickstart","ZA7cDkvF0a6abFVNIrLwnlhDju-vVgG3sg7gUMgLPnE",1783944486445]