Protect your Java applications with license validation
Add the UlisesLib library to your Java project to enable license validation.
Download UlisesLib.jarPlace UlisesLib.jar in your project's libraries folder and add it to your build path.
import pro.ulises.licenses.*;UlisesLib ulib = new UlisesLib();
String productId = "your-product-id-here";
String licenseKey = "user-license-key-here";
// Method 1: Simple validation (boolean)
if (ulib.isLicenseValid(productId, licenseKey)) {
System.out.println("✓ License valid!");
} else {
System.out.println("✗ License invalid!");
}
// Method 2: Detailed validation (with data)
UlisesLib.LicenseResponse response = ulib.verifyLicense(productId, licenseKey);
if (response.isSuccess()) {
UlisesLib.LicenseData data = response.getData();
UlisesLib.LicenseInfo license = data.getLicense();
// Access license details
String discordId = license.getDiscordId();
String status = license.getStatus();
System.out.println("License valid for: " + discordId);
} else {
System.out.println("Error: " + response.getMessage());
}You have two options for handling the Product ID in your application:
Embed the Product ID directly in your code. Users only need to provide their license key.
String productId = "67890abcdef12345";Let users provide both Product ID and license key. More flexible for multiple products.
String productId = config.getString("product-id");Important Note
Product IDs are visible in the dashboard under "Products" section. Users can request their Product ID from you if needed.
Here's a complete example showing license validation with configuration file support and detailed data access:
public class YourApplication {
private String licensedDiscordId;
private String licenseStatus;
public void enable() {
// Load configuration from antileak.yml
FileConfiguration config = loadAntileakConfig();
// Get credentials from config
String productId = config.getString("license.product-id", "");
String licenseKey = config.getString("license.key", "");
// Validate license with detailed response
UlisesLib ulib = new UlisesLib();
UlisesLib.LicenseResponse response = ulib.verifyLicense(productId, licenseKey);
if (response.isSuccess()) {
System.out.println("✓ License valid!");
// Extract license data
UlisesLib.LicenseData data = response.getData();
UlisesLib.LicenseInfo licenseInfo = data.getLicense();
UlisesLib.ProductInfo productInfo = data.getProduct();
// Store license information
this.licensedDiscordId = licenseInfo.getDiscordId();
this.licenseStatus = licenseInfo.getStatus();
// Display license information
System.out.println("Initializing...");
System.out.println("License Status: " + licenseStatus);
System.out.println("Discord ID: " + licensedDiscordId);
// Continue with your application logic
initializeFeatures();
} else {
System.out.println("✗ License invalid! Reason: " + response.getMessage());
System.out.println("Please check your credentials.");
// Disable application
disableApplication();
}
}
private FileConfiguration loadAntileakConfig() {
File configFile = new File(getDataFolder(), "antileak.yml");
// Create config if it doesn't exist
if (!configFile.exists()) {
try {
configFile.createNewFile();
FileConfiguration config = YamlConfiguration.loadConfiguration(configFile);
config.set("license.product-id", "your-product-id-here");
config.set("license.key", "your-license-key-here");
config.save(configFile);
System.out.println("Created new antileak.yml configuration file");
} catch (IOException e) {
System.out.println("Failed to create antileak.yml: " + e.getMessage());
}
}
return YamlConfiguration.loadConfiguration(configFile);
}
}Example antileak.yml configuration file for your users:
# antileak.yml
license:
product-id: "your-product-id-here"
key: "your-license-key-here"Configuration Note
The configuration file will be automatically created with default values if it doesn't exist. Users should replace the placeholder values with their actual Product ID and License Key.
boolean isLicenseValid(String productId, String licenseKey)Simple validation method that returns a boolean. Use this when you only need to check if a license is valid.
productId - The unique identifier for your product (24-character hex string)licenseKey - The user's license key (format: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-discordid)true if valid, false if invalid/expired/revokedLicenseResponse verifyLicense(String productId, String licenseKey)Detailed validation method that returns complete license information. Use this when you need access to license details.
productId - The unique identifier for your productlicenseKey - The user's license keyLicenseResponse object containing validation result and license dataLicenseResponseboolean isSuccess() - Whether the validation was successfulString getMessage() - Success or error messageLicenseData getData() - Detailed license data (null if failed)LicenseDataProductInfo getProduct() - Product informationLicenseInfo getLicense() - License informationProductInfoString getId() - Product IDString getName() - Product nameString getDescription() - Product descriptionLicenseInfoString getDiscordId() - Discord ID of license ownerString getLicenseKey() - The license keyString getIssuedBy() - Who issued the licenseString getExpiresAt() - Expiration date (ISO format)String getStatus() - License status (active/revoked/expired)String getLastError()Returns the last error message if validation failed. Useful for debugging connection or validation issues.
Need help? Contact support or visit the dashboard