> For the complete documentation index, see [llms.txt](https://docs.ohalee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ohalee.com/products/obsidian-license/quick-start.md).

# Quick Start

Add licensing to an existing plugin in about five minutes, without changing how the plugin is built or shipped.

This is the fastest way to license a plugin. Your plugin stays an ordinary jar. You add one method call to `onEnable`, and it refuses to start without a valid license.

If you want the compiled code itself kept off the customer's disk, that is the other mode: see [protected-plugins.md](/products/obsidian-license/protected-plugins.md). You can start here and move later without reissuing any keys.

## 1. Create a product

In the [dashboard](https://license.ohalee.com), go to **Products** and create one. The **Product ID** you choose (for example `my-plugin`) is what your code will send. Nothing to upload yet.

## 2. Copy your server key

Go to **Dashboard, Server key** and copy the Ed25519 public key. Your plugin pins it so that nobody can point your customers at a fake license server and get a free "yes".

## 3. Drop in the client

Copy [`ObsidianLicense.java`](https://github.com/ohAleee/obsidianlicense-api/blob/main/core/src/main/java/com/obsidian/license/core/ObsidianLicense.java) from the public API repository into your project and change the package to match. It is a single file with no dependencies beyond Gson, which Paper and Velocity already ship. There is nothing to add to your build file.

Prefer a dependency? The same code is on JitPack:

```kotlin
repositories { maven("https://jitpack.io") }
dependencies { implementation("com.github.ohAleee.obsidianlicense-api:core:v1.2.1") }
```

The example below is Paper. The client itself is platform-neutral, so the same call works on Velocity and in a plain Java application: see [license check](/products/obsidian-license/license-check.md).

## 4. Call it on startup

```java
public final class MyPlugin extends JavaPlugin {

    private ObsidianLicense.Result license;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        var cfg = getConfig();

        var client = new ObsidianLicense(
                cfg.getString("license.serverUrl"),
                cfg.getString("license.serverPublicKey"));

        try {
            license = client.check(
                    cfg.getString("license.key"),
                    "my-plugin",                                    // your Product ID
                    ObsidianLicense.machineId(getDataFolder().toPath()));
        } catch (ObsidianLicense.LicenseException e) {
            // Fail closed. The message is written for the customer, print it as-is.
            getLogger().severe("License check failed: " + e.getMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getLogger().info("License OK");
        // your normal startup continues here
    }
}
```

And the `config.yml` your customers fill in:

```yaml
license:
  serverUrl: "https://license.ohalee.com"
  key: "OBS-XXXX-XXXX-XXXX-XXXX"
  serverPublicKey: "PASTE_THE_KEY_FROM_YOUR_DASHBOARD"
```

Only `key` changes per customer. The other two are the same for everyone who buys that product, so ship them pre-filled.

## 5. Issue a key and test

In **Licenses**, create a license for your product. Paste it into a test server's `config.yml` and start Paper. The plugin enables, and the activation shows up in your dashboard's **Access log** with the IP and machine id.

Then try it with the key revoked: the plugin refuses to enable and prints the reason. That is the whole point.

## What you now have

* Seats. A license runs on a set number of machines, and customers free a seat themselves at `/portal` when they migrate servers.
* A kill switch. Revoke a key after a refund or a leak and it stops working.
* Expiry, for subscriptions and time-limited deals.
* Tiers and entitlements, so one build can sell as Basic and Premium. See [tiers-and-entitlements.md](/products/obsidian-license/tiers-and-entitlements.md).
* Several jars under one key, if your product is a lobby plugin plus a game plugin. See [multiple-jars.md](/products/obsidian-license/multiple-jars.md).
* A full access log of every attempt, allowed or denied.

## Next steps

{% content-ref url="/pages/OZ6Q8prNK1wKWSW3mAgX" %}
[License Check](/products/obsidian-license/license-check.md)
{% endcontent-ref %}

{% content-ref url="/pages/YUA6gH5ssRQZ8q9owpa3" %}
[Downloading the Jar](/products/obsidian-license/downloads.md)
{% endcontent-ref %}

{% content-ref url="/pages/rQ9sZF3XNWvBaf3AtMuN" %}
[Marketplace Automation](/products/obsidian-license/marketplace-automation.md)
{% endcontent-ref %}
