Search in sources :

Example 1 with EntityChangeBlockEvent

use of org.bukkit.event.entity.EntityChangeBlockEvent in project Glowstone by GlowstoneMC.

the class BlockRedstoneOre method blockInteract.

@Override
public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) {
    EntityChangeBlockEvent changeBlockEvent = new EntityChangeBlockEvent(player, block, Material.GLOWING_REDSTONE_ORE, (byte) 0);
    EventFactory.callEvent(changeBlockEvent);
    if (!changeBlockEvent.isCancelled()) {
        GlowBlockState state = block.getState();
        state.setType(Material.GLOWING_REDSTONE_ORE);
        state.update(true);
    }
    return false;
}
Also used : GlowBlockState(net.glowstone.block.GlowBlockState) EntityChangeBlockEvent(org.bukkit.event.entity.EntityChangeBlockEvent)

Aggregations

GlowBlockState (net.glowstone.block.GlowBlockState)1 EntityChangeBlockEvent (org.bukkit.event.entity.EntityChangeBlockEvent)1