Java 类org.bukkit.event.block.BlockPistonEvent 实例源码

项目:ProjectAres    文件:BlockTransformListener.java   
private void finishPistonMove(BlockPistonEvent causeEvent, Collection<BlockTransformEvent> wrapperEvents) {
    // If ANY of the pushed block events are cancelled, the piston jams and the entire causing event is cancelled.
    for(BlockTransformEvent bte : wrapperEvents) {
        if(bte.isCancelled()) {
            causeEvent.setCancelled(true);
            break;
        }
    }
}
项目:ProjectAres    文件:BlockTracker.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTransform(BlockTransformEvent event) {
    if(event.getCause() instanceof BlockPistonEvent) return;

    Block block = event.getOldState().getBlock();
    TrackerInfo info = blocks.get(block);
    if(info != null && !isPlaced(event.getNewState())) {
        clearBlock(block);
    }
}
项目:Equestrian-Dash    文件:BlockPistonListener.java   
@EventHandler
public void onPiston(BlockPistonEvent event)
{
    if(GarbageControl.DespawningIce.contains(event.getBlock().getRelative(event.getDirection()).getLocation()))
    {
        event.setCancelled(true);
    }
}