Section 02 / Implementation Protocol
Minecraft & PaperMC Plugin Integration
01
Load Configuration File
step-01.java
Java
private void loadAntileakConfig() { File myBestPluginDir = getDataFolder(); if (!myBestPluginDir.exists()) { myBestPluginDir.mkdirs(); } File antileakFile = new File(myBestPluginDir, "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); }}02
License Validation with Retry Logic
step-02.java
Java
private void validateLicense() { UlisesLib ulib = new UlisesLib(); String productId = antileakConfig.getString("license.product-id", ""); String licenseKey = antileakConfig.getString("license.key", ""); boolean licenseValid = false; while (!licenseValid) { if (ulib.isLicenseValid(productId, licenseKey)) { licenseValid = true; String discordId = ulib.getDiscordId(productId, licenseKey); String productName = ulib.getProductName(productId, licenseKey); String expiresAt = ulib.getExpirationDate(productId, licenseKey); String licenseStatus = ulib.getLicenseStatus(productId, licenseKey); Bukkit.getConsoleSender().sendMessage( ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " + ChatColor.DARK_AQUA + "✓ Authentication successful. Powering up MyBestPlugin..." ); Bukkit.getConsoleSender().sendMessage( ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " + ChatColor.GRAY + " » Discord ID: " + ChatColor.AQUA + discordId ); loadPlugin(); } else { String lastError = ulib.getLastError(); Bukkit.getConsoleSender().sendMessage( ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + 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 + "MyBestPlugin" + 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; } } }}03
Periodic Security Checks
step-03.java
Java
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 + "MyBestPlugin" + 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 + "MyBestPlugin" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "⚠ Will retry in next check cycle..." ); } else { Bukkit.getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this)); licenseService.shutdown(); } } else { Bukkit.getConsoleSender().sendMessage( ChatColor.GRAY + "[" + ChatColor.DARK_AQUA + "MyBestPlugin" + ChatColor.GRAY + "] " + ChatColor.GREEN + "✓ License check passed. Status: " + ulib.getLicenseStatus(productId, licenseKey) ); } }, 10L, 10L, TimeUnit.MINUTES);}Built by Ulises - Citymoon Dynamics