Skip to content

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"
}
FileWhat happens in the package
.class files and resourcesEncrypted. Nothing stays readable on disk; the real code is decrypted only in the running server's memory.
manifest.jsonStays readable. Latch points Main at its loader and keeps the rest of your manifest.
.java, .mapNever go into the package.
  • Main must be a valid class name and that class must be in the JAR. The JAR needs at least one .class file.
  • 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 .jar that goes in mods/. 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-Path are kept; signature files and attributes that start an agent are removed.
  • Resources work through getResource, getResourceAsStream and ServiceLoader.
  • The key is read from a .env next to the .jar or in the folder you start it from, or from the LATCH_LICENSE environment variable.
  • If the license is refused for good (access removed, key revoked), the app exits with code 78.

Server owners: install

  1. 1Download the plugin from your Library.
  2. 2Put the downloaded .jar in your server's mods/ folder.
  3. 3Create a .env file in the server's root folder, next to mods/, and add your key. Hytale servers don't come with an env file. You can also set LATCH_LICENSE as an environment variable instead of using a file.
  4. 4Start the server. The console shows that the plugin was verified and loaded.
.env
LATCH_LICENSE=LT-XXXX-XXXX-XXXX-XXXX

What 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.