addonscript-spec/docs/schema/file.md
Timo Ley 123f62e1c2
All checks were successful
continuous-integration/drone/pr Build is passing
Make file hashes more scalable
2022-06-25 22:14:43 +02:00

2.5 KiB

File Object

{
  "id": "modfile",
  "link": ["https://example.com/mymod.jar", "./mymod.jar"],
  "flags": [],
  "maven": {},
  "install": [],
  "hashes": {
    "sha1": "somesha1checksum"
  }
}

Required properties

id

This is the ID of the file. It should be written in the kebab-case format, meaning lowercase only and using - instead of spaces. The file ID has to be unique to this addon version.

This is an array of links, which are pointing to the actual file. All of these links must have the same file type. Since AddonScript treats directories and zip files equally, they can be mixed in the same link array. When downloading the file, the first link in this array should be used with the other links as fallback, if the first doesn't work. If none of the specified links works, the file should be downloaded by it's Maven specifier from one of the specified repository, but only, if a sha1 hash is specified, so that it can be verified, that the downloaded file is correct.

Optional properties

install

This is an array of install objects. They describe how the file should be installed to the game. The order in the array corresponds to the order in which the installation steps should be applied.

flags

This is an array of flags for this file. If this property is not present in a file object, the file will inherit the side flags from the version and have the required flag set by default.

hashes

This is an object with checksums for this file. The object contains key-value-pairs where the key is the hash algorithm and the value is the checksum.

Supported hash algorithms:

  • sha1

maven

{
  "group": "com.example",
  "artifact": "mymod",
  "version": "1.0",
  "qualifier": ""
}

Each file has a unique Maven specifier, consisting of a group ID, an artifact ID, a version, a file type and an optional qualifier. By default, the group ID is equal to the addon namespace, the artifact ID to the addon ID, the version to the addon version and the qualifier to file ID. Those values can be overwritten in this object. If the qualifier is set to an empty string, it will be removed from the Maven specifier. The file type is always equal to the file type of the link. If the group ID, addon ID and version all have their default values and the qualifier is an emptry string, the file type may not be json.