SirBlobman / CombatLogX

A modular Spigot plugin that prevents players from logging out during combat and has many expansions for extra features.
https://www.spigotmc.org/resources/31689/
GNU General Public License v3.0
154 stars 52 forks source link

Fix async location lookup for Folia in ForceField expansion. #829

Closed byteful closed 5 months ago

byteful commented 6 months ago

This PR should fix some issues that the ForceField expansion caused on Folia 1.20.4.

[15:53:58 WARN]: [CombatLogX] Async task for CombatLogX v11.4.0.1.1193 generated an exception
java.lang.NullPointerException: Cannot read field "captureTreeGeneration" because the return value of "net.minecraft.world.level.World.getCurrentWorldData()" is null
        at net.minecraft.world.level.Level.getBlockState(Level.java:1215) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R3.block.CraftBlock.getType(CraftBlock.java:238) ~[folia-1.20.4.jar:git-Folia-"25ee657"]
        at combatlogx.expansion.force.field.task.ForceFieldTask.canPlace(ForceFieldTask.java:178) ~[?:?]
[14:03:34 ERROR]: [CombatLogX] Unhandled exception occurred in onPacketReceiving(PacketEvent) for CombatLogX
java.lang.NullPointerException: Cannot read field "captureTreeGeneration" because the return value of "net.minecraft.world.level.World.getCurrentWorldData()" is null
        at net.minecraft.world.level.Level.getBlockState(Level.java:1215) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R3.block.CraftBlock.getType(CraftBlock.java:238) ~[folia-1.20.4.jar:git-Folia-"25ee657"]
        at combatlogx.expansion.force.field.task.ForceFieldTask.canPlace(ForceFieldTask.java:178) ~[?:?]
SirBlobman commented 5 months ago

Thanks for the fix, I haven't tested Force Field on Folia yet. Was waiting for a region expansion to add support and then I got busy and forgot.