@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);
  }
 // 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);
   }
 }
Exemplo n.º 3
0
 @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(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;
   }
 }
 /**
  * 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);
     }
   }
 }