# Linking your plugin


# First Steps

First of all, import the Maven repository:

```xml
<repository>
  <id>edlicense-repo</id>
  <url>https://repo.edlicense.com/repository/maven-releases/</url>
</repository>
```

Then the dependency:

```xml
<dependency>
  <groupId>com.edwardbelt</groupId>
  <artifactId>edlicense</artifactId>
  <version>1.1</version>
  <scope>compile</scope>
</dependency>
```

Make sure you have the Maven shade plugin:

```xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.4.1</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <minimizeJar>true</minimizeJar>
            </configuration>
        </execution>
    </executions>
</plugin>
```


# Implementing into your code

Once you have added the repo and the dependency into your pom.xml, now it's time to implement it into your code.\
On your main class, import the following static function:

```java
import static com.edwardbelt.edlicense.Main.checkLicense;
```

And now on your onEnable, put the following code. The pluginId can be found in the EdLicense dashboard URL when a plugin is selected or inside your Plugin Settings.

```java
if(!checkLicense("YOUR-PLUGIN-ID", "YOUR-LICENSE-KEY")) {
    Bukkit.getLogger().warning("You are using an invalid license!");
    getServer().getPluginManager().disablePlugin(this);
    return;
}
```

So, if the license is invalid or it has expired or it has reached the maximum amounts of IP addresses it will return false on checkLicense method.


# BBB Automatic Integration

First of all, enable the BuiltByBit integration at your Plugin Settings.

Now head over [BuiltByBit Placeholders](https://builtbybit.com/placeholders/) and create a new placeholder such as: `%%__edprison-license__%%` and write exactly that placeholder where you want the user to be such as inside config.yml.\
Now point Url towards <https://dash.edlicense.com/api/license/bbb>\
Put in secret your plugin secret.\
It should look like this:

<figure><img src="https://2570404129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7MFJ7KgvnAgmL2Gi2ncy%2Fuploads%2F4WYcnqZqAOrnvFIRbWrf%2Fimage.png?alt=media&amp;token=d5b70d86-a16f-459f-89ef-67ec68140d7a" alt=""><figcaption></figcaption></figure>


