Class PluginMetadata

java.lang.Object
me.hackware.api.plugin.PluginMetadata

public final class PluginMetadata extends Object
Contents of a plugin's descriptor, which must sit at the root of the plugin jar as hackware.plugin.json, hackware.plugin.yml or hackware.plugin.yaml — same fields either way.

 {
   "id": "example",
   "name": "Example",
   "version": "1.0.0",
   "apiVersion": 1,
   "main": "com.example.ExamplePlugin",
   "authors": ["you"],
   "description": "Adds an example module."
 }
 

Fields carry SerializedName per the project-wide GSON convention, so the wire names survive obfuscation.

  • Field Details

    • CURRENT_API_VERSION

      public static final int CURRENT_API_VERSION
      API generation this client implements. A plugin declaring a different getApiVersion() is rejected at load with a clear message rather than being allowed to fail later with NoSuchMethodError.

      Bump this whenever a breaking change lands in the plugin-facing surface.

      See Also:
  • Constructor Details

    • PluginMetadata

      public PluginMetadata()
  • Method Details

    • getId

      public String getId()
      Unique plugin id; also namespaces registered categories and the data directory.
    • getName

      public String getName()
      Human-readable name shown in chat and the GUI; falls back to the id.
    • getVersion

      public String getVersion()
    • getApiVersion

      public int getApiVersion()
      Plugin API generation this plugin was built against.
    • getMain

      public String getMain()
      Fully-qualified name of the Plugin implementation.
    • getAuthors

      public List<String> getAuthors()
    • getDescription

      public String getDescription()
    • validate

      public String validate()
      Validates the required fields.
      Returns:
      null when valid, otherwise a human-readable reason to report
    • toString

      public String toString()
      Overrides:
      toString in class Object