License Check
This page shows how to integrate MC License into your plugin.
Adding the library
We offer a library that you can use to easily add MC License to your plugin. It’s very lightweight and contains only essential functions that you will use to validate your users’ license keys.
Add the following repository and dependency to your build file:
Checking a license
Each license check requires two things: the pluginId
and the license key
. The pluginId is a unique identifier for your plugin, and the license key is the key that the user has set in the mclicense.txt
file in your plugin’s folder (the library will create this file).
You’ll need the pluginId
for the validate function. To find it, head to the plugin on your dashboard and copy the random string of characters from the URL. It’ll look something like this: 6733f37754da3d7d26bbb9ad
.
To validate a license in your plugin, simply add the following code snippet to your onEnable
:
As you can see, the validateKey
function returns a Boolean. In the above code snippet, if the key is invalid, the plugin will be disabled. If the key is valid, the plugin will continue to load.