@EventHandler(priority = EventPriority.MONITOR)
  public void onBlockDamage(BlockDamageEvent event) {
    if (event.isCancelled() || !OrebfuscatorConfig.getUpdateOnDamage()) return;

    if (blockLog.containsKey(event.getPlayer().getName())
        && blockLog.get(event.getPlayer().getName()).equals(event.getBlock())) {
      return;
    }

    blockLog.put(event.getPlayer().getName(), event.getBlock());

    OrebfuscatorThreadUpdate.Queue(event.getBlock());
  }
 @EventHandler
 public void BlockDamageEvent(BlockDamageEvent event) {
   if (!arena.getRegion().isInside(event.getBlock().getLocation()) || arena.getEditMode()) return;
   if (arena.getArena().isInside(event.getBlock().getLocation()) && arena.isRunning()) {
     Player player = (Player) event.getPlayer();
     Participant participant = arena.getParticipant(player);
     if (participant != null)
       if (participant.getParticipantType() == ParticipantType.PARTICIPANT) {
         event.getBlock().setType(Material.AIR);
         return;
       }
   }
   event.setCancelled(true);
 }
Example #3
0
 @EventHandler(priority = EventPriority.LOWEST)
 public void onBlockDamage(BlockDamageEvent e) {
   if (e.getBlock().getType().equals(Material.SKULL)) {
     Player player = e.getPlayer();
     Skull skull = (Skull) e.getBlock().getState();
     String name = this.hasOwner(skull) ? skull.getOwner() : this.def;
     if (e.getItemInHand().getTypeId() == this.sw.getConfiguration().getTool()) {
       this.sw.getActionWorker().executeCuboid(e);
     } else if (this.sw
         .getConfiguration()
         .getActionMap()
         .containsKey(e.getItemInHand().getTypeId())) {
       this.sw.getActionWorker().executeAction(e, name);
     } else if (skull.getSkullType() == SkullType.PLAYER)
       this.sw.getActionWorker().executeQuery(player, name);
   }
 }
Example #4
0
 @SuppressWarnings("all")
 @EventHandler
 public void onPlayerDamageBlock(BlockDamageEvent event) {
   if (Spectator.isSpectating(event.getPlayer())) {
     event.setCancelled(true);
     return;
   }
   event.setInstaBreak(true);
   Block block = event.getBlock();
   block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
 }
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockDamage(final BlockDamageEvent event) {
    Block b = event.getBlock();

    if (PlotManager.isPlotWorld(b)) {
      String id = PlotManager.getPlotId(b.getLocation());

      if (id.equalsIgnoreCase("")) {
        event.setCancelled(true);
      }
    }
  }
  /*
   * Called when a block is damaged.
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockDamage(BlockDamageEvent event) {
    Player player = event.getPlayer();
    Block blockDamaged = event.getBlock();

    // Cake are damaged and not broken when they are eaten, so we must
    // handle them a bit separately
    if (blockDamaged.getTypeId() == BlockID.CAKE_BLOCK) {
      if (!plugin.getGlobalRegionManager().canBuild(player, blockDamaged)) {
        player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!");
        event.setCancelled(true);
        return;
      }
    }
  }
Example #7
0
 @EventHandler
 public void onZaubertischDamage(BlockDamageEvent e) {
   if (e.getBlock().getType().equals(Material.ENCHANTMENT_TABLE)) {
     if (e.getPlayer().getItemInHand().getType().equals(Material.GLASS_BOTTLE)) {
       float lvl = e.getPlayer().getExp();
       if (lvl >= 100) {
         e.getPlayer().setExp(lvl - 100);
         e.getPlayer().getInventory().addItem(new ItemStack(Material.EXP_BOTTLE, 10));
         e.getPlayer()
             .sendMessage(
                 ChatColor.AQUA + "Du hast 100 Erfahrung benutzt um 10 Exp-Flasche herzustellen!");
       }
     }
   }
 }
  /** Called when a block is damaged. */
  @Override
  public void onBlockDamage(BlockDamageEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Player player = event.getPlayer();
    Block blockDamaged = event.getBlock();

    // Cake are damaged and not broken when they are eaten, so we must
    // handle them a bit separately
    if (blockDamaged.getType() == Material.CAKE_BLOCK) {
      if (!plugin.getGlobalRegionManager().canBuild(player, blockDamaged)) {
        player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!");
        event.setCancelled(true);
        return;
      }
    }
  }
 public void onBlockDamage(BlockDamageEvent event) {
   if (event.getBlock().getState() instanceof Sign) {
     Sensor previous = SensorManager.getSensor(event.getBlock().getLocation());
     if (previous == null) {
       Sensor sensor =
           SensorConstructor.constructSensor(
               (Sign) event.getBlock().getState(), event.getPlayer());
       if (sensor != null) {
         SensorManager.addSensor(event.getBlock().getLocation(), sensor);
       }
     } else if (!SensorManager.verifySensor((Sign) event.getBlock().getState(), previous)) {
       Sensor sensor =
           SensorConstructor.constructSensor(
               (Sign) event.getBlock().getState(), event.getPlayer());
       if (sensor != null) {
         SensorManager.addSensor(event.getBlock().getLocation(), sensor);
       } else {
         SensorManager.delSensor(event.getBlock().getLocation());
       }
     }
   }
 }