-
Notifications
You must be signed in to change notification settings - Fork 40
Implementing Bukkit
First you will need to add the repositories (you should already have Spigot) and the dependency to your pom.xml You will also need to shade the plugin into your jar.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>aikar</id>
<url>http://ci.emc.gs/nexus/content/groups/aikar/</url>
</repository>
<repository>
<id>spigot</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>taskchain-bukkit</artifactId>
<version>TASKCHAIN VERSION</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Replace TASKCHAIN VERSION with the latest version found on the TaskChain home page
First you will need to add the repositories (you should already have Spigot) and the dependency to your build.gradle. You will also need to shadow the plugin into your jar.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.4"
}
}
apply plugin: "com.github.johnrengelman.shadow"
repositories {
maven {
url = "http://ci.emc.gs/nexus/content/groups/aikar/"
}
maven {
url = "https://hub.spigotmc.org/nexus/content/groups/public/"
}
}
dependencies {
compile "co.aikar:taskchain-bukkit:<TASKCHAIN_VERSION>"
}
build.dependsOn shadowJar
Replace <TASKCHAIN_VERSION> with the latest version found on the TaskChain home page
Did you see my comment about getting off dinosaurs on the README? Yeah... that applies here too. Please use a modern build tool like Maven or Gradle!
Once the Dependency is added, you need to create a factory and store a reference to it.
It is recommended to set up static helper methods to create chains, here is an example of integrating it into your plugin:
import co.aikar.taskchain.BukkitTaskChainFactory;
import co.aikar.taskchain.TaskChainFactory;
import co.aikar.taskchain.TaskChain;
import org.bukkit.plugin.java.JavaPlugin;
public class MyPlugin extends JavaPlugin {
private static TaskChainFactory taskChainFactory;
public static <T> TaskChain<T> newChain() {
return taskChainFactory.newChain();
}
public static <T> TaskChain<T> newSharedChain(String name) {
return taskChainFactory.newSharedChain(name);
}
@Override
public void onEnable() {
taskChainFactory = BukkitTaskChainFactory.create(this);
}
}
That is it!
You may now use
MyPlugin.newChain()./* tasks */.execute();
Anywhere in your plugin!