> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mclicense.org/llms.txt
> Use this file to discover all available pages before exploring further.

# License Check

> This page shows how to integrate MC License into your plugin.

## Adding the library

We offer two ways to add MC License to your plugin:

**Option 1 — Dependency (recommended)**

Add the following repository and dependency to your build file:

```xml Maven (pom.xml): theme={null}
<repository>
    <id>flyte-repository-releases</id>
    <name>Flyte Repository</name>
    <url>https://repo.flyte.gg/releases</url>
</repository>

<dependency>
    <groupId>org.mclicense</groupId>
    <artifactId>library</artifactId>
    <version>1.5.1</version>
    <scope>compile</scope>
</dependency>
```

```groovy Gradle (build.gradle): theme={null}
// Repository
maven { url "https://repo.flyte.gg/releases" }

// Dependency
implementation "org.mclicense:library:1.5.1"
```

```kotlin Gradle Kotlin DSL (build.gradle.kts): theme={null}
// Repository
maven("https://repo.flyte.gg/releases")

// Dependency
implementation("org.mclicense:library:1.5.1")
```

**Option 2 — Single class (copy/paste)**

If you're having trouble shading the library into your plugin, or simply prefer not to manage external dependencies, you can copy a single class directly into your project instead. Head to the [mcl-library-one-class](https://github.com/flytegg/mcl-library-one-class) repo and copy either `MCLicense.java` or `MCLicense.kt` into your project. No shading needed — all required dependencies are already on the Paper server classpath at runtime.

> [!NOTE]
>
> With the single-class approach you'll need to manually check that repo for updates, rather than just bumping a version number in 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: `3gd7u9r4` (8 characters).

To validate a license in your plugin, simply add the following code snippet to your `onEnable`:

```java Java theme={null}
if (!MCLicense.validateKey(this, "yourPluginId")) {
    Bukkit.getPluginManager().disablePlugin(this);
    return;
}
```

```java Kotlin theme={null}
if (!MCLicense.validateKey(this, "yourPluginId")) {
    return Bukkit.getPluginManager().disablePlugin(this)
}
```

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.

> [!NOTE]
>
> The library will handle the console logging for you, whether successful or rejected.

## Not building a Minecraft plugin?

MC License isn't limited to Minecraft plugins — you can protect any software that can make HTTP requests. Check out our guide for [non-Minecraft use cases](https://docs.mclicense.org/non-minecraft-plugins.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.