Build Your First Plugin
Build a SoulFire plugin from the official template and load it as a Fabric mod.
This guide builds a plugin that SoulFire can load. The official template already contains the required Fabric, Loom, and SoulFire setup.
The official template repository is SoulFirePluginExample. Use it as your starting template. Then compare it with the current Javadocs and current SoulFire source for low-level APIs.
If you are new to Fabric itself, keep Fabric Documentation open too.
Before you start
- Install Java 25.
- Install Git.
- Use IntelliJ IDEA for Fabric Loom, Mixins, and Java plugin work.
- Have a working SoulFire install where you can test jars in
minecraft/mods.
Success criteria
At the end of this guide, you will have:
- a plugin project cloned from the template
- a
ModInitializerthat registers yourExternalPlugin - a built jar in
build/libs - a jar that loads from SoulFire's
minecraft/modsdirectory
Create the project
Clone the template
git clone https://github.com/soulfiremc-com/SoulFirePluginExample.git my-soulfire-plugin
cd my-soulfire-pluginRename the plugin metadata
Update these files first:
settings.gradle.ktsbuild.gradle.ktsgradle/libs.versions.tomlsrc/main/resources/fabric.mod.json- the Java package under
src/main/java
Make your plugin ID lowercase and hyphenated.
Reuse the same ID consistently in PluginInfo, fabric.mod.json, settings namespaces, mixin config names, and access widener names.
Keep the Fabric entrypoint
SoulFire plugins are Fabric mods, so the JVM entrypoint is still a normal ModInitializer:
package com.example.myplugin;
import com.soulfiremc.server.api.SoulFireAPI;
import net.fabricmc.api.ModInitializer;
public final class Main implements ModInitializer {
@Override
public void onInitialize() {
SoulFireAPI.registerServerExtension(new MyPlugin());
}
}SoulFireAPI.registerServerExtension(...) registers the plugin with SoulFire.
Implement the plugin class
For external plugins, extend ExternalPlugin and provide PluginInfo:
package com.example.myplugin;
import com.soulfiremc.server.api.ExternalPlugin;
import com.soulfiremc.server.api.PluginInfo;
import com.soulfiremc.server.api.event.bot.BotConnectionInitEvent;
import lombok.extern.slf4j.Slf4j;
import net.lenni0451.lambdaevents.EventHandler;
@Slf4j
public final class MyPlugin extends ExternalPlugin {
public MyPlugin() {
super(new PluginInfo(
"my-plugin",
"1.0.0",
"Example SoulFire plugin",
"YourName",
"MIT",
"https://example.com"
));
}
@EventHandler
public void onBotInit(BotConnectionInitEvent event) {
log.info("Bot {} was initialized", event.connection().accountName());
}
}Install it into SoulFire
Copy the jar into SoulFire's Fabric mods directory and restart SoulFire:
- integrated GUI or CLI install:
soulfire/minecraft/mods - dedicated server install:
minecraft/modsnext to the server jar
Add settings and a plugin page
The official example plugin shows the standard pattern:
- create a
SettingsObjectclass withpublic static finalproperties - listen for
InstanceSettingsRegistryInitEvent - call
event.settingsPageRegistry().addPluginPage(...) - read values through
connection.settingsSource()
That makes your settings appear in the GUI, CLI, and exported instance metadata automatically.
Make sure that the plugin loaded
Use the built-in plugin inspection tools:
- open the instance UI and view Plugins
- run
pluginsin the terminal - run
print-docs pluginsif you want the current built-in plugin documentation output
If the mod failed before registration, read the startup logs first.
Fabric loading problems, missing dependencies, and bad mixin config usually fail before SoulFire ever sees your ExternalPlugin.
If Fabric itself is complaining, go back to:
What to do next
- Environment Setup to align your IDE and source checkout
- Gradle And Project Layout for the important build files
- Event System to choose the right hook
- Mixins And Access Wideners if events are not enough
How is this page?
Last updated on
