Search in sources :

Example 1 with BlockDamageAbortEvent

use of org.bukkit.event.block.BlockDamageAbortEvent in project Mohist by MohistMC.

the class CraftEventFactory method callBlockDamageAbortEvent.

public static BlockDamageAbortEvent callBlockDamageAbortEvent(ServerPlayer who, BlockPos pos, ItemStack itemstack) {
    Player player = who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
    Block blockClicked = CraftBlock.at(who.getLevel(), pos);
    BlockDamageAbortEvent event = new BlockDamageAbortEvent(player, blockClicked, itemInHand);
    player.getServer().getPluginManager().callEvent(event);
    return event;
}
Also used : CraftItemStack(org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack) ServerPlayer(net.minecraft.server.level.ServerPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer) Player(org.bukkit.entity.Player) BlockDamageAbortEvent(org.bukkit.event.block.BlockDamageAbortEvent) Block(org.bukkit.block.Block) CraftBlock(org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock)

Aggregations

ServerPlayer (net.minecraft.server.level.ServerPlayer)1 Block (org.bukkit.block.Block)1 CraftBlock (org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock)1 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)1 CraftItemStack (org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack)1 Player (org.bukkit.entity.Player)1 BlockDamageAbortEvent (org.bukkit.event.block.BlockDamageAbortEvent)1