Ulises Licenses | Ulises SoftwareUlises Licenses
FeaturesPricingAPIAnnouncements
Solutions
Java & Kotlin LicensingMinecraft Plugin LicensingBuiltByBit IntegrationPolymart Integration
Discord
Dashboard
  • Overview
  • Installation
  • Plugin Integration
  • Complete Example
  • API Methods
  • Connection Management
  • Auto-Update
  • Best Practices
  1. Docs
  2. /
  3. Plugin Integration

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 boolean isTransientError(UlisesLib ulib) {2    String code = ulib.getLastErrorCode();3    return code != null && (code.equals("NETWORK_ERROR") || code.equals("TIMEOUT")4        || code.equals("SERVER_ERROR") || code.equals("MAX_RETRIES")5        || code.equals("RATE_LIMIT") || code.equals("RATE_LIMIT_LOCAL"));6}7 8private void validateLicense() {9    String productId = antileakConfig.getString("license.product-id", "");10    String licenseKey = antileakConfig.getString("license.key", "");11 12    getServer().getScheduler().runTaskAsynchronously(this, () -> {13        UlisesLib ulib = new UlisesLib();14        int attempts = 0;15        while (attempts < 5) {16            llIIllll.I result = ulib.verifyLicense(productId, licenseKey);17            if (result.isSuccess() && result.getData() != null) {18                String discordId = result.getData().getLicense().getDiscordId();19                String expiresAt = result.getData().getLicense().getExpiresAt();20 21                Bukkit.getConsoleSender().sendMessage(22                    ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +23                    ChatColor.DARK_AQUA + "✓ Authentication successful. Powering up MyBestPlugin..."24                );25                Bukkit.getConsoleSender().sendMessage(26                    ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +27                    ChatColor.GRAY + " » Discord ID: " + ChatColor.AQUA + discordId28                );29                Bukkit.getConsoleSender().sendMessage(30                    ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +31                    ChatColor.GRAY + " » Expires: " + ChatColor.AQUA + expiresAt32                );33 34                getServer().getScheduler().runTask(this, () -> {35                    loadPlugin();36                    startSecurityChecks();37                });38                return;39            }40 41            attempts++;42            String code = ulib.getLastErrorCode();43            if (!isTransientError(ulib) || attempts >= 5) {44                Bukkit.getConsoleSender().sendMessage(45                    ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +46                    ChatColor.RED + "✗ License rejected (" + code + "). Disabling."47                );48                getServer().getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this));49                return;50            }51 52            Bukkit.getConsoleSender().sendMessage(53                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +54                ChatColor.YELLOW + "⚠ Transient error (" + code + "). Retrying..."55            );56            try {57                Thread.sleep(5000L * attempts);58            } catch (InterruptedException e) {59                Thread.currentThread().interrupt();60                getServer().getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this));61                return;62            }63        }64    });65}
03

Periodic Security Checks

step-03.java
Java
1private final java.util.concurrent.atomic.AtomicInteger consecutiveDefinitiveFailures =2    new java.util.concurrent.atomic.AtomicInteger(0);3 4private void startSecurityChecks() {5    ScheduledExecutorService licenseService = Executors.newSingleThreadScheduledExecutor();6 7    licenseService.scheduleAtFixedRate(() -> {8        UlisesLib ulib = new UlisesLib();9        String productId = antileakConfig.getString("license.product-id", "");10        String licenseKey = antileakConfig.getString("license.key", "");11 12        if (ulib.isLicenseValid(productId, licenseKey)) {13            consecutiveDefinitiveFailures.set(0);14            Bukkit.getConsoleSender().sendMessage(15                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +16                ChatColor.GREEN + "✓ License check passed."17            );18            return;19        }20 21        if (isTransientError(ulib)) {22            Bukkit.getConsoleSender().sendMessage(23                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +24                ChatColor.YELLOW + "⚠ Transient error (" + ulib.getLastErrorCode() + "). Will retry next cycle."25            );26            return;27        }28 29        int failures = consecutiveDefinitiveFailures.incrementAndGet();30        if (failures >= 3) {31            Bukkit.getConsoleSender().sendMessage(32                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +33                ChatColor.RED + "✗ License rejected (" + ulib.getLastErrorCode() + "). Disabling."34            );35            Bukkit.getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this));36            licenseService.shutdown();37        } else {38            Bukkit.getConsoleSender().sendMessage(39                ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " +40                ChatColor.YELLOW + "⚠ License check failed (" + ulib.getLastErrorCode() + "). Attempt " + failures + "/3."41            );42        }43    }, 10L, 10L, TimeUnit.MINUTES);44}
PREVIOUS MODULE← InstallationNEXT MODULEComplete Example →

Built by Ulises - Citymoon Dynamics

Ulises Licenses | Ulises SoftwareUlises Licenses | Ulises Software

License management for Minecraft plugins and Java applications.

Discord

Legal

  • Terms of Service
  • Privacy Policy
  • Refund Policy
  • DPA

Docs

  • Overview
  • Installation
  • Plugin Integration
  • Complete Example
  • API Methods
  • Connection Management
  • Auto-Update
  • Best Practices

History

  • Announcements
  • Citymoon Dynamics

Company

  • About
  • Security
  • Status
  • Contact

Solutions

  • Java & Kotlin
  • Minecraft Plugins
  • BuiltByBit
  • Polymart

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