Setup
The following page describes the setup for a bukkit/spigot plugin. To use Tubing for a bungee or velocity plugin the dependencies are slightly different. This is explained in its own section.
Maven
Add following dependency to your pom.xml. All Tubing dependencies are fat jars. So we can and should exclude any transitive dependency.
<repositories>
<repository>
<id>staffplusplus-repo</id>
<url>https://nexus.staffplusplus.org/repository/staffplusplus/</url>
</repository>
</repositories>
...
<dependencies>
<dependency>
<groupId>be.garagepoort.mcioc</groupId>
<artifactId>tubing-core</artifactId>
<version>${tubing.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>be.garagepoort.mcioc</groupId>
<artifactId>tubing-bukkit</artifactId>
<version>${tubing.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependencies>
Make sure to use the latest version of Tubing which can be found here: https://nexus.staffplusplus.org/#browse/search/maven=attributes.maven2.artifactId%3Dtubing
relocation
Use the maven shade plugin to relocate Tubing for your plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
...
<configuration>
...
<relocations>
<relocation>
<pattern>be.garagepoort.mcioc.</pattern>
<shadedPattern>my.package.here.be.garagepoort.mcioc.</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
If you are using the minimizeJar functionality of the maven shade plugin. You should exclude tubing from minimization by adding the following filter:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<configuration>
...
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>be.garagepoort.mcioc:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
Plugin setup
Create your main plugin class and extend the TubingBukkitPlugin
class.
Override the enable and disable method. Configuration is automatically instantiated if there is a config.yml file present.
import be.garagepoort.mcioc.tubingbukkit.TubingBukkitPlugin;
public class TubingExample extends TubingBukkitPlugin {
@Override
protected void enable() {
getLogger().info("TubingExample enabled");
}
@Override
protected void disable() {
getLogger().info("TubingExample disabled");
}
}
Now what?
Look into the command and event listeners documentation to start creation your plugin. Checkout the beans section to see how we can register Tubing beans and inject them into other Tubing Beans
Last updated
Was this helpful?