-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major
-
None
-
Affects Version/s: None
-
None
-
This server is running CraftBukkit version 4272-Spigot-34bd42b-76f59e3 (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
-
testplugin
-
Yes
Calling getTileEntities on the chunk returned by ChunkUnloadEvent throws an error.
[12:44:03] [Server thread/ERROR]: Could not pass event ChunkUnloadEvent to testplugin v1.0-SNAPSHOT org.bukkit.event.EventException: null at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:601) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:588) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?] at net.minecraft.world.level.chunk.Chunk.unloadCallback(Chunk.java:590) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.PlayerChunk.lambda$updateFutures$7(PlayerChunk.java:324) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.PlayerChunkMap$CallbackExecutor.run(PlayerChunkMap.java:167) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.PlayerChunk.a(PlayerChunk.java:334) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.ChunkMapDistance.lambda$runAllUpdates$1(ChunkMapDistance.java:128) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] at net.minecraft.server.level.ChunkMapDistance.a(ChunkMapDistance.java:127) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.ChunkProviderServer.s(ChunkProviderServer.java:290) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.ChunkProviderServer$b.B(ChunkProviderServer.java:614) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.level.ChunkProviderServer.d(ChunkProviderServer.java:286) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.MinecraftServer.bv(MinecraftServer.java:1258) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.MinecraftServer.B(MinecraftServer.java:1242) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.util.thread.IAsyncTaskHandler.b(SourceFile:145) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1207) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.MinecraftServer.v_(MinecraftServer.java:1214) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1078) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at java.base/java.lang.Thread.run(Thread.java:1583) [?:?] Caused by: java.lang.IllegalStateException: Chunk not there when requested: Unloaded chunk at net.minecraft.server.level.ChunkProviderServer.a(ChunkProviderServer.java:156) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.world.level.World.a(World.java:298) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at net.minecraft.world.level.IWorldReader.a(SourceFile:156) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at org.bukkit.craftbukkit.v1_21_R1.CraftChunk.getHandle(CraftChunk.java:87) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at org.bukkit.craftbukkit.v1_21_R1.CraftChunk.getTileEntities(CraftChunk.java:183) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4272-Spigot-34bd42b-76f59e3] at me.taucu.testplugin.TestPlugin.onChunkUnload(TestPlugin.java:18) ~[?:?] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?] ... 21 more
It can be produced by the following code:
@Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler public void onChunkUnload(ChunkUnloadEvent e) { for (org.bukkit.block.BlockState state : e.getChunk().getTileEntities()) { //weeeeeee } }
This effectively renders the getTileEntities method useless.
I have not tested if it affects block related functions.
- duplicates
-
SPIGOT-7780 Set block during chunk unload: "Chunk not there when requested: Unloaded chunk"
- Resolved