Interface MindustryPlugin

All Known Implementing Classes:
AbstractMindustryPlugin

public interface MindustryPlugin
A better plugin base class. With better methods, SLF4J support, plugin listeners, etc.
  • Method Details

    • from

      static MindustryPlugin from(mindustry.mod.Plugin plugin)
      Wraps a regular plugin into a MindustryPlugin.
      Parameters:
      plugin - the plugin to wrap
      Returns:
      the wrapped plugin
    • onInit

      default void onInit()
      Called after the plugin factory creation. Initialize your plugin here.

      Warning: Only call other plugins in this method if they use Distributor too.

    • onServerCommandsRegistration

      default void onServerCommandsRegistration(arc.util.CommandHandler handler)
      Called after onInit(). Register your server-side commands here.
      Parameters:
      handler - the server command handler
    • onClientCommandsRegistration

      default void onClientCommandsRegistration(arc.util.CommandHandler handler)
      Called after onServerCommandsRegistration(CommandHandler). Register your client-side commands here.
      Parameters:
      handler - the client command handler
    • onLoad

      default void onLoad()
      Called after onClientCommandsRegistration(CommandHandler) just after EventType.ServerLoadEvent. Hook into other plugins here since this method technically replaces Mod.init().
    • onUpdate

      default void onUpdate()
      Called every tick while the server is running.
    • onExit

      default void onExit()
      Called when the server is closing. Unload your plugin here (closing the database connection, saving files, etc.).
    • getDirectory

      default Path getDirectory()
      Returns the plugin data directory. ./config/mods/[plugin-name]/ by default.
    • getLogger

      org.slf4j.Logger getLogger()
      Returns the logger bound to this plugin.
    • getMetadata

      PluginMetadata getMetadata()
      Returns the metadata of this plugin.