Creating your first Plugin. - GeertBraakman/xLib GitHub Wiki

On this page you will learn how to create your first plugin. I will only show you how to install it with maven. This means you need to have maven installed.

Installing xLib as a maven library.

To be able to use xLib you have to install it as a maven library. This can be done with the following maven command:

Jar File

mvn install:install-file -Dfile=<path-to-file>

Cloned repository

mvn install You have to execute this command in the folder where you cloned xLib.

Add xLib to your pom

To be able to use xLib in your plugin you have to add this dependency to your pom

<dependency>
    <groupId>io.github.com.geertbraakman</groupId>
    <artifactId>xLib</artifactId>
    <version>${version}</version>
    <scope>compile</scope>
</dependency>

You also have to add the following build plugins to your pom. This is so xLib will be added to your jar when you compile it.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.3</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

JavaPlugin class.

Normally you would extend JavaPlugin if you write a plugin. But with xLib you have to extend APIPlugin. This will give you the option to get all the Handlers that are used.

⚠️ **GitHub.com Fallback** ⚠️