Complete guide for integrating UlisesLib with Minecraft plugins
Updated library with enhanced connectivity and detailed license information methods.
Download UlisesLib.jar v2.0private void loadAntileakConfig() {
File krakenDir = getDataFolder();
if (!krakenDir.exists()) {
krakenDir.mkdirs();
}
File antileakFile = new File(krakenDir, "antileak.yml");
if (!antileakFile.exists()) {
try {
antileakFile.createNewFile();
this.antileakConfig = YamlConfiguration.loadConfiguration(antileakFile);
this.antileakConfig.set("license.key", "your-license-key-here");
this.antileakConfig.save(antileakFile);
} catch (IOException e) {
e.printStackTrace();
}
} else {
this.antileakConfig = YamlConfiguration.loadConfiguration(antileakFile);
}
}private void validateLicense() {
UlisesLib ulib = new UlisesLib();
Sring productid = "myproductid";
String licenseKey = this.antileakConfig.getString("license.key", "");
boolean licenseValid = false;
while (!licenseValid) {
oductId, licenseKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
Id, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
y)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
ctId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
seKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
ductId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
icenseKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
roductId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
d, licenseKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
(productId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
uctId, licenseKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
me(productId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
n
oductId, licenseKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
(productId, licenseKey);
String productName = ulib.getProductName(productId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
oductId, licenseKey)) {
licenseValid = true;
// Get detailed license information
dId = ulib.getDiscordId(productId, licenseKey);
String productName = ulib.getProductName(productId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
g expiresAt = ulib.getExpirationDate(productId, licenseKey);
oductId, licenseKey)) {
licenseValid = true;
// Get detailed license information
oductId, licenseKey)) {
licenseValid = true;
// Get detailed license information
String discordId = ulib.getDiscordId(productId, licenseKey);
String productName = ulib.getProductName(productId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);
// Display license information
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.DARK_AQUA + "✓ Authentication successful. Powering up Kraken..."
);
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.GRAY + " » Discord ID: " + ChatColor.AQUA + discordId
);
// Continue loading your plugin...
loadPlugin();
} else {
String lastError = ulib.getLastError();
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.RED + "✗ License authentication failed: " + lastError
);
if (lastError != null && lastError.contains("Unable to connect to the backend server")) {
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.YELLOW + "⚠ Retrying connection in 30 seconds..."
);
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
Bukkit.getPluginManager().disablePlugin(this);
return;
}
} else {
Bukkit.getPluginManager().disablePlugin(this);
return;
}
}
}
}private void startSecurityChecks() {
ScheduledExecutorService licenseService = Executors.newSingleThreadScheduledExecutor();
licenseService.scheduleAtFixedRate(() -> {
UlisesLib ulib = new UlisesLib();
String productId = antileakConfig.getString("license.product-id", "");
String licenseKey = antileakConfig.getString("license.key", "");
if (!ulib.isLicenseValid(productId, licenseKey)) {
String lastError = ulib.getLastError();
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.RED + "✗ License validation failed during periodic check."
);
if (lastError != null && lastError.contains("Unable to connect to the backend server")) {
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.YELLOW + "⚠ Will retry in next check cycle..."
);
} else {
Bukkit.getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this));
licenseService.shutdown();
}
} else {
// Display successful check with details
Bukkit.getConsoleSender().sendMessage(
ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "Kraken" + ChatColor.GRAY + "] " +
ChatColor.GREEN + "✓ License check passed. Status: " +
ulib.getLicenseStatus(productId, licenseKey)
);
}
}, 10L, 10L, TimeUnit.MINUTES);
}public class KrakenAntiCheat extends JavaPlugin {
private FileConfiguration antileakConfig;
@Override
public void onEnable() {
loadAntileakConfig();
String productId = antileakConfig.getString("license.product-id");
String licenseKey = antileakConfig.getString("license.key");
if (productId.equals("your-product-id-here") || licenseKey.equals("your-license-key-here")) {
getLogger().severe("License details not configured. Please edit antileak.yml");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
validateLicense(productId, licenseKey);
}
private void validateLicense(String productId, String licenseKey) {
UlisesLib ulib = new UlisesLib();
while (true) {
if (ulib.isLicenseValid(productId, licenseKey)) {
// License is valid - continue loading plugin
String discordId = ulib.getDiscordId(productId, licenseKey);
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
getLogger().info("License validated for Discord ID: " + discordId);
getLogger().info("License expires: " + expiresAt);
// Load your plugin features
loadFeatures();
startPeriodicChecks();
break;
} else {
String error = ulib.getLastError();
getLogger().severe("License validation failed: " + error);
if (error != null && error.contains("Unable to connect to the backend server")) {
getLogger().warning("Retrying connection in 30 seconds...");
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
Bukkit.getPluginManager().disablePlugin(this);
break;
}
} else {
Bukkit.getPluginManager().disablePlugin(this);
break;
}
}
}
}
private void startPeriodicChecks() {
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
UlisesLib ulib = new UlisesLib();
String productId = antileakConfig.getString("license.product-id");
String licenseKey = antileakConfig.getString("license.key");
if (!ulib.isLicenseValid(productId, licenseKey)) {
String error = ulib.getLastError();
getLogger().severe("Periodic license check failed: " + error);
if (!error.contains("Unable to connect to the backend server")) {
Bukkit.getScheduler().runTask(this, () ->
Bukkit.getPluginManager().disablePlugin(this)
);
}
} else {
getLogger().info("Periodic license check passed.");
}
}, 20L * 60 * 10, 20L * 60 * 10); // Every 10 minutes
}
}String getDiscordId(String productId, String licenseKey)Retrieves the Discord ID associated with the license. Returns null if validation fails.
String discordId = ulib.getDiscordId(productId, licenseKey);
// Returns: "1216532655592439862"String getProductName(String productId, String licenseKey)Retrieves the product name from the license. Returns null if validation fails.
String productName = ulib.getProductName(productId, licenseKey);
// Returns: "KrakenAnticheat"String getExpirationDate(String productId, String licenseKey)Retrieves the expiration date in ISO format. Returns null if validation fails.
String expiresAt = ulib.getExpirationDate(productId, licenseKey);
// Returns: "2025-12-05T00:00:00.000Z"String getLicenseStatus(String productId, String licenseKey)Retrieves the license status (active/revoked/expired). Returns null if validation fails.
String status = ulib.getLicenseStatus(productId, licenseKey);
// Returns: "active"String getSubType(String productId, String licenseKey)Retrieves the license subtype (Enterprise, Advanced, etc). Returns null if validation fails.
String subType = ulib.getSubType(productId, licenseKey);
// Returns: "Enterprise"String getLastError()Returns the last error message. Useful for debugging connection issues.
The library now handles connection issues automatically
Infinite Retry: When backend is unreachable, the library retries every 30 seconds until successful
Clear Messages: Console shows "Unable to connect to the backend server" with retry countdown
Graceful Handling: Only disables plugin for actual license issues, not connection problems
Important Note for Plugin Developers
Your plugin should continue running normally during connection issues. Only disable the plugin when there are actual license validation failures (expired, revoked, invalid). Connection problems should trigger retry attempts, not immediate shutdown.
UlisesLib includes built-in methods for checking updates, downloading the latest jar, and verifying its integrity. All security validations (license status, HWID binding, IP limits) are handled automatically by the library.
boolean checkForUpdate(String productId, String licenseKey, String currentVersion)Checks if a newer version of the product jar is available. Returns true if an update exists.
String currentVersion = "1.0.0";
if (ulib.checkForUpdate(productId, licenseKey, currentVersion)) {
getLogger().info("Update available! Downloading...");
ulib.downloadUpdate(productId, licenseKey, hwid);
}File downloadUpdate(String productId, String licenseKey, String hwid)Downloads the latest jar file. Automatically handles HWID binding on first download. Returns the downloaded File, or null if download fails.
String hwid = ulib.getHardwareId();
File updatedJar = ulib.downloadUpdate(productId, licenseKey, hwid);
if (updatedJar != null) {
getLogger().info("Update downloaded: " + updatedJar.getName());
// Optionally verify checksum
if (ulib.verifyChecksum(productId, licenseKey, hwid, updatedJar)) {
getLogger().info("Checksum verified!");
}
}boolean verifyChecksum(String productId, String licenseKey, String hwid, File jarFile)Verifies the SHA-256 checksum of the downloaded jar file to ensure file integrity.
File jarFile = new File("plugins/MyPlugin.jar");
boolean valid = ulib.verifyChecksum(productId, licenseKey, hwid, jarFile);
if (!valid) {
getLogger().warning("Checksum mismatch! File may be corrupted.");
}String getCurrentVersion(String productId, String licenseKey)Returns the latest version string of the product jar available on the server.
String latestVersion = ulib.getCurrentVersion(productId, licenseKey);
getLogger().info("Latest version available: " + latestVersion);All update operations automatically validate:
private void checkAndApplyUpdate(String productId, String licenseKey) {
String currentVersion = this.getDescription().getVersion();
String hwid = ulib.getHardwareId();
// Check if update is available
if (ulib.checkForUpdate(productId, licenseKey, currentVersion)) {
String latestVersion = ulib.getCurrentVersion(productId, licenseKey);
getLogger().info("New version available: " + latestVersion + " (current: " + currentVersion + ")");
// Download the update
File updatedJar = ulib.downloadUpdate(productId, licenseKey, hwid);
if (updatedJar != null) {
// Verify integrity
if (ulib.verifyChecksum(productId, licenseKey, hwid, updatedJar)) {
getLogger().info("Update downloaded and verified successfully!");
getLogger().info("Restart the server to apply the update.");
} else {
getLogger().warning("Checksum verification failed. Update may be corrupted.");
}
}
} else {
getLogger().info("Plugin is up to date.");
}
}Need help with Minecraft plugin integration? Join our Discord server or contact support.