Interface Module<T extends Time>

Type Parameters:
T - the update context type
All Known Implementing Classes:
AbstractModule

public interface Module<T extends Time>
Contract for a managed module with a typed update context.

Lifecycle: create -> init -> [update]* -> deinit -> cleanup

  • Method Summary

    Modifier and Type
    Method
    Description
    default Set<Class<? extends Module<T>>>
    Returns the set of module types this module depends on.
    Returns the current lifecycle state.
    boolean
    Returns whether this module is currently enabled for updates.
    void
    Called once to release all resources.
    void
    Called once after registration.
    void
    Called once before cleanup.
    default void
    Called when the module is disabled (default no-op).
    default void
    Called when the module is enabled (default no-op).
    void
    Called once after all dependencies are initialized.
    void
    onUpdate(T context)
    Called per update tick with the strategy-produced context.
  • Method Details

    • onCreate

      void onCreate()
      Called once after registration. Allocate resources here.
    • onInit

      void onInit(ModuleManager<T> manager)
      Called once after all dependencies are initialized.
      Parameters:
      manager - the module manager that owns this module
    • onUpdate

      void onUpdate(T context)
      Called per update tick with the strategy-produced context.
      Parameters:
      context - the update context for this tick
    • onDeinit

      void onDeinit()
      Called once before cleanup. Reverse of init.
    • onCleanup

      void onCleanup()
      Called once to release all resources.
    • onEnable

      default void onEnable()
      Called when the module is enabled (default no-op).
    • onDisable

      default void onDisable()
      Called when the module is disabled (default no-op).
    • getDependencies

      default Set<Class<? extends Module<T>>> getDependencies()
      Returns the set of module types this module depends on. Dependencies must be initialized before this module.
      Returns:
      an unmodifiable set of module classes this module depends on; empty by default
    • getState

      ModuleState getState()
      Returns the current lifecycle state.
      Returns:
      the module's current ModuleState
    • isEnabled

      boolean isEnabled()
      Returns whether this module is currently enabled for updates.
      Returns:
      true if the module is enabled, false otherwise