JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13
https://commandapi.jorel.dev
MIT License
528 stars 66 forks source link

Add Folia Support #432

Closed Boy0000 closed 1 year ago

Boy0000 commented 1 year ago

CommandAPI version

8.8.0

Minecraft version

1.19.3

Are you shading the CommandAPI?

Yes

What I did

Trying to load my plugin on Folia, but it fails due to CommandAPI's use of schedulers

[14:05:24 ERROR]: Error occurred while enabling Oraxen v1.155.2 (Is it up to date?)
java.lang.UnsupportedOperationException: null
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.handle(CraftScheduler.java:536) ~[folia-1.19.4.jar:git-Folia-"17a3236"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:236) ~[folia-1.19.4.jar:git-Folia-"17a3236"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:212) ~[folia-1.19.4.jar:git-Folia-"17a3236"]
        at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskLater(CraftScheduler.java:176) ~[folia-1.19.4.jar:git-Folia-"17a3236"]
        at dev.jorel.commandapi.CommandAPI.onEnable(CommandAPI.java:195) ~[?:?]
        at io.th0rgal.oraxen.OraxenPlugin.onEnable(OraxenPlugin.java:103) ~[oraxen-1.155.2.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:279) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]

What actually happened

CommandAPI uses schedulers in a non-supported way

What should have happened

Shouldnt have failed

Server logs and CommandAPI config

No response

Other

No response

JorelAli commented 1 year ago

We're aware of Folia! We have some plans to look at supporting Folia after 9.0.0's release. Since Folia is currently a fairly new project with no official releases yet, as well as (at the time of writing), no support for datapacks (via the /datapack command for example), Folia support is not a high priority if the work required to support it turns out to be exceptionally great.

JorelAli commented 1 year ago

Basic Folia support has been added and will be included in the 9.0.1 release.

This Folia support doesn't support datapacks and skips the CommandAPI's datapack reloading sequence. Basic command registration works and basic arguments seem to work with no problems. Arguments that require complex (possibly thread-unsafe operations, such as the function argument, possibly anything to do with the location argument any other cross-region or world directory lookups) may not work, but these haven't been tested or explored to compile a full list of "this feature works" and "this feature doesn't work".

JorelAli commented 1 year ago

Implemented in the 9.0.1 release.