To integrate MC License into your plugin, you’ll need to choose one of the following options:

If you need full flexibility over license checks, you can send the API request yourself.

After implementing one of the above options, you are now able to validate license keys within your plugin. For convenience, we’ve provided several different ways to do this.

Bukkit/Spigot/Paper plugin

This is the most common use case for MC License. Use the function which accepts a JavaPlugin (main class). This will automatically check for a mclicense.txt file in the plugin’s data folder and validate the key there. Implement this check in your onEnable:

Custom file path

If you have a need to specify a custom path outside of a plugin’s data folder, or don’t want to use the default mclicense.txt file, you can use the validateKey function which accepts a Path and an optional serverIp parameter. This will validate the key at the specified path. Implement this check in your onEnable:

Raw key validation

If your use case requires more flexibility, or you just don’t want to use the convenience functions above, you can use the validateKey function which accepts a key and an optional serverIp parameter. This will validate the key at the specified path. Implement this check in your onEnable:

In both the custom file path and raw key validation options, the serverIp is optional. If you don’t provide it, MC License cannot check for active servers using your licenses and so will not reject validations if the Max IPs you have set has been exceeded! If you use the Bukkit/Spigot/Paper snippet above, then this will be managed for you.