Class ModuleInfo

java.lang.Object
dev.cwhead.GravesX.module.util.ModuleInfo

public final class ModuleInfo extends Object
Immutable descriptor of a module parsed from module.yml.

Holds name, description, main class, version, authors, website, plugin/module dependency lists, Folia support flag, declared load phase, libraries, and simple permission/command metadata.

  • Method Details

    • name

      public String name()
      Gets the module name, or null if not provided.
    • description

      public String description()
      Gets the module description (from description in module.yml).
    • mainClass

      public String mainClass()
      Gets the fully qualified main class, or null if not provided.
    • version

      public String version()
      Gets the module version (defaults to "0.0.0" if missing).
    • website

      public String website()
      Gets the website URL for this module, or null if not provided.
    • authors

      public List<String> authors()
      Gets authors of this module (may be empty, never null).
    • pluginDepends

      public List<String> pluginDepends()
      Required Bukkit plugin dependencies.
    • pluginSoftDepends

      public List<String> pluginSoftDepends()
      Optional Bukkit plugin dependencies.
    • pluginLoadBefore

      public List<String> pluginLoadBefore()
      Plugins that should load after this module.
    • moduleDepends

      public List<String> moduleDepends()
      Required module dependencies.
    • moduleSoftDepends

      public List<String> moduleSoftDepends()
      Optional module dependencies.
    • moduleLoadBefore

      public List<String> moduleLoadBefore()
      Modules that should load after this module.
    • supportsFolia

      public boolean supportsFolia()
      Whether this module declares Folia support via supportsFolia: true.
      Returns:
      true if supportsFolia is explicitly true; otherwise false.
    • loadPhase

      Declared enable phase for this module via load:.

      Valid values are STARTUP, POSTWORLD, COMPLETED. If missing or invalid, defaults to GravesXModuleController.LoadPhase.COMPLETED.

      Returns:
      declared load phase (never null)
    • libraries

      public List<ModuleInfo.LibraryDef> libraries()
      Libraries declared under libraries: in module.yml.
      Returns:
      immutable list of library definitions (may be empty, never null)
    • permissions

      public Map<String,ModuleInfo.PermissionDef> permissions()
      Returns permissions defined in permissions: in module.yml, keyed by permission node.
    • commands

      public Map<String,ModuleInfo.CommandDef> commands()
      Returns commands defined in commands: in module.yml, keyed by command name.
    • fromYaml

      public static ModuleInfo fromYaml(InputStream in) throws Exception
      Parses a minimal YAML-like stream into a ModuleInfo.

      Supports top-level keys: name, description, main, version, website, author (single) or authors (list), pluginDepends, pluginSoftDepends, pluginLoadBefore, moduleDepends, moduleSoftDepends / moduleSoftDepend, moduleLoadBefore, supportsFolia, load, libraries, permissions, commands.

      Libraries support a simple list with optional nested flags:

       libraries:
         - group:artifact:version
         - group:artifact:version
           relocatefrom: old.pkg
           relocateto: new.pkg
           isIsolated: true
           useTransitive: false
           repo: https://repo.example/
           id: myRepo
       

      List values may be comma-separated on the same line or via - item lines. Comments (#) and blank lines are ignored.

      Parameters:
      in - Input stream of module.yml. Must not be null.
      Returns:
      Parsed module info.
      Throws:
      Exception - If reading or parsing fails.