Record Class AddonInfo

java.lang.Object
java.lang.Record
dev.nozyx.strider.loader.api.AddonInfo
Record Components:
id - the unique identifier of the addon
name - the human-readable name of the addon
version - the version of the addon
description - the description of the addon
author - the author of the addon
side - the Minecraft side targeted by the addon
addonClass - the fully qualified implementation class of the addon
dependencies - the addon's dependencies and their required versions

public record AddonInfo(String id, String name, String version, String description, String author, MinecraftSide side, String addonClass, Map<String,String> dependencies) extends Record
Represents the metadata of an addon loaded by StriderLoader.

Contains information such as addon ID, version, description, author, targeted Minecraft side, implementation class and dependencies.

This class is primarily used by addons and the loader to query addon information.

  • Constructor Details

    • AddonInfo

      public AddonInfo(String id, String name, String version, String description, String author, MinecraftSide side, String addonClass, Map<String,String> dependencies)
      Creates an instance of a AddonInfo record class.
      Parameters:
      id - the value for the id record component
      name - the value for the name record component
      version - the value for the version record component
      description - the value for the description record component
      author - the value for the author record component
      side - the value for the side record component
      addonClass - the value for the addonClass record component
      dependencies - the value for the dependencies record component
  • Method Details

    • fromJson

      @Internal public static AddonInfo fromJson(String json)
      Parses an AddonInfo instance from JSON.
      Parameters:
      json - the JSON string
      Returns:
      the parsed AddonInfo
      Throws:
      IllegalArgumentException - if the JSON cannot be parsed
    • toJson

      @Internal public String toJson()
      Serializes this AddonInfo instance to JSON.
      Returns:
      the JSON representation
      Throws:
      IllegalStateException - if serialization fails
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • author

      public String author()
      Returns the value of the author record component.
      Returns:
      the value of the author record component
    • side

      public MinecraftSide side()
      Returns the value of the side record component.
      Returns:
      the value of the side record component
    • addonClass

      @Internal public String addonClass()
      Returns the value of the addonClass record component.
      Returns:
      the value of the addonClass record component
    • dependencies

      @Internal public Map<String,String> dependencies()
      Returns the value of the dependencies record component.
      Returns:
      the value of the dependencies record component