When a plugin opens the inventory of a lectern for a player via
clicking the button for taking the book has no effect.
The cause of this issue is as follows:
CraftInventoryLectern (the inventory returned by the lectern BlockState) wraps the LecternInventory of TileEntityLectern#inventory. This inventory is only an IInventory, not an ITileInventory. When calling Player#openInventory, CraftBukkit checks whether this inventory is a tile inventory and then forwards it to EntityPlayer#openContainer. Otherwise, as it is the case here for the lectern inventory, the inventory is opened via CraftHumanEntity#openCustomInventory.
This latter method uses CraftContainer to open the inventory view, which is more limited and behaves differently compared to when vanilla Minecraft opens the lectern inventory via EntityPlayer#openContainer(lecternTileEntity). For instance, CraftContainer doesn't handle the callback
The regular ContainerLectern reacts to this callback by switching the book pages or taking the book item from the lectern.
I will prepare a PR to open the lectern inventory via EntityPlayer#openContainer instead, similar to how vanilla Minecraft does it.