Skip to content

Minecraft Plugins

Integrate abystrixLicense into your Bukkit/Spigot/Paper plugin to validate licenses from within your Minecraft server.

Dependencies

Add the abystrixLicense HTTP client to your plugin:

xml
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.14</version>
</dependency>

License Validation

java
package com.example.myplugin;

import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class LicenseValidator {

    private static final String API_URL = "https://your-server.com/api/v1/validate";

    public static boolean validateLicense(String licenseKey, int productId, String hwid) {
        try (CloseableHttpClient client = HttpClients.createDefault()) {
            HttpPost post = new HttpPost(API_URL);
            post.setHeader("Content-Type", "application/json");

            String json = String.format(
                "{\"licenseKey\":\"%s\",\"productId\":%d,\"hwid\":\"%s\"}",
                licenseKey, productId, hwid
            );
            post.setEntity(new StringEntity(json));

            String response = EntityUtils.toString(client.execute(post).getEntity());
            return response.contains("\"valid\":true");
        } catch (Exception e) {
            return false;
        }
    }
}

Plugin Enable Hook

java
@Override
public void onEnable() {
    String licenseKey = getConfig().getString("license-key");
    int productId = getConfig().getInt("product-id");
    String hwid = getServerId();

    if (!LicenseValidator.validateLicense(licenseKey, productId, hwid)) {
        getLogger().severe("Invalid license! Disabling plugin.");
        getServer().getPluginManager().disablePlugin(this);
        return;
    }
    getLogger().info("License validated successfully.");
}

Configuration (config.yml)

yaml
# Your abystrixLicense license key
license-key: "XXXXX-XXXXX-XXXXX-XXXXX"
# Your product ID from the admin dashboard
product-id: 1

Best Practices

  • Cache validation results to avoid rate limits
  • Perform validation asynchronously to avoid blocking the server thread
  • Store the license key in the plugin config, not hardcoded
  • Use HWID locking for better security

Released under the MIT License.