Hytale plugin license system: per-server keys without the backend
Latch team · 2026-12-05 · 6 min read
You've built a Hytale plugin that you don't want running everywhere: a paid plugin, a commission for one network, or a private tool for a few partner servers. The usual answer is a license key. The plugin checks the key on startup and refuses to run without a valid one.
That sounds like a weekend project. In practice it turns into a small product of its own. This post goes through what a home-made license system for a Hytale plugin actually needs, where the existing services fit, and how Latch handles licensing by account with one key per server.
What a home-made license system needs
A Hytale server plugin is a Java .jar in the server's mods/ folder (see the official server manual). To license it yourself, you need at least:
- A license server. An HTTPS endpoint that answers "is this key valid?", hosted somewhere that stays up. If it goes down, every licensed server is affected at once.
- Key generation and storage. Keys that can't be guessed, stored against the person who paid or the deal you made, plus a way to look them up when someone opens a support ticket.
- A check in the plugin. Code in your plugin's setup that reads the key, calls the server, and decides whether to continue.
- Binding to a server. Otherwise one key ends up on fifty servers. Binding to an IP breaks when hosts change IPs; binding to hardware needs a way to reset it when the owner moves machines.
- Revocation. Refunds, chargebacks and broken deals happen. You need to turn a key off and have running servers notice.
- Outage behaviour. Decide what the plugin does when your license server can't be reached: stop right away, or keep running for a grace period.
- Updates. A way to get new versions to the people who are licensed, and only to them.
None of these is hard on its own. Together they're a backend, a database, an admin screen and an on-call responsibility, all for something that isn't your plugin.
The check lives in the JAR
There's a bigger problem than the workload. Your license check is code inside the same JAR you hand out, and Java bytecode decompiles back into readable Java with free tools like Vineflower. In the Hytale community, decompiling is routine: Hytale's own Technical Director wrote that the server "is not obfuscated, so you can decompile it easily", before the server source was published under the Shared Source Agreement.
So the decision "is this key valid?" ends up as an if statement in a file the other person controls. Change it to always pass, rebuild the JAR, and your license server is never asked again. Obfuscation makes that statement harder to find, but it's still there. For more on that trade-off, see obfuscation vs encryption for game server scripts.
Existing license services
You don't have to write the backend from scratch. A few options exist, and each solves part of the list above:
- General-purpose licensing APIs. Keygen offers license key validation, entitlements and device activation as an API, either hosted or self-hosted through its free Community Edition. It isn't specific to games, so you still write the integration in your plugin.
- Minecraft plugin licensing services. MC License, for example, provides signed license checks you call from your plugin's
onEnable, limits on concurrent servers, and automatic key delivery through marketplaces like Tebex and BuiltByBit. It's built around Minecraft plugins. - Marketplace-issued keys. BuiltByBit can call an endpoint you provide at download time and write the returned key into the file through an external licence key placeholder. Their docs point out that the endpoint has to be reachable and fast on every download, so you treat it as production infrastructure. They also publish recommended DRM designs and warn that some approaches can get a resource removed.
These services handle issuing and checking keys well. What none of them change is that the plugin code, including the check, ships readable.
How Latch does it: access by account, a key per server
Latch splits licensing into two things that are easy to mix up:
- Access belongs to an account. Every Latch user has a permanent account ID that looks like
LA-7K2M-9QXD. You grant your plugin to that account. - A license key identifies a server. Keys look like
LT-XXXX-XXXX-XXXX-XXXX. One key runs on one server at a time, and a key unlocks every script the account has access to on that server.
So the developer never hands out keys, and the server owner never needs one key per plugin. They put their key in a .env file next to mods/ once:
LATCH_LICENSE=LT-XXXX-XXXX-XXXX-XXXX
The plugin itself is encrypted. Your .class files and resources are only decrypted in the running server's memory after the license is checked, so there's no plain-text check sitting in the JAR to patch out (the Hytale plugins docs cover packaging).
Here's how the list from earlier maps over:
| Need | Home-made | With Latch |
|---|---|---|
| License server | You host and monitor it | Run by Latch |
| Keys | You generate, store and deliver them | Owners get 1 key free and add extra keys themselves |
| Binding | IP or hardware, plus resets | Tied to the machine, not the IP; frees up about 10 minutes after the old server stops |
| Key sharing | You build detection | Same key on a second server is refused and flagged |
| Revocation | You build it into the check | Revoke access; the plugin stops at its next check |
| Updates | You host downloads | New versions reach everyone with access |
| The check itself | Readable in the JAR | Plugin code is encrypted |
Granting and revoking
From the dashboard, open the script's Access tab, enter the account ID, check the name and avatar, and confirm. On Pro and above you can do the same from the CLI, which is handy if you deliver access from your own tools:
npx -y @heylatch/cli@latest grant my-plugin LA-7K2M-9QXD
npx -y @heylatch/cli@latest access my-plugin
npx -y @heylatch/cli@latest revoke my-plugin LA-7K2M-9QXD
When you revoke access, the plugin stops at its next license check, within about 5 minutes. On Hytale it's shut down through its normal shutdown, and the server keeps running. The access docs have the details.
A few things server owners handle on their side, without asking you:
- Moving machines: shut the old server down; about 10 minutes after it stops checking in, the key frees up for the new one.
- A stolen key: regenerate it on the Keys page. The old value stops working immediately.
- A second server: an extra key, billed monthly (see pricing).
If a key is started on a second server at the same time, the plugin won't open there and a flag appears on your script's page. On Pro and above you're also emailed. See what a key is and leaks and key sharing.
Shipping updates to licensed servers
Licensing isn't only about saying no. The people you've granted need your fixes. When you publish a new version (the version number has to be higher than the last), everyone with access sees "Update available" in their dashboard, gets an email, and sees your changelog.
Server owners who don't want to update by hand can create an account API key and pull everything in their Library with one command. On Hytale the target is mods/:
npx -y @heylatch/cli pull --all --to mods
Already-current plugins are skipped, so it's safe to put in a start script. If a release turns out to be broken, Pro and above can roll it back: the version is withdrawn and everyone who downloaded it is told to go back to the previous one. More in the updates docs.
What you still handle yourself
Latch doesn't sell your plugin or take a cut. You agree on payment or terms on your own channel and grant access by account. If you want that to happen automatically, your store can ask buyers for their account ID and grant access through the API (Pro and above), and revoke it the same way on a refund. On Studio and Enterprise, webhooks also notify your server about events such as access.granted and access.revoked. The API docs show both.
Licensed servers need outbound HTTPS to api.heylatch.app. If the license server can't be reached, a running plugin keeps going and retries, and stops after 30 minutes without contact. And as with any protection for code running on someone else's machine, it isn't absolute: it stops unlicensed use and makes reaching the source impractical, but someone with full control of a server could still pull code from memory. The How protection works page explains the model.
Try it on one plugin
The Free plan covers one script with no card required, and every account gets one key free, so you can publish a plugin, grant a test account and run it on your own server before deciding anything. Start with the Hytale plugins guide.