Setting Up A Remote Repository

If you want to set up your own repository for use with the plugin, you'll first need to have a webserver. Create a directory in the web root called "mpt" and inside it create a file called "mpt.json". This file will serve as the index for your repository's content. Next, paste in the following JSON:

{
  "id": "example-repo",
  "packages": {
	"supercoolmap": {
	  "name": "Super Cool Map",
	  "description": "A super-cool map for super-cool people",
	  "version": "1.0",
	  "url": "http://example.com/mpt/content/supercool.zip",
	  "sha1": "54f29d86443cd2ca25db7c0eadfeb3bcf7446dc8"
	},
        "anothermap": {
          "name": "Another Map",
          "description": "Another map for even cooler people!",
          "version": "1.3.5",
          "url": "http://example.com/mpt/content/anothermap.zip",
          "sha1": "498bcf73c54f278c0ea5da443d66dc4dfebd2cb2"
        }
  }
}

(Note: if the above document is nonsense to you, I recommend you give this article a read. It'll explain how JSON works in an easy-to-understand manner.)

Let's go through the elements one-by-one. First, we have the id element. This defines your repository's ID. Ideally, it should be all-lowercase and as unique as possible. It is used to organize information locally when someone adds the repo.

Next, we have the packages element, which contains definitions for all packages available from the repository. The first one defined is called supercoolmap, which serves as the package ID. This too should be all-lowercase.

You'll notice that it contains several sub-elements, most of which should be self-explanatory. However, I'd like to point out in particular version, url, and sha1.

version defines the current version of your content, and is read by the plugin when upgrading installed packages. It follows the Maven versioning standard, although use of qualifiers is not recommended at the moment since it tends to behave a bit oddly sometimes.

url defines the URL to the content itself. As of version 1.0.0 MPT only supports ZIP archives (support for more formats will be added later on).

sha1, finally, defines the checksum of the content as per the SHA-1 hashing algorithm. Please note that this is a required element for plugins using the default configuration, as MPT will reject packages missing a checksum. It will also refuse to install a package if the hash of the downloaded content does not match the defined checksum, so make sure you get it right!

Now that you understand how the index works, you can modify it and add more packages to your liking. Make sure you verify that your repository and its packages work properly before making it public!


Comments

Posts Quoted:
Reply
Clear All Quotes