From c9fda3a8849035f78f560ab7cadbb1bc5f0dd777 Mon Sep 17 00:00:00 2001 From: HarvelsX <90945793+HarvelsX@users.noreply.github.com> Date: Mon, 8 Apr 2024 09:46:41 +0300 Subject: [PATCH 1/5] Update repository & exclude all Oraxen dependencies; --- build.gradle.kts | 2 +- eco-core/core-plugin/build.gradle.kts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6ebfc7671..8fdfc69be 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -81,7 +81,7 @@ allprojects { maven("https://repo.md-5.net/content/groups/public/") // UltraEconomy - maven("https://repo.techscode.com/repository/maven-releases/") + maven("https://repo.techscode.com/repository/techscode-apis/") // PlayerPoints maven("https://repo.rosewooddev.io/repository/public/") diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index 924a69b40..8d2d3a042 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -37,7 +37,9 @@ dependencies { compileOnly("com.github.jiangdashao:matrix-api-repo:317d4635fd") compileOnly("com.gmail.nossr50.mcMMO:mcMMO:2.1.202") compileOnly("me.clip:placeholderapi:2.10.10") - compileOnly("com.github.oraxen:oraxen:1.155.0") + compileOnly("com.github.oraxen:oraxen:1.155.0") { + exclude(group = "*", module = "*") + } compileOnly("com.github.brcdev-minecraft:shopgui-api:3.0.0") compileOnly("com.github.LoneDev6:API-ItemsAdder:2.4.7") compileOnly("com.arcaniax:HeadDatabase-API:1.3.0") @@ -51,7 +53,7 @@ dependencies { compileOnly("com.github.Gypopo:EconomyShopGUI-API:1.4.6") compileOnly("com.github.N0RSKA:ScytherAPI:55a") compileOnly("com.ticxo.modelengine:api:R3.0.1") - compileOnly("me.TechsCode:UltraEconomyAPI:1.0.0") + compileOnly("me.TechsCode:UltraEconomyAPI:1.0.0_build-7") compileOnly("org.black_ixx:playerpoints:3.2.5") compileOnly("com.github.Ssomar-Developement:SCore:3.4.7") compileOnly("io.lumine:Mythic:5.2.1") From a42b829b82590bf79b390cd59d18058b58f4adac Mon Sep 17 00:00:00 2001 From: HarvelsX <90945793+HarvelsX@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:09:45 +0300 Subject: [PATCH 2/5] Folia support update; --- .../eco/core/scheduling/ScheduledTask.java | 36 ++++++++++ .../willfp/eco/core/scheduling/Scheduler.java | 58 ++++----------- .../internal/scheduling/EcoSchedulerSpigot.kt | 43 ++++++++--- .../internal/scheduling/EcoSchedulerFolia.kt | 72 ++++++++++++++----- eco-core/core-plugin/build.gradle.kts | 1 + 5 files changed, 137 insertions(+), 73 deletions(-) create mode 100644 eco-api/src/main/java/com/willfp/eco/core/scheduling/ScheduledTask.java diff --git a/eco-api/src/main/java/com/willfp/eco/core/scheduling/ScheduledTask.java b/eco-api/src/main/java/com/willfp/eco/core/scheduling/ScheduledTask.java new file mode 100644 index 000000000..51024fac5 --- /dev/null +++ b/eco-api/src/main/java/com/willfp/eco/core/scheduling/ScheduledTask.java @@ -0,0 +1,36 @@ +package com.willfp.eco.core.scheduling; + +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; + +public interface ScheduledTask { + @NotNull Plugin getOwningPlugin(); + + boolean isRepeatingTask(); + + @NotNull CancelledState cancel(); + + @NotNull ExecutionState getExecutionState(); + + default boolean isCancelled() { + ExecutionState state = this.getExecutionState(); + return state == ScheduledTask.ExecutionState.CANCELLED || state == ScheduledTask.ExecutionState.CANCELLED_RUNNING; + } + + public static enum ExecutionState { + IDLE, + RUNNING, + FINISHED, + CANCELLED, + CANCELLED_RUNNING; + } + + public static enum CancelledState { + CANCELLED_BY_CALLER, + CANCELLED_ALREADY, + RUNNING, + ALREADY_EXECUTED, + NEXT_RUNS_CANCELLED, + NEXT_RUNS_CANCELLED_ALREADY; + } +} diff --git a/eco-api/src/main/java/com/willfp/eco/core/scheduling/Scheduler.java b/eco-api/src/main/java/com/willfp/eco/core/scheduling/Scheduler.java index 8eef562bb..d5639d483 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/scheduling/Scheduler.java +++ b/eco-api/src/main/java/com/willfp/eco/core/scheduling/Scheduler.java @@ -19,7 +19,7 @@ public interface Scheduler { * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask runLater(@NotNull Runnable runnable, + default ScheduledTask runLater(@NotNull Runnable runnable, long ticksLater) { return runLater(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), (int) ticksLater, runnable); } @@ -35,7 +35,7 @@ default BukkitTask runLater(@NotNull Runnable runnable, * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask runLater(long ticksLater, + default ScheduledTask runLater(long ticksLater, @NotNull Runnable runnable) { return runLater(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), (int) ticksLater, runnable); } @@ -50,7 +50,7 @@ default BukkitTask runLater(long ticksLater, * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask runTimer(@NotNull Runnable runnable, + default ScheduledTask runTimer(@NotNull Runnable runnable, long delay, long repeat) { return runTimer(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), (int) delay, (int) repeat, runnable); @@ -68,7 +68,7 @@ default BukkitTask runTimer(@NotNull Runnable runnable, * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask runTimer(long delay, + default ScheduledTask runTimer(long delay, long repeat, @NotNull Runnable runnable) { return runTimer(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), (int) delay, (int) repeat, runnable); @@ -84,7 +84,7 @@ default BukkitTask runTimer(long delay, * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask runAsyncTimer(@NotNull Runnable runnable, + default ScheduledTask runAsyncTimer(@NotNull Runnable runnable, long delay, long repeat) { return runTimerAsync((int) delay, (int) repeat, runnable); @@ -102,7 +102,7 @@ default BukkitTask runAsyncTimer(@NotNull Runnable runnable, * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask runAsyncTimer(long delay, + default ScheduledTask runAsyncTimer(long delay, long repeat, @NotNull Runnable runnable) { return runTimerAsync((int) delay, (int) repeat, runnable); @@ -116,44 +116,10 @@ default BukkitTask runAsyncTimer(long delay, * @deprecated Does not work with Folia. */ @Deprecated(since = "6.53.0", forRemoval = true) - default BukkitTask run(@NotNull Runnable runnable) { + default ScheduledTask run(@NotNull Runnable runnable) { return run(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), runnable); } - /** - * Schedule the task to be run repeatedly on a timer. - * - * @param runnable The lambda to run. - * @param delay The amount of ticks to wait before the first execution. - * @param repeat The amount of ticks to wait between executions. - * @return The id of the task. - * @deprecated Not needed. - */ - @Deprecated(since = "6.53.0", forRemoval = true) - default int syncRepeating(@NotNull Runnable runnable, - long delay, - long repeat) { - return runTimer(runnable, delay, repeat).getTaskId(); - } - - /** - * Schedule the task to be ran repeatedly on a timer. - *
- * Reordered for better kotlin interop. - * - * @param runnable The lambda to run. - * @param delay The amount of ticks to wait before the first execution. - * @param repeat The amount of ticks to wait between executions. - * @return The id of the task. - * @deprecated Not needed. - */ - @Deprecated(since = "6.53.0", forRemoval = true) - default int syncRepeating(long delay, - long repeat, - @NotNull Runnable runnable) { - return runTimer(runnable, delay, repeat).getTaskId(); - } - /** * Cancel all running tasks from the linked {@link EcoPlugin}. */ @@ -165,7 +131,7 @@ default int syncRepeating(long delay, * @param task The lambda to run. * @return The created {@link BukkitTask}. */ - BukkitTask runAsync(@NotNull Runnable task); + ScheduledTask runAsync(@NotNull Runnable task); /** * Run a task. @@ -174,7 +140,7 @@ default int syncRepeating(long delay, * @param task The task. * @return The created {@link BukkitTask}. */ - BukkitTask run(@NotNull Location location, + ScheduledTask run(@NotNull Location location, @NotNull Runnable task); /** @@ -185,7 +151,7 @@ BukkitTask run(@NotNull Location location, * @param task The task. * @return The created {@link BukkitTask}. */ - BukkitTask runLater(@NotNull Location location, + ScheduledTask runLater(@NotNull Location location, int ticksLater, @NotNull Runnable task); @@ -198,7 +164,7 @@ BukkitTask runLater(@NotNull Location location, * @param task The task. * @return The created {@link BukkitTask}. */ - BukkitTask runTimer(@NotNull Location location, + ScheduledTask runTimer(@NotNull Location location, int delay, int repeat, @NotNull Runnable task); @@ -211,7 +177,7 @@ BukkitTask runTimer(@NotNull Location location, * @param task The task. * @return The created {@link BukkitTask}. */ - BukkitTask runTimerAsync(int delay, + ScheduledTask runTimerAsync(int delay, int repeat, @NotNull Runnable task); } diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerSpigot.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerSpigot.kt index d0c5cc9c7..b814377b9 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerSpigot.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerSpigot.kt @@ -1,33 +1,56 @@ package com.willfp.eco.internal.scheduling import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.scheduling.ScheduledTask import com.willfp.eco.core.scheduling.Scheduler import org.bukkit.Bukkit import org.bukkit.Location +import org.bukkit.plugin.Plugin import org.bukkit.scheduler.BukkitTask class EcoSchedulerSpigot(private val plugin: EcoPlugin) : Scheduler { - override fun runLater(location: Location, ticksLater: Int, task: Runnable): BukkitTask { - return Bukkit.getScheduler().runTaskLater(plugin, task, ticksLater.toLong()) + override fun runLater(location: Location, ticksLater: Int, task: Runnable): ScheduledTask { + return TaskAdapter(Bukkit.getScheduler().runTaskLater(plugin, task, ticksLater.toLong())) } - override fun runTimer(location: Location, delay: Int, repeat: Int, task: Runnable): BukkitTask { - return Bukkit.getScheduler().runTaskTimer(plugin, task, delay.toLong(), repeat.toLong()) + override fun runTimer(location: Location, delay: Int, repeat: Int, task: Runnable): ScheduledTask { + return TaskAdapter(Bukkit.getScheduler().runTaskTimer(plugin, task, delay.toLong(), repeat.toLong()), true) } - override fun run(location: Location, task: Runnable): BukkitTask { - return Bukkit.getScheduler().runTask(plugin, task) + override fun run(location: Location, task: Runnable): ScheduledTask { + return TaskAdapter(Bukkit.getScheduler().runTask(plugin, task)) } - override fun runAsync(task: Runnable): BukkitTask { - return Bukkit.getScheduler().runTaskAsynchronously(plugin, task) + override fun runAsync(task: Runnable): ScheduledTask { + return TaskAdapter(Bukkit.getScheduler().runTaskAsynchronously(plugin, task)) } - override fun runTimerAsync(delay: Int, repeat: Int, task: Runnable): BukkitTask { - return Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, task, delay.toLong(), repeat.toLong()) + override fun runTimerAsync(delay: Int, repeat: Int, task: Runnable): ScheduledTask { + return TaskAdapter(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, task, delay.toLong(), repeat.toLong()), true) } override fun cancelAll() { Bukkit.getScheduler().cancelTasks(plugin) } + + // Should we monitor the status of the task? + class TaskAdapter( + private val task: BukkitTask, + private val repeatable: Boolean = false + ) : ScheduledTask { + override fun getOwningPlugin(): Plugin = task.owner + + override fun isRepeatingTask(): Boolean = repeatable + + override fun cancel(): ScheduledTask.CancelledState = when (task.cancel().run { task.isCancelled }) { + true -> ScheduledTask.CancelledState.CANCELLED_ALREADY + false -> ScheduledTask.CancelledState.RUNNING + } + + override fun getExecutionState(): ScheduledTask.ExecutionState = when (task.isCancelled) { + true -> ScheduledTask.ExecutionState.CANCELLED + false -> ScheduledTask.ExecutionState.RUNNING + } + + } } \ No newline at end of file diff --git a/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt b/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt index 1a740fafa..eb3359f32 100644 --- a/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt +++ b/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt @@ -2,43 +2,54 @@ package com.willfp.eco.internal.scheduling import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.scheduling.Scheduler +import io.papermc.paper.threadedregions.scheduler.ScheduledTask import org.bukkit.Bukkit import org.bukkit.Location -import org.bukkit.scheduler.BukkitTask +import org.bukkit.plugin.Plugin import java.util.concurrent.TimeUnit class EcoSchedulerFolia(private val plugin: EcoPlugin) : Scheduler { - override fun runLater(runnable: Runnable, ticksLater: Long): BukkitTask { - Bukkit.getGlobalRegionScheduler().runDelayed(plugin, { runnable.run() }, ticksLater) + override fun runLater(runnable: Runnable, ticksLater: Long): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getGlobalRegionScheduler().runDelayed(plugin, { runnable.run() }, ticksLater)) } - override fun runLater(location: Location, ticksLater: Int, task: Runnable): BukkitTask { - Bukkit.getRegionScheduler().runDelayed(plugin, location, { task.run() }, ticksLater.toLong()) + override fun runLater( + location: Location, + ticksLater: Int, + task: Runnable + ): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getRegionScheduler().runDelayed(plugin, location, { task.run() }, ticksLater.toLong())) } - override fun runTimer(delay: Long, repeat: Long, runnable: Runnable): BukkitTask { - Bukkit.getGlobalRegionScheduler().runAtFixedRate(plugin, { runnable.run() }, delay, repeat) + override fun runTimer(delay: Long, repeat: Long, runnable: Runnable): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getGlobalRegionScheduler().runAtFixedRate(plugin, { runnable.run() }, delay, repeat)) } - override fun runTimer(location: Location, delay: Int, repeat: Int, task: Runnable): BukkitTask { - Bukkit.getRegionScheduler().runAtFixedRate(plugin, location, { task.run() }, delay.toLong(), repeat.toLong()) + override fun runTimer( + location: Location, + delay: Int, + repeat: Int, + task: Runnable + ): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getRegionScheduler().runAtFixedRate(plugin, location, { task.run() }, delay.toLong(), repeat.toLong())) } - override fun run(runnable: Runnable): BukkitTask { - Bukkit.getGlobalRegionScheduler().run(plugin) { runnable.run() } + override fun run(runnable: Runnable): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getGlobalRegionScheduler().run(plugin) { runnable.run() }) } - override fun run(location: Location, task: Runnable): BukkitTask { - Bukkit.getRegionScheduler().run(plugin, location) { task.run() } + override fun run(location: Location, task: Runnable): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getRegionScheduler().run(plugin, location) { task.run() }) } - override fun runAsync(task: Runnable): BukkitTask { - Bukkit.getAsyncScheduler().runNow(plugin) { task.run() } + override fun runAsync(task: Runnable): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getAsyncScheduler().runNow(plugin) { task.run() }) } - override fun runTimerAsync(delay: Int, repeat: Int, task: Runnable): BukkitTask { - Bukkit.getAsyncScheduler() + override fun runTimerAsync(delay: Int, repeat: Int, task: Runnable): com.willfp.eco.core.scheduling.ScheduledTask { + return TaskAdapter(Bukkit.getAsyncScheduler() .runAtFixedRate(plugin, { task.run() }, delay * 50L, repeat * 50L, TimeUnit.MILLISECONDS) + ) } override fun cancelAll() { @@ -46,4 +57,31 @@ class EcoSchedulerFolia(private val plugin: EcoPlugin) : Scheduler { Bukkit.getAsyncScheduler().cancelTasks(plugin) Bukkit.getGlobalRegionScheduler().cancelTasks(plugin) } + + class TaskAdapter( + private val task: ScheduledTask + ) : com.willfp.eco.core.scheduling.ScheduledTask { + override fun getOwningPlugin(): Plugin = task.owningPlugin + + override fun isRepeatingTask(): Boolean = task.isRepeatingTask + + override fun cancel(): com.willfp.eco.core.scheduling.ScheduledTask.CancelledState = when (task.cancel()) { + ScheduledTask.CancelledState.CANCELLED_BY_CALLER -> com.willfp.eco.core.scheduling.ScheduledTask.CancelledState.CANCELLED_BY_CALLER + ScheduledTask.CancelledState.CANCELLED_ALREADY -> com.willfp.eco.core.scheduling.ScheduledTask.CancelledState.CANCELLED_ALREADY + ScheduledTask.CancelledState.RUNNING -> com.willfp.eco.core.scheduling.ScheduledTask.CancelledState.RUNNING + ScheduledTask.CancelledState.ALREADY_EXECUTED -> com.willfp.eco.core.scheduling.ScheduledTask.CancelledState.ALREADY_EXECUTED + ScheduledTask.CancelledState.NEXT_RUNS_CANCELLED -> com.willfp.eco.core.scheduling.ScheduledTask.CancelledState.NEXT_RUNS_CANCELLED + ScheduledTask.CancelledState.NEXT_RUNS_CANCELLED_ALREADY -> com.willfp.eco.core.scheduling.ScheduledTask.CancelledState.NEXT_RUNS_CANCELLED_ALREADY + } + + override fun getExecutionState(): com.willfp.eco.core.scheduling.ScheduledTask.ExecutionState = + when (task.executionState) { + ScheduledTask.ExecutionState.IDLE -> com.willfp.eco.core.scheduling.ScheduledTask.ExecutionState.IDLE + ScheduledTask.ExecutionState.RUNNING -> com.willfp.eco.core.scheduling.ScheduledTask.ExecutionState.RUNNING + ScheduledTask.ExecutionState.FINISHED -> com.willfp.eco.core.scheduling.ScheduledTask.ExecutionState.FINISHED + ScheduledTask.ExecutionState.CANCELLED -> com.willfp.eco.core.scheduling.ScheduledTask.ExecutionState.CANCELLED + ScheduledTask.ExecutionState.CANCELLED_RUNNING -> com.willfp.eco.core.scheduling.ScheduledTask.ExecutionState.CANCELLED_RUNNING + } + + } } diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index 8d2d3a042..02fc61384 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -4,6 +4,7 @@ version = rootProject.version dependencies { compileOnly(project(":eco-core:core-proxy")) compileOnly(project(":eco-core:core-backend")) + compileOnly(project(":eco-core:core-folia")) // Libraries implementation("com.github.WillFP:Crunch:1.1.3") From 28885b724817a45983e99ee957dc473252af597d Mon Sep 17 00:00:00 2001 From: HarvelsX <90945793+HarvelsX@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:11:01 +0300 Subject: [PATCH 3/5] Fix intermediate errors; --- .../spigot/integrations/price/PriceFactoryUltraEconomy.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/price/PriceFactoryUltraEconomy.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/price/PriceFactoryUltraEconomy.kt index 9b350097d..7abbbe276 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/price/PriceFactoryUltraEconomy.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/price/PriceFactoryUltraEconomy.kt @@ -32,15 +32,15 @@ class PriceFactoryUltraEconomy(private val currency: Currency) : PriceFactory { get() = api.accounts.uuid(this.uniqueId).orElse(null) override fun canAfford(player: Player, multiplier: Double): Boolean { - return (player.account?.getBalance(currency)?.onHand ?: 0f) >= getValue(player, multiplier) + return (player.account?.getBalance(currency)?.onHand ?: 0f).toDouble() >= getValue(player, multiplier) } override fun pay(player: Player, multiplier: Double) { - player.account?.getBalance(currency)?.removeHand(getValue(player, multiplier).toFloat()) + player.account?.getBalance(currency)?.removeHand(getValue(player, multiplier)) } override fun giveTo(player: Player, multiplier: Double) { - player.account?.getBalance(currency)?.addHand(getValue(player, multiplier).toFloat()) + player.account?.getBalance(currency)?.addHand(getValue(player, multiplier)) } override fun getValue(player: Player, multiplier: Double): Double { From a6a6abca675d387944daf8feac425abd8ad72bd6 Mon Sep 17 00:00:00 2001 From: HarvelsX <90945793+HarvelsX@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:45:37 +0300 Subject: [PATCH 4/5] Fix HAS_FOLIA prerequisite; --- eco-api/src/main/java/com/willfp/eco/core/Prerequisite.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eco-api/src/main/java/com/willfp/eco/core/Prerequisite.java b/eco-api/src/main/java/com/willfp/eco/core/Prerequisite.java index 15d011661..8fdd84b8d 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/Prerequisite.java +++ b/eco-api/src/main/java/com/willfp/eco/core/Prerequisite.java @@ -87,7 +87,7 @@ public class Prerequisite { * Requires the server to be running an implementation of Folia. */ public static final Prerequisite HAS_FOLIA = new Prerequisite( - () -> ClassUtils.exists("io.papermc.paper.threadedregions.scheduler.RegionisedScheduler"), + () -> ClassUtils.exists("io.papermc.paper.threadedregions.scheduler.RegionScheduler"), "Requires server to be running Folia!" ); From d677da325564ea22c1e3dfc6dee8d3385932265c Mon Sep 17 00:00:00 2001 From: HarvelsX <90945793+HarvelsX@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:17:34 +0300 Subject: [PATCH 5/5] Fix including folia subproject and other things preventing startup. --- build.gradle.kts | 1 + .../com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt | 1 - .../com/willfp/eco/internal/spigot/drops/CollatedRunnable.kt | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8fdfc69be..95384f12e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ plugins { dependencies { implementation(project(":eco-api")) implementation(project(path = ":eco-core:core-plugin", configuration = "shadow")) + implementation(project(":eco-core:core-folia")) implementation(project(":eco-core:core-proxy")) implementation(project(":eco-core:core-backend")) implementation(project(path = ":eco-core:core-nms:v1_17_R1", configuration = "reobf")) diff --git a/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt b/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt index eb3359f32..308eda4f4 100644 --- a/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt +++ b/eco-core/core-folia/src/main/kotlin/com/willfp/eco/internal/scheduling/EcoSchedulerFolia.kt @@ -53,7 +53,6 @@ class EcoSchedulerFolia(private val plugin: EcoPlugin) : Scheduler { } override fun cancelAll() { - Bukkit.getScheduler().cancelTasks(plugin) Bukkit.getAsyncScheduler().cancelTasks(plugin) Bukkit.getGlobalRegionScheduler().cancelTasks(plugin) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/drops/CollatedRunnable.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/drops/CollatedRunnable.kt index ec08f56ad..789c1d99d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/drops/CollatedRunnable.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/drops/CollatedRunnable.kt @@ -22,6 +22,6 @@ class CollatedRunnable(plugin: EcoPlugin) { EcoFastCollatedDropQueue.COLLATED_MAP.remove(key) } EcoFastCollatedDropQueue.COLLATED_MAP.clear() - }, 0, 1) + }, 1, 1) } } \ No newline at end of file