Could not pass event EntityChangeBlockEvent
WorldEdit Version
7.3.17 Beta 1
WorldGuard Version
7.0.14
Platform Version
Paper 1.21.8-60-main@29c882
Confirmations
- [x] I am using the most recent Minecraft release.
- [x] I am using a version of WorldEdit compatible with my Minecraft version.
- [x] I am using a version of WorldGuard compatible with my Minecraft version.
- [x] I am using the latest or recommended version of my platform software.
- [x] I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
- [x] I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)
Bug Description
Keep getting;
[Server thread/ERROR]: Could not pass event EntityChangeBlockEvent to WorldGuard v7.0.14+2339-43997ec
java.lang.NullPointerException: null
in the console.
The error appears simultaneously with entities (passive mobs, carts, item frames) disappearing all around the server on loaded chunks.
Expected Behavior
Entities not disappearing.
Reproduction Steps
No found ways for clear reproduction.
Optional WorldGuard-Report
https://paste.enginehub.org/6BXKg9H-_.report
Anything Else?
We suspect it might be linked to entities randomly disappearing. Tested it with both WE 7.3.16 and 7.3.17 Beta 1, error still occurs.
Can you reproduce the issue on a server with only worldedit and WorldGuard? You have a lot of plugins, probably some plugin creates those issues.
Also please upload full logs. We can't help without the logs or missing stack traces.
I am also having this error
[01:24:10 ERROR]: Could not pass event EntityChangeBlockEvent to WorldGuard v7.0.14+2339-43997ec java.lang.NullPointerException: Cannot invoke "org.bukkit.World.getBlockAt(org.bukkit.Location)" because the return value of "org.bukkit.Location.getWorld()" is null at org.bukkit.Location.getBlock(Location.java:131) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at worldguard-bukkit-7.0.14-dist (3).jar/com.sk89q.worldguard.bukkit.cause.Cause$Builder.addAll(Cause.java:345) ~[worldguard-bukkit-7.0.14-dist (3).jar:?] at worldguard-bukkit-7.0.14-dist (3).jar/com.sk89q.worldguard.bukkit.cause.Cause.create(Cause.java:226) ~[worldguard-bukkit-7.0.14-dist (3).jar:?] at worldguard-bukkit-7.0.14-dist (3).jar/com.sk89q.worldguard.bukkit.listener.EventAbstractionListener.onEntityChangeBlock(EventAbstractionListener.java:335) ~[worldguard-bukkit-7.0.14-dist (3).jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:71) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(CraftEventFactory.java:1235) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(CraftEventFactory.java:1227) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.world.entity.item.FallingBlockEntity.tick(FallingBlockEntity.java:212) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1277) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.world.level.Level.guardEntityTick(Level.java:1483) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.level.ServerLevel.lambda$tick$4(ServerLevel.java:811) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:39) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:793) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1725) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1531) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1253) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
[01:24:10 ERROR]: Could not pass event EntityChangeBlockEvent to WorldGuard v7.0.14+2339-43997ec java.lang.NullPointerException: Cannot invoke "org.bukkit.World.getBlockAt(org.bukkit.Location)" because the return value of "org.bukkit.Location.getWorld()" is null at org.bukkit.Location.getBlock(Location.java:131) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at worldguard-bukkit-7.0.14-dist (3).jar/com.sk89q.worldguard.bukkit.cause.Cause$Builder.addAll(Cause.java:345) ~[worldguard-bukkit-7.0.14-dist (3).jar:?] at worldguard-bukkit-7.0.14-dist (3).jar/com.sk89q.worldguard.bukkit.cause.Cause.create(Cause.java:226) ~[worldguard-bukkit-7.0.14-dist (3).jar:?] at worldguard-bukkit-7.0.14-dist (3).jar/com.sk89q.worldguard.bukkit.listener.EventAbstractionListener.onEntityChangeBlock(EventAbstractionListener.java:335) ~[worldguard-bukkit-7.0.14-dist (3).jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:71) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21.8-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(CraftEventFactory.java:1235) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(CraftEventFactory.java:1227) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.world.entity.item.FallingBlockEntity.tick(FallingBlockEntity.java:212) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1277) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.world.level.Level.guardEntityTick(Level.java:1483) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.level.ServerLevel.lambda$tick$4(ServerLevel.java:811) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:39) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:793) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1725) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1531) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1253) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.8.jar:1.21.8-60-29c8822] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]![]()
That error implies that your game is sending events in a world that doesn't exist / is not valid. This is either an issue in Paper itself, or another plugin is adding invalid data to the game (eg, invalid worlds, entities, etc)
We're facing the exact same issue on our server, and while I understand that it is not caused by WorldGuard, but merely surfaces within it due to an abnormality of the data provided with the event, I have to say that it is >extremely< hard to isolate, seeing how it only occurs very spontaneously, and removing various other plugins is not a thing one can easily do on the public live server.
I did report it on the Paper Discord a while back, but people also just told me that another plugin causes it, and thus dismissed my report. I wonder whether we will ever get this resolved.
Just to add some more context to this thread - the issue is related to falling blocks: https://github.com/EngineHub/WorldGuard/blob/b7e9c4c7f12ead0b0047d1ef1fc2accfd4d54d16/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java#L345
Thus, I'm really unsure of what plugin would cause that... To me, this is a Paper-bug, and I just want to get on with my day. Since the plugin is open-source, I'll be recompiling with the following simple change:
diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java
index 84f0c3f6..ccca2e50 100644
--- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java
+++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java
@@ -340,7 +340,7 @@ private void addAll(@Nullable Object... element) {
((LightningStrike) o).getCausingEntity() != null) {
indirect = true;
addAll(((LightningStrike) o).getCausingEntity());
- } else if (o instanceof FallingBlock f && PaperLib.isPaper() && f.getOrigin() != null) {
+ } else if (o instanceof FallingBlock f && PaperLib.isPaper() && f.getOrigin() != null && f.getOrigin().getWorld() != null) {
indirect = true;
addAll(f.getOrigin().getBlock());
}