Skip to content

Commit

Permalink
fix: use async timer
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Dec 24, 2023
1 parent 2f34136 commit a529bc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.8.1"
version = "6.8.2"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ public static void schedule(int minutes) {
int maxTicks = minutes * 60 * 20;
ACTIONS.forEach((seconds, actions) -> {
if (seconds < minutes * 60) {
BukkitTask task = Bukkit.getScheduler().runTaskLater(LifeCore.getPlugin(LifeCore.class), () -> {
for (Action action : actions) {
action.execute(seconds);
}
BukkitTask task = Bukkit.getScheduler().runTaskLaterAsynchronously(LifeCore.getPlugin(LifeCore.class), () -> {
Bukkit.getScheduler().runTask(LifeCore.getPlugin(LifeCore.class), () -> {
for (Action action : actions) {
action.execute(seconds);
}
});
}, maxTicks - seconds * 20);
tasks.add(task);
}
Expand Down

0 comments on commit a529bc6

Please sign in to comment.