@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent e) { if (cm.isAntiInfiniteRail && this.isDupeBlock(e.getChangedType()) && this.isRails(e.getBlock().getType())) { e.setCancelled(true); } } }
/** * Check if a block is powered above a sign. * * @param event */ @EventHandler(ignoreCancelled = true) @SuppressWarnings("ucd") public void onBlockPhysics(BlockPhysicsEvent event) { if (event.getChangedType() != Material.SIGN || ! event.getBlock().isBlockIndirectlyPowered()) { return; } final Powerable myIC = this.MyPoweredICFactory.getIC(event.getBlock()); if (myIC != null) { myIC.power(); } } /*
@EventHandler public void onBreak(BlockPhysicsEvent e) { // Is not triggered when the block a torch is attached to is removed if (e.getChangedType().equals(Material.TORCH)) if (e.getBlock().hasMetadata("RPGItems.Torch")) { e.setCancelled(true); // Cancelling this does not work e.getBlock().removeMetadata("RPGItems.Torch", plugin); e.getBlock().setType(Material.AIR); } }