use of org.bukkit.event.player.PlayerTakeLecternBookEvent in project Arclight by IzzelAliz.
the class LecternContainerMixin method arclight$takeBook.
@Inject(method = "enchantItem", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/inventory/IInventory;removeStackFromSlot(I)Lnet/minecraft/item/ItemStack;"))
public void arclight$takeBook(PlayerEntity playerIn, int id, CallbackInfoReturnable<Boolean> cir) {
PlayerTakeLecternBookEvent event = new PlayerTakeLecternBookEvent(((ServerPlayerEntityBridge) this.playerInventory.player).bridge$getBukkitEntity(), ((CraftInventoryLectern) getBukkitView().getTopInventory()).getHolder());
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
cir.setReturnValue(false);
}
}
Aggregations