Quickstart (Validating a License)
To integrate MC License into your plugin, you’ll need to choose one of the following options:
Java/Kotlin Library
Add our lightweight library to your Gradle or Maven project.
Copy/Paste Java Class
Create a class in your project and copy/paste our Java code.
Copy/Paste Kotlin Class
Create a class in your project and copy/paste our Kotlin code.
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
:
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.