APDevTeam / Movecraft-Cannons

Movecraft & Cannons Integration
GNU General Public License v3.0
6 stars 9 forks source link

Error on ship movement #3

Closed galacticwarrior9 closed 3 years ago

galacticwarrior9 commented 3 years ago

The following error is thrown upon each CraftPreTranslateEvent using the Movecraft-Cannons (v0.1.0) and Movecraft-Eirik jars bundled in the latest release with Cannons v2.5.8 on 1.16.4, preventing cannons data from being translated with the craft:

[23:44:11 ERROR]: Could not pass event CraftPreTranslateEvent to Movecraft-Cannons v0.1.0
java.lang.IllegalStateException: CannonBeforeCreateEvent may only be triggered synchronously.
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:595) ~[patched_1.16.4.jar:git-Purpur-949]
        at at.pavlov.cannons.cannon.CannonManager.getCannon(CannonManager.java:555) ~[?:?]
        at at.pavlov.cannons.cannon.CannonManager.getCannons(CannonManager.java:434) ~[?:?]
        at at.pavlov.cannons.API.CannonsAPI.getCannons(CannonsAPI.java:103) ~[?:?]
        at net.tylers1066.movecraftcannons.MovecraftCannons.getCannons(MovecraftCannons.java:91) ~[?:?]
        at net.tylers1066.movecraftcannons.listener.TranslationListener.translateListener(TranslationListener.java:18) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1103.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.4.jar:git-Purpur-949]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[patched_1.16.4.jar:git-Purpur-949]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.4.jar:git-Purpur-949]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.4.jar:git-Purpur-949]
        at net.countercraft.movecraft.async.translation.TranslationTask.execute(TranslationTask.java:162) ~[?:?]
        at net.countercraft.movecraft.async.AsyncTask.run(AsyncTask.java:45) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.4.jar:git-Purpur-949]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:58) ~[patched_1.16.4.jar:git-Purpur-949]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.4.jar:git-Purpur-949]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

CannonBeforeCreateEvent can be fired from the CannonManager#getCannon method, which is used by MovecraftCannons#getCannons, which is called asynchronously from the CraftPreTranslate listener. According to the first reply to this thread from the Spigot forums, sync events must be called from the main thread in 1.14+.

TylerS1066 commented 3 years ago

I'll have to look into what is happening here, it sounds like the cannons plugin is not properly dealing with async API calls, which may not be possible to fix.

Does this happen on both translation and rotation or just translation?

TylerS1066 commented 3 years ago

Upon discussion with @cccm5 it was found that this is a problem due to the way eirik's fork calls events async.

APDevTeam movecraft does not have this problem. As such I am dropping support for eirik's fork and closing this.