As discussed in this SpigotMC thread, when using either ChunkPopulateEvent or ChunkLoadEvent and checking for mob spawners being created/existing and trying to replace it with another material, it sends this warning into the logs:
[07:52:10 WARN]: Tried to load a DUMMY block entity @ BlockPosition{x=186, y=37, z=327} but found not block entity block Block{minecraft:diamond_ore} at location
[07:52:10 WARN]: Tried to load a block entity for block Block{minecraft:diamond_ore} but failed at location BlockPosition{x=186, y=37, z=327}
These are the two pieces of code used:
@EventHandler public void onChunkPopulate(final ChunkPopulateEvent e) { final Chunk chunk = e.getChunk(); for(BlockState blockState : chunk.getTileEntities()) { if(blockState instanceof CreatureSpawner) { blockState.getBlock().setType(Material.DIAMOND_ORE); } } }
@EventHandler public void onChunkLoad(final ChunkLoadEvent e) { if(e.isNewChunk()) { for(BlockState tileEntity : e.getChunk().getTileEntities()) { if(tileEntity.getBlock().getType() == Material.SPAWNER) { final Location location = tileEntity.getLocation(); tileEntity.getBlock().setType(Material.AIR); } } } }