Class ModuleManager

java.lang.Object
dev.cwhead.GravesX.module.ModuleManager

public final class ModuleManager extends Object
Manages GravesX modules: discovers, loads, resolves order, and enables/disables them.
  • Constructor Details

    • ModuleManager

      public ModuleManager(Graves plugin)
      Creates a manager bound to the given plugin and ensures the modules directory exists.
      Parameters:
      plugin - Owning plugin.
  • Method Details

    • setLibraryImporter

      public void setLibraryImporter(LibraryImporter importer)
      Sets the library importer used by modules to resolve external libraries.
      Parameters:
      importer - Library importer to use.
    • modules

      Gets all loaded modules.
      Returns:
      Unmodifiable view of loaded modules.
    • get

      Looks up a loaded module by name.
      Parameters:
      name - Module name.
      Returns:
      Optional containing the module if present.
    • order

      public List<String> order()
      Returns the computed topological load order.
      Returns:
      List of module names in load order.
    • pending

      public Set<String> pending()
      Returns the set of modules waiting on missing requirements.
      Returns:
      Unmodifiable set of pending module names.
    • loadAll

      public void loadAll()
      Scans the modules directory, validates jars, loads metadata, constructs instances, and calls onModuleLoad. Also computes the topological order after loading descriptors.
    • enableAll

      public void enableAll()
      Enables all modules in topological order.
    • tryEnablePending

      public void tryEnablePending()
      Attempts to enable modules currently pending if their requirements are now met.
    • disableAll

      public void disableAll()
      Disables all modules in reverse topological order.
    • discoverExternalPluginHints

      public Set<String> discoverExternalPluginHints()
      Scan module jars and collect all external Bukkit plugin names that modules declare via pluginDepends and pluginSoftDepends, without loading classes.
    • shouldDeferLoadOnExternalPlugins

      public boolean shouldDeferLoadOnExternalPlugins()
      True if any plugin referenced by any module is present on the server. If true, we defer module load to onEnable so those plugins are fully initialized.