/** * Used to cancel the land of falling blocks in bowspleef games */ @EventHandler public void onEntityChangeBlock(EntityChangeBlockEvent e) { if (!(e.getEntity() instanceof FallingBlock)) { return; } boolean bowspleefEntity = false; List<MetadataValue> metadatas = e.getEntity().getMetadata("bowspleef"); for (MetadataValue metadata : metadatas) { if (metadata.getOwningPlugin() != HeavySpleef.getInstance()) continue; if (metadata.asBoolean()) { bowspleefEntity = true; break; } } if (!bowspleefEntity) { return; } e.setCancelled(true); e.getEntity().remove(); }
// don't allow endermen to change blocks @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onEntityChangeBLock(EntityChangeBlockEvent event) { if (!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN) { event.setCancelled(true); } }
@EventHandler public void onBlockLand(EntityChangeBlockEvent e) { if (Variables.blocks.contains(e.getEntity().getUniqueId())) { e.setCancelled(true); e.getEntity().remove(); } }
@EventHandler(priority = EventPriority.NORMAL) public void onEndermanChangeBlock(EntityChangeBlockEvent event) { if (event.getEntityType() != EntityType.ENDERMAN) { return; } FlagPermissions perms = Residence.getPermsByLoc(event.getBlock().getLocation()); if (!perms.has("build", true)) { event.setCancelled(true); } }
@EventHandler @SuppressWarnings("unused") public void onEvent(EntityChangeBlockEvent e) { Bukkit.getLogger().info(e.getEntityType().toString()); if (!plugin.enabled()) return; if (e.getEntityType() != EntityType.WITHER) return; if (e.getTo() == Material.AIR) e.setCancelled(true); }
@EventHandler(priority = EventPriority.HIGHEST) public void onEntityChangeBlock(EntityChangeBlockEvent event) { if (event.isCancelled()) { return; } if (event.getEntityType() == EntityType.ENDERMAN && prot.getSettingBool(ProtectConfig.prevent_enderman_pickup)) { event.setCancelled(true); return; } }
// when an entity picks up an item @EventHandler(priority = EventPriority.LOWEST) public void onEntityPickup(EntityChangeBlockEvent event) { // FEATURE: endermen don't steal claimed blocks // if its an enderman if (event.getEntity() instanceof Enderman) { // and the block is claimed if (this.dataStore.getClaimAt(event.getBlock().getLocation(), false, null) != null) { // he doesn't get to steal it event.setCancelled(true); } } }
/** * Listens for Fireball, Wither and Dragon entity interaction with the TARDIS blocks. If the block * is a TARDIS block, then the block change event is cancelled. * * @param event an entity affecting a block */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void bossBlockBreak(EntityChangeBlockEvent event) { Block b = event.getBlock(); String l = b.getLocation().toString(); EntityType eType; try { eType = event.getEntityType(); } catch (Exception e) { eType = null; } if (eType != null && ents.contains(eType)) { if (plugin.getGeneralKeeper().getProtectBlockMap().containsKey(l)) { event.setCancelled(true); } } }