diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 23bbe8f..6a0d41f 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,30 +1,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
@@ -32,6 +19,18 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 67b357d..a1b1191 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -3,8 +3,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..cd2faeb
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index e973167..e7d3197 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -6,6 +6,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index 52b60bd..92f8f96 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -51,9 +51,9 @@
3.7.3-SNAPSHOT
- org.bukkit
- bukkit
- 1.10-R0.1-SNAPSHOT
+ org.spigotmc
+ spigot-api
+ 1.20.1-R0.1-SNAPSHOT
provided
diff --git a/bukkit/src/main/java/co/aikar/taskchain/BukkitTaskChainFactory.java b/bukkit/src/main/java/co/aikar/taskchain/BukkitTaskChainFactory.java
index 77fdfad..bc492db 100644
--- a/bukkit/src/main/java/co/aikar/taskchain/BukkitTaskChainFactory.java
+++ b/bukkit/src/main/java/co/aikar/taskchain/BukkitTaskChainFactory.java
@@ -23,6 +23,7 @@
package co.aikar.taskchain;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
diff --git a/sponge/pom.xml b/sponge/pom.xml
index 8f5539f..f3c873c 100644
--- a/sponge/pom.xml
+++ b/sponge/pom.xml
@@ -40,7 +40,7 @@
sponge-maven-repo
Sponge maven repo
- http://repo.spongepowered.org/maven
+ https://repo.spongepowered.org/repository/maven-public/
true
@@ -58,7 +58,8 @@
org.spongepowered
spongeapi
- 6.0.0-SNAPSHOT
+ 9.0.0
+ jar
provided
diff --git a/sponge/src/main/java/co/aikar/taskchain/SpongeTaskChainFactory.java b/sponge/src/main/java/co/aikar/taskchain/SpongeTaskChainFactory.java
index 85987b5..2f5fdea 100644
--- a/sponge/src/main/java/co/aikar/taskchain/SpongeTaskChainFactory.java
+++ b/sponge/src/main/java/co/aikar/taskchain/SpongeTaskChainFactory.java
@@ -24,13 +24,17 @@
package co.aikar.taskchain;
import org.spongepowered.api.Sponge;
-import org.spongepowered.api.event.game.state.GameStoppingEvent;
-import org.spongepowered.api.plugin.PluginContainer;
+import org.spongepowered.api.event.EventListenerRegistration;
+import org.spongepowered.api.event.lifecycle.StoppedGameEvent;
import org.spongepowered.api.scheduler.Task;
+import org.spongepowered.api.util.Ticks;
+import org.spongepowered.plugin.PluginContainer;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import static com.sun.tools.javac.main.Option.G;
+
@SuppressWarnings("WeakerAccess")
public class SpongeTaskChainFactory extends TaskChainFactory {
private SpongeTaskChainFactory(Object plugin, AsyncQueue asyncQueue) {
@@ -38,7 +42,7 @@ private SpongeTaskChainFactory(Object plugin, AsyncQueue asyncQueue) {
}
public static TaskChainFactory create(PluginContainer pluginContainer) {
- return create(pluginContainer.getInstance().orElse(null));
+ return create(pluginContainer.instance());
}
public static TaskChainFactory create(Object plugin) {
return new SpongeTaskChainFactory(plugin, new TaskChainAsyncQueue());
@@ -59,7 +63,8 @@ private static class SpongeGameInterface implements GameInterface {
private SpongeGameInterface(Object plugin, AsyncQueue asyncQueue) {
this.asyncQueue = asyncQueue;
- if (plugin == null || !Sponge.getPluginManager().fromInstance(plugin).isPresent()) {
+
+ if (plugin == null || !Sponge.pluginManager().fromInstance(plugin).isPresent()) {
throw new IllegalArgumentException("Not a valid Sponge Plugin");
}
this.plugin = plugin;
@@ -67,7 +72,7 @@ private SpongeGameInterface(Object plugin, AsyncQueue asyncQueue) {
@Override
public boolean isMainThread() {
- return Sponge.getServer().isMainThread();
+ return Sponge.server().onMainThread();
}
@Override
@@ -77,19 +82,19 @@ public AsyncQueue getAsyncQueue() {
@Override
public void postToMain(Runnable run) {
- Task.builder().execute(run).submit(plugin);
+ Task.builder().execute(run).build();
}
@Override
public void scheduleTask(int gameUnits, Runnable run) {
- Task.builder().delayTicks(gameUnits).execute(run).submit(plugin);
+ Task.builder().delay(Ticks.of(gameUnits)).execute(run).build();
}
@Override
public void registerShutdownHandler(TaskChainFactory factory) {
- Sponge.getEventManager().registerListener(plugin, GameStoppingEvent.class, event -> {
+ Sponge.eventManager().registerListener(EventListenerRegistration.builder(StoppedGameEvent.class).plugin((PluginContainer) plugin).listener(event -> {
factory.shutdown(60, TimeUnit.SECONDS);
- });
+ }).build());
}
}
}