For developers
Hytale plugins
Protect your compiled plugin JAR and give server owners a single protected .jar.
Developers: prepare the plugin
Upload the compiled plugin .jar: manifest.json at its root, plus your .class files and resources. manifest.json needs a Main field pointing to your plugin's entry class:
manifest.json
{
"Group": "com.acme",
"Name": "MyPlugin",
"Version": "1.0.0",
"ServerVersion": "0.7.0-pre.2",
"Main": "com.acme.Main"
}| File | What happens in the package |
|---|---|
.class files and resources | Encrypted. Nothing stays readable on disk; the real code is decrypted only in the running server's memory. |
manifest.json | Stays readable. Latch points Main at its loader and keeps the rest of your manifest. |
.java, .map | Never go into the package. |
Mainmust be a valid class name and that class must be in the JAR. The JAR needs at least one.classfile.- Hytale plugins run entirely on the server: players never receive plugin code.
- Asset packs streamed to players (models, textures) can't be protected and shouldn't be in the code JAR; keep them separate.
- The result is a single
.jarthat goes inmods/. Publishing versions and granting access work the same as for MafiaHub scripts.
Standalone apps (e.g. a proxy)
An app started with java -jar instead of loaded as a plugin can be protected too. Upload a .jar with no manifest.json at its root and a Main-Class in META-INF/MANIFEST.MF; Latch recognizes it by itself. Classes and resources are encrypted and Main-Class points at the Latch launcher. The app still starts with java -jar: the launcher checks the license, decrypts the classes only in memory and calls your main with the same arguments.
- Other manifest attributes such as
Class-Pathare kept; signature files and attributes that start an agent are removed. - Resources work through
getResource,getResourceAsStreamandServiceLoader. - The key is read from a
.envnext to the.jaror in the folder you start it from, or from theLATCH_LICENSEenvironment variable. - If the license is refused for good (access removed, key revoked), the app exits with code 78.
Server owners: install
- 1Download the plugin from your Library.
- 2Put the downloaded
.jarin your server'smods/folder. - 3Create a
.envfile in the server's root folder, next tomods/, and add your key. Hytale servers don't come with an env file. You can also setLATCH_LICENSEas an environment variable instead of using a file. - 4Start the server. The console shows that the plugin was verified and loaded.
.env
LATCH_LICENSE=LT-XXXX-XXXX-XXXX-XXXXWhat happens if the license is invalid?
- If the key is missing or invalid, the plugin doesn't enable; the server starts normally and the console says why.
- If access is revoked while running, only that plugin is shut down through its normal shutdown; the server keeps running.
- If the license server can't be reached, the plugin keeps running and retries; after 30 minutes without contact it stops.
- If the developer turned on offline start (1, 3 or 7 days), the server also starts and runs without reaching Latch for that long after its last successful check. The proof is kept next to the plugin in a
.latch-offline-…file; delete it and the next start needs Latch again.