Java 类org.bukkit.event.entity.EntityChangeBlockEvent 实例源码

项目:bskyblock    文件:IslandGuard.java   
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!Util.inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getIslands() != null && plugin.getIslands().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
项目:bskyblock    文件:FlyingMobEvents.java   
/**
 * Withers change blocks to air after they are hit (don't know why)
 * This prevents this when the wither has been spawned by a visitor
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherChangeBlocks(EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (e.getEntityType() != EntityType.WITHER || !Util.inWorld(e.getEntity()) ) {
        return;
    }
    if (mobSpawnInfo.containsKey(e.getEntity())) {
        // We know about this wither
        if (DEBUG) {
            plugin.getLogger().info("DEBUG: We know about this wither");
        }
        if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
            // Cancel the block changes
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: cancelled wither block change");
            }
            e.setCancelled(true);
        }
    }
}
项目:Slimefun4-Chinese-Version    文件:ItemListener.java   
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
    if (e.getEntity() instanceof FallingBlock) {
        if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
            e.setCancelled(true);
            e.getEntity().remove();
        }
    }
    else if (e.getEntity() instanceof Wither) {
        SlimefunItem item = BlockStorage.check(e.getBlock());
        if (item != null) {
            if (item.getName().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
            if (item.getName().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
        }
    }
}
项目:HiddenOre    文件:ExploitListener.java   
/**
 * Prevent gaming by dropping sand/gravel/gravity blocks
 * 
 * @param event
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFallingThings(EntityChangeBlockEvent event) {
    Material from = event.getBlock().getType();
    if (!event.getBlock().isEmpty() && !event.getBlock().isLiquid()) {
        if (!from.hasGravity()) return;
        if (!from.isBlock()) return;
        // At this point we've confirmed that the FROM used to be a block, that is now falling.
        debug("Block about to fall from {0}, was a {1}", event.getBlock().getLocation(), from);
    } else {
        // if (event.getBlock().isEmpty() || event.getBlock().isLiquid()) {
        // At this point we've confirmed that the FROM is air or liquid e.g. this is a block
        // that is done falling and wants to be a block again.
        if (EntityType.FALLING_BLOCK != event.getEntityType()) return;
        debug("Block has fallen to {0}, was a {1}", event.getBlock().getLocation(), from);
    }
    // track a break at FROM and TO, so you can't game sand/gravel by dropping it into a chunk.
    plugin.getTracking().trackBreak(event.getBlock().getLocation());
}
项目:GriefPreventionPlus    文件:EntityEventHandler.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityChangeBLock(EntityChangeBlockEvent event)
{
    if(!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN)
    {
        event.setCancelled(true);
    }

    else if(!GriefPrevention.instance.config_silverfishBreakBlocks && event.getEntityType() == EntityType.SILVERFISH)
    {
        event.setCancelled(true);
    }

    //don't allow the wither to break blocks, when the wither is determined, too expensive to constantly check for claimed blocks
    else if(event.getEntityType() == EntityType.WITHER && GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) != ClaimsMode.Disabled)
    {
        event.setCancelled(true);
    }
}
项目:GriefPreventionPlus    文件:EntityEventHandler.java   
@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);
        }
    }
}
项目:RedProtect    文件:RPMine19.java   
@EventHandler
public void onChangeBlock(EntityChangeBlockEvent e){    
    if (e.isCancelled()){
        return;
    }

    if (e.getEntity() instanceof Player){
        Player p = (Player) e.getEntity();      
        Block b = e.getBlock();
        Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
        if (r != null && !r.canBuild(p)){
            RPLang.sendMessage(p, "blocklistener.region.cantbreak");
            e.setCancelled(true);
        }
    }
}
项目:RedProtect    文件:RPEntityListener.java   
@EventHandler
public void WitherBlockBreak(EntityChangeBlockEvent event) {
    RedProtect.get().logger.debug("RPEntityListener - Is EntityChangeBlockEvent");
    if (event.isCancelled()) {
        return;
    }
    Entity e = event.getEntity();       
    if (e instanceof Monster) {
        Region r = RedProtect.get().rm.getTopRegion(event.getBlock().getLocation());
        if (!cont.canWorldBreak(event.getBlock())){                             
            event.setCancelled(true);
            return;
        } 
        if (r != null && !r.canMobLoot()){
           event.setCancelled(true);
        }
    }
}
项目:RedProtect    文件:RPGlobalListener.java   
@EventHandler
 public void MonsterBlockBreak(EntityChangeBlockEvent event) {
    Entity e = event.getEntity();       
    Block b = event.getBlock();
    Region r = RedProtect.get().rm.getTopRegion(event.getBlock().getLocation());
    if (r != null){
       return;
     }

    if (b != null){
        RedProtect.get().logger.debug("RPGlobalListener - Is EntityChangeBlockEvent event. Block: "+b.getType().name());
    }

    if (e instanceof Monster) {
         if (!RPConfig.getGlobalFlagBool(e.getWorld().getName()+".entity-block-damage")){
            event.setCancelled(true);
         }
    }
    if (e instanceof Player){
        Player p = (Player) e;
        if (!bypassBuild(p, b, 2)){
            event.setCancelled(true);
}
    }
 }
项目:PlotSquared-Chinese    文件:PlayerEvents.java   
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
public void onEntityFall(EntityChangeBlockEvent event) {
    if (event.getEntityType() != EntityType.FALLING_BLOCK) {
        return;
    }
    Block block = event.getBlock();
    World world = block.getWorld();
    String worldname = world.getName();
    if (!PlotSquared.isPlotWorld(worldname)) {
        return;
    }
    Location loc = BukkitUtil.getLocation(block.getLocation());
    Plot plot = MainUtil.getPlot(loc);
    if (plot == null) {
        return;
    }
    if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
        event.setCancelled(true);
    }
}
项目:civcraft    文件:BlockListener.java   
@EventHandler(priority = EventPriority.NORMAL)
public void onEntityBlockChange(EntityChangeBlockEvent event) {
    bcoord.setFromLocation(event.getBlock().getLocation());

    StructureBlock sb = CivGlobal.getStructureBlock(bcoord);
    if (sb != null) {
        event.setCancelled(true);
        return;
    }

    RoadBlock rb = CivGlobal.getRoadBlock(bcoord);
    if (rb != null) {
        event.setCancelled(true);
        return;
    }

    CampBlock cb = CivGlobal.getCampBlock(bcoord);
    if (cb != null) {
        event.setCancelled(true);
        return;
    }

    return;
}
项目:Slimefun4    文件:ItemListener.java   
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
    if (e.getEntity() instanceof FallingBlock) {
        if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
            e.setCancelled(true);
            e.getEntity().remove();
        }
    }
    else if (e.getEntity() instanceof Wither) {
        SlimefunItem item = BlockStorage.check(e.getBlock());
        if (item != null) {
            if (item.getID().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
            if (item.getID().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
        }
    }
}
项目:acidisland    文件:IslandGuard.java   
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getGrid() != null && plugin.getGrid().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
项目:acidisland    文件:FlyingMobEvents.java   
/**
 * Withers change blocks to air after they are hit (don't know why)
 * This prevents this when the wither has been spawned by a visitor
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherChangeBlocks(EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (e.getEntityType() != EntityType.WITHER || !IslandGuard.inWorld(e.getEntity()) ) {
        return;
    }
    if (mobSpawnInfo.containsKey(e.getEntity())) {
        // We know about this wither
        if (DEBUG) {
            plugin.getLogger().info("DEBUG: We know about this wither");
        }
        if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
            // Cancel the block changes
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: cancelled wither block change");
            }
            e.setCancelled(true);
        }
    }
}
项目:Factoid    文件:PlayerListener.java   
/**
   * On entity change block.
   *
   * @param event the event
   */
  @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
  public void onEntityChangeBlock(EntityChangeBlockEvent event) {

      // Crop trample
IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
        event.getBlock().getLocation());
      Material matFrom = event.getBlock().getType();
      Material matTo = event.getTo();
