Rollczi / LiteCommands

☄️ LiteCommands - Command framework for Velocity, Bukkit, Paper, BungeeCord, Minestom, Sponge, Fabric, JDA and future implementations.
https://docs.rollczi.dev/
Apache License 2.0
146 stars 21 forks source link

Folia support #426

Open BlackBaroness opened 2 months ago

BlackBaroness commented 2 months ago

Looks like the bukkit module uses the default BukkitScheduler to make async calls. Can we somehow adapt it so it will use Folia scheduler instead of that, when applicable?

Or, what could be even better, can we add a custom async call provider support? Like if I want to use Kotlin coroutines pool?

I'm not sure how to do this in the style of the project, so I open the issue instead of the PR.

Rollczi commented 2 months ago

Looks like the bukkit module uses the default BukkitScheduler to make async calls. Can we somehow adapt it so it will use Folia scheduler instead of that, when applicable?

Or, what could be even better, can we add a custom async call provider support? Like if I want to use Kotlin coroutines pool?

I'm not sure how to do this in the style of the project, so I open the issue instead of the PR.

Folia work with LiteCommands I guess... If do you want use Kotlin coroutines then you should implement Scheduler

vLuckyyy commented 2 months ago

Yesterday I tested a plugin to which I added folia support, it uses 100% litecommands, and everything worked fine, did you test it?

BlackBaroness commented 2 months ago

Yesterday I tested a plugin to which I added folia support, it uses 100% litecommands, and everything worked fine, did you test it?

I tested it before 3.5.0 release (it shouldn't fix that) and the @Async annotation is incompatible. Other functions are ok

Rollczi commented 2 months ago

Yesterday I tested a plugin to which I added folia support, it uses 100% litecommands, and everything worked fine, did you test it?

I tested it before 3.5.0 release (it shouldn't fix that) and the @Async annotation is incompatible. Other functions are ok

Fix what? and what is incompatible?

vLuckyyy commented 2 months ago

Yesterday I tested a plugin to which I added folia support, it uses 100% litecommands, and everything worked fine, did you test it?

I tested it before 3.5.0 release (it shouldn't fix that) and the @Async annotation is incompatible. Other functions are ok

You are right, commands that use the @Async annotation do not work

[00:47:29 WARN]: java.lang.UnsupportedOperationException
[00:47:29 WARN]:        at org.bukkit.craftbukkit.scheduler.CraftScheduler.handle(CraftScheduler.java:535)
[00:47:29 WARN]:        at org.bukkit.craftbukkit.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:259)
[00:47:29 WARN]:        at org.bukkit.craftbukkit.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:246)
[00:47:29 WARN]:        at org.bukkit.craftbukkit.scheduler.CraftScheduler.runTaskLaterAsynchronously(CraftScheduler.java:191)
[00:47:29 WARN]:        at org.bukkit.craftbukkit.scheduler.CraftScheduler.runTaskAsynchronously(CraftScheduler.java:160)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.bukkit.BukkitSchedulerImpl.supplyAsync(BukkitSchedulerImpl.java:63)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.bukkit.BukkitSchedulerImpl.supplyLater(BukkitSchedulerImpl.java:32)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.scheduler.Scheduler.supply(Scheduler.java:52)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.command.executor.CommandExecuteService.lambda$execute$4(CommandExecuteService.java:177)
[00:47:29 WARN]:        at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
[00:47:29 WARN]:        at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.command.executor.CommandExecuteService.execute(CommandExecuteService.java:152)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.command.executor.CommandExecuteService.execute0(CommandExecuteService.java:122)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.command.executor.CommandExecuteService.execute(CommandExecuteService.java:62)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.command.CommandManager$PlatformListener.execute(CommandManager.java:63)
[00:47:29 WARN]:        at EternalCore v1.3.4 (MC 1.17.x-1.21.x).jar//com.eternalcode.core.libs.dev.rollczi.litecommands.bukkit.BukkitCommand.execute(BukkitCommand.java:50)
[00:47:29 WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:165)
[00:47:29 WARN]:        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:1029)
[00:47:29 WARN]:        at org.bukkit.craftbukkit.CraftServer.dispatchServerCommand(CraftServer.java:980)
[00:47:29 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:521)
[00:47:29 WARN]:        at io.papermc.paper.threadedregions.RegionizedServer.globalTick(RegionizedServer.java:296)
[00:47:29 WARN]:        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.tickRegion(RegionizedServer.java:148)
[00:47:29 WARN]:        at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:404)
[00:47:29 WARN]:        at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525)
[00:47:29 WARN]:        at java.base/java.lang.Thread.run(Thread.java:1583)