Ulises LicensesUlises Licenses
FeaturesPricingAPIChangelogs
Discord
Dashboard
  • Overview
  • Installation
  • Plugin Integration
  • Complete Example
  • API Methods
  • Connection Management
  • Auto-Update
  • Best Practices
  1. Docs
  2. /
  3. Plugin Integration
Section 02 / Implementation Protocol

Minecraft & PaperMC Plugin Integration

01

Load Configuration File

step-01.java
Java
1private void loadAntileakConfig() {2    File myBestPluginDir = getDataFolder();3    if (!myBestPluginDir.exists()) {4        myBestPluginDir.mkdirs();5    }6 7    File antileakFile = new File(myBestPluginDir, "antileak.yml");8    if (!antileakFile.exists()) {9        try {10            antileakFile.createNewFile();11            this.antileakConfig = YamlConfiguration.loadConfiguration(antileakFile);12            this.antileakConfig.set("license.key", "your-license-key-here");13            this.antileakConfig.save(antileakFile);14        } catch (IOException e) {15            e.printStackTrace();16        }17    } else {18        this.antileakConfig = YamlConfiguration.loadConfiguration(antileakFile);19    }20}
02

License Validation with Retry Logic

step-02.java
Java
1private void validateLicense() {2    UlisesLib ulib = new UlisesLib();3    String productId = antileakConfig.getString("license.product-id", "");4    String licenseKey = antileakConfig.getString("license.key", "");5 6    boolean licenseValid = false;7    while (!licenseValid) {8        if (ulib.isLicenseValid(productId, licenseKey)) {9            licenseValid = true;10 11            String discordId = ulib.getDiscordId(productId, licenseKey);12            String productName = ulib.getProductName(productId, licenseKey);13            String expiresAt = ulib.getExpirationDate(productId, licenseKey);14            String licenseStatus = ulib.getLicenseStatus(productId, licenseKey);15 16            Bukkit.getConsoleSender().sendMessage(17                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +18                ChatColor.DARK_AQUA + "✓ Authentication successful. Powering up MyBestPlugin..."19            );20            Bukkit.getConsoleSender().sendMessage(21                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +22                ChatColor.GRAY + " » Discord ID: " + ChatColor.AQUA + discordId23            );24 25            loadPlugin();26 27        } else {28            String lastError = ulib.getLastError();29            Bukkit.getConsoleSender().sendMessage(30                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +31                ChatColor.RED + "✗ License authentication failed: " + lastError32            );33 34            if (lastError != null && lastError.contains("Unable to connect to the backend server")) {35                Bukkit.getConsoleSender().sendMessage(36                    ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +37                    ChatColor.YELLOW + "⚠ Retrying connection in 30 seconds..."38                );39 40                try {41                    Thread.sleep(30000);42                } catch (InterruptedException e) {43                    Bukkit.getPluginManager().disablePlugin(this);44                    return;45                }46            } else {47                Bukkit.getPluginManager().disablePlugin(this);48                return;49            }50        }51    }52}
03

Periodic Security Checks

step-03.java
Java
1private void startSecurityChecks() {2    ScheduledExecutorService licenseService = Executors.newSingleThreadScheduledExecutor();3 4    licenseService.scheduleAtFixedRate(() -> {5        UlisesLib ulib = new UlisesLib();6        String productId = antileakConfig.getString("license.product-id", "");7        String licenseKey = antileakConfig.getString("license.key", "");8 9        if (!ulib.isLicenseValid(productId, licenseKey)) {10            String lastError = ulib.getLastError();11            Bukkit.getConsoleSender().sendMessage(12                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +13                ChatColor.RED + "✗ License validation failed during periodic check."14            );15 16            if (lastError != null && lastError.contains("Unable to connect to the backend server")) {17                Bukkit.getConsoleSender().sendMessage(18                    ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +19                    ChatColor.YELLOW + "⚠ Will retry in next check cycle..."20                );21            } else {22                Bukkit.getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this));23                licenseService.shutdown();24            }25        } else {26            Bukkit.getConsoleSender().sendMessage(27                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +28                ChatColor.GREEN + "✓ License check passed. Status: " +29                ulib.getLicenseStatus(productId, licenseKey)30            );31        }32    }, 10L, 10L, TimeUnit.MINUTES);33}
PREVIOUS MODULE← InstallationNEXT MODULEComplete Example →

Built by Ulises - Citymoon Dynamics

Ulises LicensesUlises Licenses

© 2025-2030 Citymoon Dynamics (citymoon.org). All rights reserved.

TermsPrivacyDiscord