How to integrate it in your plugin (Java)
This is the part you have to code yourself inside your plugin — the store generates and manages the keys, but whether the plugin works or not is decided by your own code.
API contract
POST https://store.iiaan.dev/api/license/validate
Content-Type: application/json
{
"licenseKey": "AB12CD-EF34GH-IJ56KL-MN78OP",
"serverIdentifier": "123.45.67.89",
"version": "1.4.2"
}
Response if valid:
{ "valid": true, "plugin": "ZenStaff" }
Response if not (revoked key, IP outside whitelist, or the license already reached its server limit):
{ "valid": false, "message": "This server is not in the whitelist" }
Example Java class
Uses HttpClient, included since Java 11, no external dependencies:
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.Properties;
import java.io.InputStream;
public class LicenseChecker {
private static final String VALIDATE_URL = "https://store.iiaan.dev/api/license/validate";
/** Calls store.iiaan.dev's API to check this server's license. */
public static boolean checkLicense(String serverIdentifier, String pluginVersion) {
try {
// 1. Read license.properties — it's bundled inside the jar itself
// (the store injects it automatically on download, don't edit it by hand)
Properties props = new Properties();
try (InputStream in = LicenseChecker.class.getResourceAsStream("/license.properties")) {
if (in == null) {
System.out.println("[License] license.properties not found in the jar.");
return false;
}
props.load(in);
}
String licenseKey = props.getProperty("license-key");
// 2. Call the validation API
String json = String.format(
"{\"licenseKey\":\"%s\",\"serverIdentifier\":\"%s\",\"version\":\"%s\"}",
licenseKey, serverIdentifier, pluginVersion
);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(VALIDATE_URL))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json, StandardCharsets.UTF_8))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response.statusCode() == 200 && response.body().contains("\"valid\":true");
} catch (Exception e) {
System.out.println("[License] Could not validate: " + e.getMessage());
return false; // you decide whether a network failure blocks the plugin or lets it through
}
}
/** Optional: auto-detects the server's public IP. */
public static String getPublicIp() {
try {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.ipify.org")).GET().build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response.body().trim();
} catch (Exception e) {
return "unknown";
}
}
}
Usage inside your plugin
@Override
public void onEnable() {
String serverIp = LicenseChecker.getPublicIp();
boolean valid = LicenseChecker.checkLicense(serverIp, getDescription().getVersion());
if (!valid) {
getLogger().severe("Invalid license — disabling the plugin.");
getServer().getPluginManager().disablePlugin(this);
return;
}
getLogger().info("License valid ✓");
// ... the rest of your startup logic
}
Recommendation
Don't validate only in onEnable(). Schedule a repeating task (e.g. every 6 hours with BukkitScheduler) to call checkLicense() again, so the "last seen" info in the panel stays accurate for servers that run for weeks without restarting.