🟪
SunLicense Docs
  • Welcome
  • Getting Started
    • Quickstart
    • VPS Setup
  • API Documentation
    • License API
    • Java API
  • Automations
    • BuiltByBit Automation
    • Discord Automation
  • PRODUCT INTEGRATIONS
    • Minecraft Plugins
    • Server Software
    • Minecraft Mods
    • Discord Bots
    • FiveM Projects
    • PHP Projects
    • Python Projects
    • JavaScript Projects
    • Lua Projects
  • SERVICES
    • Managed Hosting
  • LINKS
    • Discord
    • Store
    • Java API Wrapper
    • Sample Project
    • Pterodactyl Egg
    • Other Products
Powered by GitBook
On this page
  • Prerequisites
  • Integration Steps
  • Best Practices
  • Troubleshooting
  1. PRODUCT INTEGRATIONS

Server Software

SunLicense Integration Guide for Minecraft Server Software

Prerequisites

  • Java Development Environment

  • Maven/Gradle

  • Your Minecraft server project

  • SunLicense API credentials

Integration Steps

1. Add Dependencies

Add this to your pom.xml:

<repositories>
    <repository>
        <id>sundevs</id>
        <name>Sundevs Repository</name>
        <url>https://repo.hapangama.com/releases</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.hapangama</groupId>
        <artifactId>SunLicenseAPI</artifactId>
        <version>1.0.3</version>
    </dependency>
</dependencies>

2. Create License Validator

public class ServerLicenseManager {
    private final SunLicenseAPI licenseApi;
    private final Server server;

    public ServerLicenseManager(Server server, String licenseKey, int productId) {
        this.server = server;
        this.licenseApi = SunLicenseAPI.getLicense(
            licenseKey,
            productId,
            "1.0.0",
            "YOUR_API_URL"
        );
    }

    public boolean validateLicense() {
        try {
            licenseApi.validate();
            return true;
        } catch (IOException e) {
            server.getLogger().severe("License validation failed: " + e.getMessage());
            return false;
        }
    }
}

3. Implement in Server Startup

public class CustomServer {
    private ServerLicenseManager licenseManager;

    public void startServer() {
        // Initialize license manager
        licenseManager = new ServerLicenseManager(
            this,
            "YOUR-LICENSE-KEY",
            YOUR_PRODUCT_ID
        );

        // Validate license before server starts
        if (!licenseManager.validateLicense()) {
            System.err.println("Invalid license - Server startup aborted");
            System.exit(1);
        }

        // Continue with server startup
        initializeServer();
    }
}

Best Practices

  1. Startup Validation

    • Validate license before server initialization

    • Implement graceful shutdown on validation failure

    • Log validation status

  2. Regular Validation

    • Implement periodic checks

    • Handle network issues gracefully

    • Cache validation results

  3. Error Handling

    • Clear error messages

    • Proper logging

    • Graceful shutdown procedures

Troubleshooting

  1. Startup Failures

    • Check license key validity

    • Verify network connectivity

    • Confirm product ID

  2. Runtime Issues

    • Monitor validation logs

    • Check for network problems

    • Verify license hasn't expired

PreviousMinecraft PluginsNextMinecraft Mods

Last updated 4 months ago