Player player;

if(event.getEntity() instanceof Player
        && playerConf.get(player = (Player) event.getEntity()) != null // Citizens bugfix
&& ((land instanceof ILand && ((ILand) land).isBanned(player))
        || (matFrom == Material.SOIL
        && matTo == Material.DIRT
        && !checkPermission(land, player,
                PermissionList.CROP_TRAMPLE.getPermissionType())))) {
    event.setCancelled(true);
}
  }
项目:Factoid    文件:WorldListener.java   
/**
 * On entity change block.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {

    IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(event.getBlock().getLocation());
    Material matFrom = event.getBlock().getType();
    Material matTo = event.getTo();

    // Enderman removeblock
    if ((event.getEntityType() == EntityType.ENDERMAN
            && land.getFlagAndInherit(FlagList.ENDERMAN_DAMAGE.getFlagType()).getValueBoolean() == false)
            || (event.getEntityType() == EntityType.WITHER
            && land.getFlagAndInherit(FlagList.WITHER_DAMAGE.getFlagType()).getValueBoolean() == false)) {
        event.setCancelled(true);

    // Crop trample
    } else if (matFrom == Material.SOIL
            && matTo == Material.DIRT
            && land.getFlagAndInherit(FlagList.CROP_TRAMPLE.getFlagType()).getValueBoolean() == false) {
        event.setCancelled(true);
    }
}
项目:askyblock    文件:IslandGuard.java   
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getGrid() != null && plugin.getGrid().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
项目:askyblock    文件:FlyingMobEvents.java   
/**
 * Withers change blocks to air after they are hit (don't know why)
 * This prevents this when the wither has been spawned by a visitor
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherChangeBlocks(EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (e.getEntityType() != EntityType.WITHER || !IslandGuard.inWorld(e.getEntity()) ) {
        return;
    }
    if (mobSpawnInfo.containsKey(e.getEntity())) {
        // We know about this wither
        if (DEBUG) {
            plugin.getLogger().info("DEBUG: We know about this wither");
        }
        if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
            // Cancel the block changes
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: cancelled wither block change");
            }
            e.setCancelled(true);
        }
    }
}
项目:PlotMe-Core    文件:BukkitPlotListener.java   
@EventHandler(ignoreCancelled = true)
public void onSandCannon(EntityChangeBlockEvent event) {
    BukkitEntity entity = new BukkitEntity(event.getEntity());
    if (manager.isPlotWorld(entity) && event.getEntityType().equals(EntityType.FALLING_BLOCK)) {
        if (event.getTo().equals(Material.AIR)) {
            entity.setMetadata("plotFallBlock", new FixedMetadataValue(plugin, event.getBlock().getLocation()));
        } else {
            List<MetadataValue> values = entity.getMetadata("plotFallBlock");

            if (!values.isEmpty()) {

                org.bukkit.Location spawn = (org.bukkit.Location) (values.get(0).value());
                org.bukkit.Location createdNew = event.getBlock().getLocation();

                if (spawn.getBlockX() != createdNew.getBlockX() || spawn.getBlockZ() != createdNew.getBlockZ()) {
                    event.setCancelled(true);
                }
            }
        }
    }
}
项目:DirtyArrows    文件:Iron.java   
@EventHandler
public void onBlockChange(EntityChangeBlockEvent e) {
    if (e.getEntity() instanceof FallingBlock) {
        if (plugin.anvils.containsKey(e.getEntity())) {
            for (Entity ent : e.getEntity().getWorld().getEntities()) {
                if (ent instanceof LivingEntity) {
                    LivingEntity len = (LivingEntity) ent;
                    if (Util.inRegionOf(len.getLocation(), e.getEntity().getLocation(), 3)) {
                        if (len instanceof Player) {
                            ((Player) len).playSound(e.getEntity().getLocation(), Sound.ANVIL_LAND, 1, 1);
                        }
                        len.damage(10.0f);
                    }
                }
            }
        }
        plugin.anvils.remove(e.getEntity());
    }
}
项目:xEssentials-deprecated-bukkit    文件:RealisticTreeEvent.java   
@SuppressWarnings("deprecation")
@EventHandler
public void onLand(EntityChangeBlockEvent e) {
    if(e.getEntity() instanceof FallingBlock) {
        FallingBlock fall = (FallingBlock) e.getEntity();
        if(fall.hasMetadata("tree")) {
            final Location loc = fall.getLocation().add(0,-1,0);
            for(Entity entity : fall.getNearbyEntities(10, 180, 10)) {
                if(entity instanceof Player) {
                    Player p = (Player) entity;
                    p.sendBlockChange(loc, fall.getBlockId(), fall.getBlockData());
                    p.playEffect(loc.add(0, 1, 0), Effect.STEP_SOUND, Material.LEAVES.getId());
                }
            }
            SlowUpdateBlock slow = new SlowUpdateBlock(loc, 400L, pl);
            slow.startUpdate();
            e.setCancelled(true);
        }
    }
}
项目:Abyss    文件:BlockListener.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
    final Block block = event.getBlock();
    if ( block == null )
        return;

    // If we're not changing a block in an important way, who cares?
    if ( ! AbyssPlugin.validLiquid(block) && plugin.frameMaterials.contains(event.getTo()) )
        return;

    // Check to see if the block is protected.
    final ArrayList<ABPortal> portals = plugin.protectBlock(block);
    if ( portals == null ) {
        event.setCancelled(true);
        return;
    }

    // After the block is gone, update all our portals.
    if ( portals.size() > 0 )
        plugin.getServer().getScheduler().runTask(plugin, new UpdatePortals(event, portals));
}
项目:Essentials    文件:SignEntityListener.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
{
    if (plugin.getSettings().areSignsDisabled())
    {
        return;
    }

    final Block block = event.getBlock();
    if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(
         new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block))
    {
        event.setCancelled(true);
        return;
    }
    for (EssentialsSign sign : plugin.getSettings().getEnabledSigns())
    {
        if (sign.getBlocks().contains(block.getType()) && !sign.onBlockBreak(block, ess))
        {
            event.setCancelled(true);
            return;
        }
    }
}
项目:CropControl    文件:CropControlEventHandler.java   
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
    Block block = e.getBlock();
    if (maybeSideTracked(block)) {
        trySideBreak(block, BreakType.NATURAL, null);
    }
    if (maybeBelowTracked(block)) {
        block = block.getRelative(BlockFace.UP);
    }
    Location loc = block.getLocation();
    if (!pendingChecks.contains(loc)) {
        pendingChecks.add(loc);
        handleBreak(block, BreakType.NATURAL, null, null);
    }
}
项目:Warzone    文件:AnvilListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAnvilLand(EntityChangeBlockEvent event) {
    if (!this.tracker.isEnabled(event.getEntity().getWorld())) return;

    if (event.getEntityType() == EntityType.FALLING_BLOCK && event.getTo() == Material.ANVIL) {
        OfflinePlayer owner = tracker.getOwner((FallingBlock) event.getEntity());
        if(owner != null) {
            tracker.setPlacer(event.getBlock(), tracker.getOwner((FallingBlock) event.getEntity()));
            tracker.setOwner((FallingBlock) event.getEntity(), null);
        }
    }
}
项目:Arcadia-Spigot    文件:BombardmentGame.java   
@EventHandler
public void onFallingBlockChange(EntityChangeBlockEvent event) {
    final Entity entity = event.getEntity();
    this.playParticles(entity.getLocation());
    entity.getNearbyEntities(2, 2, 2).forEach(nearby -> {
        if(nearby instanceof Player) {
            Player player = (Player) nearby;
            if(getAPI().getGameManager().isAlive(player)) {
                getAPI().getGameManager().setAlive(player, false);
            }
        }
    });
    entity.remove();
    event.setCancelled(true);
}
项目:ProjectAres    文件:BlockDropsMatchModule.java   
private void replaceBlock(BlockDrops drops, Block block, MatchPlayer player) {
    if(drops.replacement != null) {
        EntityChangeBlockEvent event = new EntityChangeBlockEvent(player.getBukkit(), block, drops.replacement);
        getMatch().callEvent(event);

        if(!event.isCancelled()) {
            BlockState state = block.getState();
            state.setType(drops.replacement.getItemType());
            state.setData(drops.replacement);
            state.update(true, true);
        }
    }
}
项目:ProjectAres    文件:BlockDropsMatchModule.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onFallingBlockLand(BlockTransformEvent event) {
    if(event.getCause() instanceof EntityChangeBlockEvent) {
        Entity entity = ((EntityChangeBlockEvent) event.getCause()).getEntity();
        if(entity instanceof FallingBlock && this.fallingBlocksThatWillNotLand.remove(entity)) {
            event.setCancelled(true);
        }
    }
}
项目:ProjectAres    文件:BlockTransformListener.java   
@EventWrapper
public void onEntityChangeBlock(final EntityChangeBlockEvent event) {
    // Igniting TNT with an arrow is already handled from the ExplosionPrimeEvent
    if(event.getEntity() instanceof Arrow &&
       event.getBlock().getType() == Material.TNT &&
       event.getTo() == Material.AIR) return;

    callEvent(event, event.getBlock().getState(), BlockStateUtils.cloneWithMaterial(event.getBlock(), event.getToData()), entityResolver.getOwner(event.getEntity()));
}
项目:HCFCore    文件:CoreListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onEntityChangeBlock(final EntityChangeBlockEvent event) {
    final Entity entity = event.getEntity();
    if (entity instanceof LivingEntity && !attemptBuild(entity, event.getBlock().getLocation(), null)) {
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:WorldListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onWitherChangeBlock(EntityChangeBlockEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Wither || entity instanceof EnderDragon) {
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:CoreListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onEntityChangeBlock(final EntityChangeBlockEvent event) {
    final Entity entity = event.getEntity();
    if (entity instanceof LivingEntity && !attemptBuild(entity, event.getBlock().getLocation(), null)) {
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:WorldListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onWitherChangeBlock(EntityChangeBlockEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Wither || entity instanceof EnderDragon) {
        event.setCancelled(true);
    }
}
项目:Arcade2    文件:BlockTransformListeners.java   
@EventHandler(ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
    Block block = event.getBlock();

    boolean arrow = event.getEntity() instanceof Arrow;
    if (arrow && event.getTo().equals(Material.AIR) &&
            block.getType().equals(Material.TNT)) {
        return;
    }

    this.post(event,
              block.getState(),
              this.applyState(block, event.getTo(), event.getData()));
}
项目:Skellett    文件:ExprNewMaterial.java   
@SuppressWarnings({ "unchecked", "rawtypes" })
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent((Class)EntityChangeBlockEvent.class)) {
        Skript.error((String)"%new block% can only be used with an EntityChangeBlock event!");
        return false;
    }
    return true;
}
项目:BloodMoon    文件:BloodMoonEntityMonster.java   
protected void attemptBreakBlock(PluginConfig worldConfig, Block block) {
    Material type = block.getType();

    if (type != Material.AIR && worldConfig.getStringList(Config.FEATURE_BREAK_BLOCKS_BLOCKS).contains(type.name())) {
        Location location = block.getLocation();

        if (this.rand.nextInt(100) < 80) {
            if (this.rand.nextInt(100) < 50) {
                nmsEntity.world.getWorld().playSound(location, Sound.ZOMBIE_WOOD, Math.min(this.rand.nextFloat() + 0.2f, 1.0f), 1.0f);
            }
        } else {
            EntityChangeBlockEvent event = new EntityChangeBlockEvent(bukkitEntity, block, Material.AIR, (byte) 0);
            plugin.getServer().getPluginManager().callEvent(event);

            if (!event.isCancelled()) {
                nmsEntity.world.getWorld().playEffect(location, Effect.ZOMBIE_DESTROY_DOOR, 0);

                if (worldConfig.getBoolean(Config.FEATURE_BREAK_BLOCKS_REALISTIC_DROP)) {
                    block.breakNaturally();
                } else {
                    block.setType(Material.AIR);

                    if (worldConfig.getBoolean(Config.FEATURE_BREAK_BLOCKS_DROP_ITEMS)) {
                        nmsEntity.world.getWorld().dropItemNaturally(location, new ItemStack(type, 1, block.getData()));
                    }
                }
            }
        }
    }
}
项目:FastAsyncWorldedit    文件:ChunkListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockChange(EntityChangeBlockEvent event) {
    if (physicsFreeze) {
        event.setCancelled(true);
        return;
    }
    Block block = event.getBlock();
    int x = block.getX();
    int z = block.getZ();
    int cx = x >> 4;
    int cz = z >> 4;
    int[] count = getCount(cx, cz);
    if (count[1] >= Settings.IMP.TICK_LIMITER.FALLING) {
        event.setCancelled(true);
        return;
    }
    if (event.getEntityType() == EntityType.FALLING_BLOCK) {
        if (++count[1] >= Settings.IMP.TICK_LIMITER.FALLING) {

            // Only cancel falling blocks when it's lagging
            if (Fawe.get().getTimer().getTPS() < 18) {
                cancelNearby(cx, cz);
                if (rateLimit <= 0) {
                    rateLimit = 20;
                    Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled falling block lag source at " + block.getLocation());
                }
                event.setCancelled(true);
                return;
            } else {
                count[1] = 0;
            }
        }
    }
}
项目:vanillacraft    文件:MobControl.java   
@EventHandler(priority = EventPriority.NORMAL)
public void onEntityChangeBlock(EntityChangeBlockEvent event)
{
    if (!event.isCancelled())
    {
        Entity entity = event.getEntity();
        if (entity instanceof Enderman || entity instanceof Wither || entity instanceof Ghast || entity instanceof Creeper)
        {
            event.setCancelled(true);
        }
    }
}
项目:BlockParty-1.8    文件:ChangeBlockListener.java   
@EventHandler
public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
    if (event.getEntityType() == EntityType.FALLING_BLOCK) {
        FallingBlock fallingBlock = (FallingBlock) event.getEntity();
        if (fallingBlock.getMaterial() == Material.STAINED_CLAY) {
            event.setCancelled(true);
        }
        if (fallingBlock.getMaterial() == Material.WOOL) {
            event.setCancelled(true);
        }
    }
}
项目:Peacecraft    文件:ProtectListener.java   
@EventHandler
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
    BlockProtection blockProtection = this.module.getProtectManager().getBlockProtection(event.getBlock().getLocation());
    if(blockProtection.exists()) {
        event.setCancelled(true);
    }
}