org.bukkit.event.block.BlockPhysicsEvent#isCancelled ( )源码实例Demo

下面列出了org.bukkit.event.block.BlockPhysicsEvent#isCancelled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Carbon-2   文件: BlockPlant.java
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
    if (!f(world, blockposition, iblockdata)) {
        // CraftBukkit Start
        org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
        @SuppressWarnings("deprecation")
        BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            return;
        }
        // CraftBukkit end
        this.b(world, blockposition, iblockdata, 0);
        world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
    }

}
 
源代码2 项目: Carbon-2   文件: BlockPlant.java
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
    if (!f(world, blockposition, iblockdata)) {
        // CraftBukkit Start
        org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
        @SuppressWarnings("deprecation")
        BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            return;
        }
        // CraftBukkit end
        this.b(world, blockposition, iblockdata, 0);
        world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
    }

}
 
@Override
public void updateNeighbors(BlockPosition pos, IBlockData oldState, IBlockData newState, int recursionLimit) {
    World world = getWorld();
    // a == updateNeighbors
    // b == updateDiagonalNeighbors
    oldState.b(world, pos, NOTIFY, recursionLimit);
    if (sideEffectSet.shouldApply(SideEffect.EVENTS)) {
        CraftWorld craftWorld = world.getWorld();
        if (craftWorld != null) {
            BlockPhysicsEvent event = new BlockPhysicsEvent(craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), CraftBlockData.fromData(newState));
            world.getServer().getPluginManager().callEvent(event);
            if (event.isCancelled()) {
                return;
            }
        }
    }
    newState.a(world, pos, NOTIFY, recursionLimit);
    newState.b(world, pos, NOTIFY, recursionLimit);
}
 
@Override
public void updateNeighbors(BlockPosition pos, IBlockData oldState, IBlockData newState, int recursionLimit) {
    World world = getWorld();
    // a == updateNeighbors
    // b == updateDiagonalNeighbors
    oldState.b(world, pos, NOTIFY);
    if (sideEffectSet.shouldApply(SideEffect.EVENTS)) {
        CraftWorld craftWorld = world.getWorld();
        if (craftWorld != null) {
            BlockPhysicsEvent event = new BlockPhysicsEvent(craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), CraftBlockData.fromData(newState));
            world.getServer().getPluginManager().callEvent(event);
            if (event.isCancelled()) {
                return;
            }
        }
    }
    newState.a(world, pos, NOTIFY);
    newState.b(world, pos, NOTIFY);
}
 
@Override
public void updateNeighbors(BlockPosition pos, IBlockData oldState, IBlockData newState, int recursionLimit) {
    World world = getWorld();
    // a == updateNeighbors
    // b == updateDiagonalNeighbors
    oldState.b(world, pos, NOTIFY);
    if (sideEffectSet.shouldApply(SideEffect.EVENTS)) {
        CraftWorld craftWorld = world.getWorld();
        if (craftWorld != null) {
            BlockPhysicsEvent event = new BlockPhysicsEvent(
                craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()),
                CraftBlockData.fromData(newState));
            world.getServer().getPluginManager().callEvent(event);
            if (event.isCancelled()) {
                return;
            }
        }
    }
    newState.a(world, pos, NOTIFY);
    newState.b(world, pos, NOTIFY);
}
 
@Override
public void updateNeighbors(BlockPosition pos, IBlockData oldState, IBlockData newState, int recursionLimit) {
    World world = getWorld();
    // a == updateNeighbors
    // b == updateDiagonalNeighbors
    oldState.b(world, pos, NOTIFY);
    if (sideEffectSet.shouldApply(SideEffect.EVENTS)) {
        CraftWorld craftWorld = world.getWorld();
        if (craftWorld != null) {
            BlockPhysicsEvent event = new BlockPhysicsEvent(
                craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()),
                CraftBlockData.fromData(newState));
            world.getServer().getPluginManager().callEvent(event);
            if (event.isCancelled()) {
                return;
            }
        }
    }
    newState.a(world, pos, NOTIFY);
    newState.b(world, pos, NOTIFY);
}