TownyAdvanced / SiegeWar

A war plugin for Towny.
https://townyadvanced.github.io/
Other
60 stars 38 forks source link

Issue: SpecialWarSicknessNow not firing due to "NewShortTimeEvent" #898

Closed GoodrichDev closed 5 months ago

GoodrichDev commented 5 months ago

Describe the bug This bug was caught on the EarthPol Folia Beta test, it started to occur when someone showed up to the SiegeWar zone and left the town and started killing everyone around the banner.

To Reproduce Steps to reproduce the behavior:

  1. Join a Siege on a Folia Server
  2. Leave your town
  3. Review console for this error

Expected behavior The offending player should receive war sickness

Screenshots No screenshots

Versions (please complete the following information):

GoodrichDev commented 5 months ago

Offending line: https://github.com/TownyAdvanced/SiegeWar/blob/master/src/main/java/com/gmail/goosius/siegewar/utils/SiegeWarSicknessUtil.java#L137

[19:26:02 ERROR]: Could not pass event NewShortTimeEvent to SiegeWar v2.8.1
java.lang.UnsupportedOperationException: null
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.handle(CraftScheduler.java:535) ~[folia-1.20.4.jar:git-Folia-24]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:235) ~[folia-1.20.4.jar:git-Folia-24]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:211) ~[folia-1.20.4.jar:git-Folia-24]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.runTaskLater(CraftScheduler.java:175) ~[folia-1.20.4.jar:git-Folia-24]
        at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.runTask(CraftScheduler.java:144) ~[folia-1.20.4.jar:git-Folia-24]
        at com.gmail.goosius.siegewar.utils.SiegeWarSicknessUtil.givePlayerSpecialWarSicknessNow(SiegeWarSicknessUtil.java:137) ~[SiegeWar-2.8.1.jar:?]
        at com.gmail.goosius.siegewar.utils.SiegeWarSicknessUtil.evaluateWarSickness(SiegeWarSicknessUtil.java:66) ~[SiegeWar-2.8.1.jar:?]
        at com.gmail.goosius.siegewar.tasks.SiegeWarTimerTaskController.evaluateWarSickness(SiegeWarTimerTaskController.java:90) ~[SiegeWar-2.8.1.jar:?]
        at com.gmail.goosius.siegewar.listeners.SiegeWarTownyEventListener.onShortTime(SiegeWarTownyEventListener.java:139) ~[SiegeWar-2.8.1.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor253.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[folia-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[folia-api-1.20.4-R0.1-SNAPSHOT.jar:git-Folia-24]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[folia-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[folia-1.20.4.jar:git-Folia-24]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[folia-1.20.4.jar:git-Folia-24]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[folia-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at com.palmergames.bukkit.util.BukkitTools.fireEvent(BukkitTools.java:373) ~[towny-0.100.1.23.jar:?]
        at com.palmergames.bukkit.towny.tasks.ShortTimerTask.run(ShortTimerTask.java:33) ~[towny-0.100.1.23.jar:?]
        at com.palmergames.bukkit.towny.scheduling.impl.FoliaTaskScheduler.lambda$runAsyncRepeating$11(FoliaTaskScheduler.java:115) ~[towny-0.100.1.23.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler$AsyncScheduledTask.run(FoliaAsyncScheduler.java:217) ~[folia-1.20.4.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
LlmDl commented 5 months ago

Probably just a matter of specifying the player in the task creation, did you want to make a pull request?