Skip to content

Best Practices Troubleshooting

DarkBladeDev edited this page May 10, 2026 · 3 revisions

Additional documentation

Reusable templates

addon.properties template

id=your_addon
version=1.0.0
main=com.yourorg.youraddon.YourAddon
api=1
depends=another_addon

Addon template (skeleton)

import dev.darkblade.mbe.api.addon.AddonContext;
import dev.darkblade.mbe.api.addon.AddonException;
import dev.darkblade.mbe.api.addon.MultiblockAddon;

public final class YourAddon implements MultiblockAddon {
  private AddonContext ctx;

  @Override public String getId() { return "your_addon"; }
  @Override public String getVersion() { return "1.0.0"; }

  @Override
  public void onLoad(AddonContext ctx) throws AddonException {
    this.ctx = ctx;
    // Registrations (actions/conditions/matchers)
  }

  @Override
  public void onEnable() throws AddonException {
    // Code-defined multiblocks / listeners
  }

  @Override
  public void onDisable() {
    // Cleanup
  }
}

Best practices

  • Register as much as possible in onLoad to fail early.
  • Use AddonException for fatal failures with clear context.
  • Keep domain logic out of the core: everything stays inside your addon.
  • Use @InjectService for clean dependency access.
  • Do not assume load order unless you declare depends.

Common troubleshooting

The addon does not load

  • Check that addon.properties exists inside the JAR.
  • Ensure id, version, main, and api are correct.
  • Verify that main implements MultiblockAddon.

"Incompatible API version"

  • Set api in addon.properties to the current engine version (usually 1).

Namespacing errors

  • Actions/Conditions must start with addonId:.
  • Matchers: the prefix must be exactly addonId.
  • Code-defined multiblocks: createMultiblock("name") is recommended.

Clone this wiki locally