mfnalex / Spigot-UpdateChecker

UpdateChecker for your Spigot plugins with only one line of code needed in your plugin!
GNU General Public License v3.0
52 stars 14 forks source link

Folia Support #28

Open Wolfieheart opened 1 year ago

Wolfieheart commented 1 year ago

Alot of Plugin Developers seem to be migrating their Schedulers to support Folia

Is there a chance that we could foresee Folia Support going foward, so people who are busy migrating Plugins to Also support Folia, as wel as Spigot/Paper etc. also can continue to use the UpdateChecker Functionality?

mfnalex commented 1 year ago

What exactly is the issue with the Bukkit Scheduler?

Wolfieheart commented 1 year ago

AFAIK (and someone please correct me if I am wrong here, this is my own understanding of the API):

In UpdateChecker (and most other plugins) case -> means having to wait for the mainthread to be free to for example perform the request out to check if a plugin is up-to-date or perform a command for a plugin

No Main Thread = Every Region that a player is in has 20TPS uniquely and means that commands aren't clogged on the MainThread.

TLDR:

mfnalex commented 1 year ago

If Folia properly implements the Bukkit API, I don't understand what the issue would be. The UpdateChecker has nothing to do with chunks, regions, entities, or anything similar.

If there any bugs on Folia that can only be fixed by using folia-specific API, then anyone is of course free to pull request a fix, as long as it doesn't break compatibility with actual CraftBukkit/Spigot.

Do you get any stacktraces on Folia? If so, please send them here

Wolfieheart commented 1 year ago

Do you get any stacktraces on Folia? If so, please send them here

Sorry for the delay with replying to this one, as I have been busy both IRL and haven't had a moment to check up on issues made elsewhere. Yes I do.

[19:57:51 INFO]: Wolfiebot issued server command: /ase update
[19:57:51 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'ase' in plugin ArmorStandEditor v1.19.4-43
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchCommand(CraftServer.java:1017) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at org.bukkit.craftbukkit.v1_19_R3.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[folia-1.19.4.jar:?]
    at net.minecraft.commands.Commands.performCommand(Commands.java:322) ~[?:?]
    at net.minecraft.commands.Commands.performCommand(Commands.java:306) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2310) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$16(ServerGamePacketListenerImpl.java:2270) ~[?:?]
    at io.papermc.paper.threadedregions.EntityScheduler.executeTick(EntityScheduler.java:173) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1533) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at io.papermc.paper.threadedregions.TickRegions$ConcreteRegionTickHandle.tickRegion(TickRegions.java:360) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:385) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.UnsupportedOperationException
    at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.handle(CraftScheduler.java:536) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:260) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskTimerAsynchronously(CraftScheduler.java:247) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskLaterAsynchronously(CraftScheduler.java:192) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftScheduler.runTaskAsynchronously(CraftScheduler.java:161) ~[folia-1.19.4.jar:git-Folia-"47105ea"]
    at io.github.rypofalem.armorstandeditor.updatechecker.UpdateChecker.checkNow(UpdateChecker.java:307) ~[armorstandeditor-1.19.4-43.jar:?]
    at io.github.rypofalem.armorstandeditor.CommandEx.commandUpdate(CommandEx.java:223) ~[armorstandeditor-1.19.4-43.jar:?]
    at io.github.rypofalem.armorstandeditor.CommandEx.onCommand(CommandEx.java:93) ~[armorstandeditor-1.19.4-43.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]
    ... 14 more

Current output of /version: This server is running Folia version git-Folia-"47105ea" (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 47105ea) You are running the latest version Previous version: git-Folia-"41c5548" (MC: 1.19.4)

TrueMB commented 3 months ago

Folia stopped supporting the default Bukkit.getScheduler. They added their own 4 different Thread handlers, since they aim for multithreading. In this case, like you also said, it has nothing to do with entities, chunks, regions, etc. So the global Scheduler does the Job: GlobalRegionScheduler globalScheduler = this.instance.getServer().getGlobalRegionScheduler(); globalScheduler.runAtFixedRate(this.instance, (t) -> ...., delayInTicks, periodeInTicks);