Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix beacons in folia #870

Merged
merged 5 commits into from
Jul 20, 2023
Merged

Conversation

Goosius1
Copy link
Collaborator

@Goosius1 Goosius1 commented Jul 19, 2023

Description:

  • With current code it looks like Folia doesn't like a "block.getType()" call in siegewar which is triggered by an event listener.
  • This was the report I got from a server owner:
[16:10:03 ERROR]: Could not pass event NewShortTimeEvent to SiegeWar v2.7.0
java.lang.NullPointerException: Cannot read field "captureTreeGeneration" because the return value of "net.minecraft.world.level.World.getCurrentWorldDa
ta()" is null
        at net.minecraft.world.level.Level.getBlockState(Level.java:811) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R1.block.CraftBlock.getType(CraftBlock.java:242) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at com.gmail.goosius.siegewar.utils.CosmeticUtil.createFakeBeacon(CosmeticUtil.java:78) ~[SiegeWar-2.7.0.jar:?]
        at com.gmail.goosius.siegewar.utils.CosmeticUtil.evaluateBeacon(CosmeticUtil.java:57) ~[SiegeWar-2.7.0.jar:?]
        at com.gmail.goosius.siegewar.utils.CosmeticUtil.evaluateBeacons(CosmeticUtil.java:35) ~[SiegeWar-2.7.0.jar:?]
        at com.gmail.goosius.siegewar.tasks.SiegeWarTimerTaskController.evaluateBeacons(SiegeWarTimerTaskController.java:95) ~[SiegeWar-2.7.0.jar:?]
        at com.gmail.goosius.siegewar.listeners.SiegeWarTownyEventListener.onShortTime(SiegeWarTownyEventListener.java:143) ~[SiegeWar-2.7.0.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor211.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:git-Folia-"6b978f2"]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[folia-1.20.1.jar:git-Folia-"6b978f2"]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[folia-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at com.palmergames.bukkit.util.BukkitTools.fireEvent(BukkitTools.java:352) ~[towny-0.99.5.3.jar:?]
        at com.palmergames.bukkit.towny.tasks.ShortTimerTask.run(ShortTimerTask.java:33) ~[towny-0.99.5.3.jar:?]
        at com.palmergames.bukkit.towny.scheduling.impl.FoliaTaskScheduler.lambda$runAsyncRepeating$11(FoliaTaskScheduler.java:115) ~[towny-0.99.5.3.jar
:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler$AsyncScheduledTask.run(FoliaAsyncScheduler.java:216) ~[folia-1.20.1.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:833) ~[?:?]
  • I believe this PR should fix it, but putting the getType call onto a scheduler.
  • I don't have Folia myself so I can't fully test this now, but its a small change so maybe someone with Folia knowledge can just confirm if it will fix the issue

New Nodes/Commands/ConfigOptions:

N/A


Relevant Issue ticket:

N/A


  • I have tested this pull request for defects on a server.

By making this pull request, I represent that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the TownyAdvanced organization has the copyright to use and modify my contribution under the SiegeWar License for perpetuity.

@Goosius1 Goosius1 added the bug Something isn't working label Jul 19, 2023
@Goosius1 Goosius1 added this to the 2.7.1 milestone Jul 19, 2023
@Goosius1 Goosius1 requested a review from LlmDl July 19, 2023 20:56
@Goosius1 Goosius1 merged commit 6689723 into TownyAdvanced:master Jul 20, 2023
@Goosius1 Goosius1 deleted the fix_beacons_in_folia branch July 20, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants