-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
This server is running CraftBukkit version 4012-Spigot-864e4ac-76931e8 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT)
-
Yes
When trying to spawn an entity using World#spawn I get a console error. This was working on previous versions of the server, but appears to have stopped recently.
Minimal plugin
public class TestPlugin extends JavaPlugin implements Listener { @Override public void onEnable() { getLogger().info("Test plugin loaded"); Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onCreatureSpawn(final CreatureSpawnEvent e) { e.setCancelled(true); e.getLocation().getWorld().spawn(e.getLocation(), e.getEntity().getClass()); // Delaying spawn by waiting a tick also doesn't work and causes an error. } }
This is just the minimal way to cause the error. The actual method I usually use is World#spawn(location, entity class, function), where the function runs some clean up before the creature spawns, but I found that even without this, the error still occurs.
The error when trying to make a golem is:
[12:30:23] [Server thread/ERROR]: Could not pass event CreatureSpawnEvent to TestPlugin v1.0 org.bukkit.event.EventException: null at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_20_R3.event.CraftEventFactory.callCreatureSpawnEvent(CraftEventFactory.java:748) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at org.bukkit.craftbukkit.v1_20_R3.event.CraftEventFactory.doEntityAddEventCalling(CraftEventFactory.java:667) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.level.WorldServer.addEntity(WorldServer.java:1097) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.level.WorldServer.addFreshEntity(WorldServer.java:1034) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.world.level.block.BlockPumpkinCarved.a(BlockPumpkinCarved.java:96) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.world.level.block.BlockPumpkinCarved.a(BlockPumpkinCarved.java:85) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.world.level.block.BlockPumpkinCarved.b(BlockPumpkinCarved.java:60) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.world.item.ItemStack.a(ItemStack.java:425) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.level.PlayerInteractManager.a(PlayerInteractManager.java:559) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1580) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.network.protocol.game.PacketPlayInUseItem.a(PacketPlayInUseItem.java:37) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.network.protocol.game.PacketPlayInUseItem.a(PacketPlayInUseItem.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:33) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1147) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1060) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at java.lang.Thread.run(Thread.java:840) ~[?:?] Caused by: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.craftbukkit.v1_20_R3.entity.CraftIronGolem at org.bukkit.craftbukkit.v1_20_R3.CraftRegionAccessor.createEntity(CraftRegionAccessor.java:489) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at org.bukkit.craftbukkit.v1_20_R3.CraftRegionAccessor.spawn(CraftRegionAccessor.java:407) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at org.bukkit.craftbukkit.v1_20_R3.CraftRegionAccessor.spawn(CraftRegionAccessor.java:403) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at org.bukkit.craftbukkit.v1_20_R3.CraftRegionAccessor.spawn(CraftRegionAccessor.java:389) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4012-Spigot-864e4ac-76931e8] at us.tastybento.test.TestPlugin.onCreatureSpawn(TestPlugin.java:33) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 29 more [
The same error coincidentally popped up when Phantoms were trying to spawn.