Implementing into your code

Once you have added the repo and the dependency into your pom.xml, now it's time to implement it into your code. On your main class, import the following static function:

import static com.edwardbelt.edlicense.Main.checkLicense;

And now on your onEnable, put the following code:

if(!checkLicense("YOUR-PLUGIN-NAME", "YOUR-LICENSE-KEY")) {
    Bukkit.getLogger().warning("You are using an invalid license!");
    getServer().getPluginManager().disablePlugin(this);
    return;
}

So, if the license is invalid or it has expired or it has reached the maximum amounts of IP addresses it will return false on checkLicense method.

Last updated