RonanPlugins / BetterRTP

Official wiki of the BetterRTP plugin!
https://www.spigotmc.org/resources/36081/
MIT License
108 stars 83 forks source link

fix cannot add effects to entities async #162

Closed ewof closed 9 months ago

ewof commented 1 year ago

fixes this error that happens

[04:52:07 ERROR]: Thread Region Scheduler Thread #0 failed main thread check: Cannot add effects to entities asynchronously
java.lang.Throwable: null
        at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:78) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1148) ~[?:?]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1140) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R1.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:463) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at org.bukkit.craftbukkit.v1_20_R1.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:457) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at org.bukkit.craftbukkit.v1_20_R1.entity.CraftLivingEntity.addPotionEffects(CraftLivingEntity.java:471) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at me.SuperRonanCraft.BetterRTP.player.rtp.effects.RTPEffect_Potions.giveEffects(RTPEffect_Potions.java:62) ~[BetterRTP-3.6.10.jar:?]
        at me.SuperRonanCraft.BetterRTP.player.rtp.RTPTeleport.afterTeleport(RTPTeleport.java:79) ~[BetterRTP-3.6.10.jar:?]
        at me.SuperRonanCraft.BetterRTP.player.rtp.RTPTeleport$1.run(RTPTeleport.java:58) ~[BetterRTP-3.6.10.jar:?]
        at java.util.concurrent.CompletableFuture.uniRunNow(CompletableFuture.java:819) ~[?:?]
        at java.util.concurrent.CompletableFuture.uniRunStage(CompletableFuture.java:803) ~[?:?]
        at java.util.concurrent.CompletableFuture.thenRun(CompletableFuture.java:2195) ~[?:?]
        at me.SuperRonanCraft.BetterRTP.player.rtp.RTPTeleport.sendPlayer(RTPTeleport.java:55) ~[BetterRTP-3.6.10.jar:?]
        at me.SuperRonanCraft.BetterRTP.player.rtp.RTPPlayer.lambda$attempt$3(RTPPlayer.java:97) ~[BetterRTP-3.6.10.jar:?]
        at com.tcoded.folialib.impl.FoliaImplementation.lambda$runNextTick$0(FoliaImplementation.java:38) ~[BetterRTP-3.6.10.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler.lambda$execute$0(FoliaGlobalRegionScheduler.java:46) ~[folia-1.20.1.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler$GlobalScheduledTask.run(FoliaGlobalRegionScheduler.java:178) ~[folia-1.20.1.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler.tick(FoliaGlobalRegionScheduler.java:36) ~[folia-1.20.1.jar:?]
        at io.papermc.paper.threadedregions.RegionizedServer.globalTick(RegionizedServer.java:294) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.tickRegion(RegionizedServer.java:149) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:385) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
SuperRonanCraft commented 9 months ago

Hey mate, thank you! I found the issue and done something similar to fix this in commit https://github.com/RonanPlugins/BetterRTP/commit/b4dae7d