Beispiel #1
0
 @EventHandler(priority = EventPriority.NORMAL)
 public void onBlockBreak(BlockBreakEvent event) {
   Block block = event.getBlock();
   if ((block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)) {
     Sign s = (Sign) block.getState();
     if (!plugin.loc.containsKey(block.getLocation())) {
       for (int i = 0; i < s.getLines().length; i++) {
         if (s.getLine(i).toLowerCase().contains("[sortal]")
             || s.getLine(i).toLowerCase().contains(plugin.signContains)) {
           if (!event.getPlayer().hasPermission("sortal.delsign")) {
             event
                 .getPlayer()
                 .sendMessage("[Sortal] You do not have permissions to destroy a [Sortal] sign!");
             event.setCancelled(true);
           }
         }
       }
       return;
     }
     if (!event.getPlayer().hasPermission("sortal.delsign")) {
       event
           .getPlayer()
           .sendMessage("[Sortal] You do not have permissions to destroy a registered sign!");
       event.setCancelled(true);
       return;
     }
     delLoc(block.getLocation());
     plugin.log.info(
         "Registered sign destroyed by "
             + event.getPlayer().getDisplayName()
             + ", AKA "
             + event.getPlayer().getName()
             + "!");
   }
 }
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onBlockBreak(BlockBreakEvent event) {
    Player p = event.getPlayer();
    int pid = GameManager.getInstance().getPlayerGameId(p);

    if (pid == -1) {
      int blockgameid = GameManager.getInstance().getBlockGameId(event.getBlock().getLocation());

      if (blockgameid != -1) {
        if (GameManager.getInstance().getGame(blockgameid).getGameMode()
            != Game.GameMode.DISABLED) {
          event.setCancelled(true);
        }
      }
      return;
    }

    Game g = GameManager.getInstance().getGame(pid);

    if (g.getMode() == Game.GameMode.DISABLED) {
      return;
    }
    if (g.getMode() != Game.GameMode.INGAME) {
      event.setCancelled(true);
      return;
    }

    if (!allowedBreak.contains(event.getBlock().getTypeId())) event.setCancelled(true);
  }
  public void onBlockBreak(BlockBreakEvent event) {

    Block blockBreaked = event.getBlock();
    World world = blockBreaked.getWorld();
    Player player = event.getPlayer();

    // Sand/Gravel check when destroying a block

    if (world.getBlockTypeIdAt(blockBreaked.getX(), blockBreaked.getY() + 1, blockBreaked.getZ())
            == 12
        || world.getBlockTypeIdAt(blockBreaked.getX(), blockBreaked.getY() + 1, blockBreaked.getZ())
            == 13) {

      if (WorldGuard.getWorldGuardState() == false) {
        player.sendMessage(ChatColor.DARK_RED + "The required plugin is not enabled.");
        event.setCancelled(true);
        return;
      }

      for (int i = blockBreaked.getY() - 1; i >= 1; i = i - 1) {
        int xx = blockBreaked.getX();
        int yy = i;
        int zz = blockBreaked.getZ();
        Location location = new Location(world, xx, yy, zz);
        if (world.getBlockTypeIdAt(xx, yy, zz) != 0) {
          return;
        }
        if (!WorldGuard.IsMemberOnLocation(player, location)) {
          player.sendMessage(ChatColor.RED + "A block on this one is going to fall into a region.");
          event.setCancelled(true);
          return;
        }
      }
    }
  }
Beispiel #4
0
  @Override
  protected void onBlockBreak(BlockBreakEvent evt, Block blk) {
    // TODO Auto-generated method stub
    super.onBlockBreak(evt, blk);
    Player ply = evt.getPlayer();

    Cuboid cub = pMapaActual().ObtenirCuboid("RegC", getWorld());
    if (cub.contains(blk)) {
      evt.setCancelled(true);
    }
    if (blk.getType() != Material.HARD_CLAY && blk.getData() != 11) {
      //			if(blk.getType() == Material.BEACON){
      //				for (Objectiu obj : obtenirObjectiusPly(ply)){
      //
      //	//Bukkit.broadcastMessage(Double.toString(obj.getLocation().distance(blk.getLocation())));
      //					if (obj.getLocation().distance(blk.getLocation()) < 2){
      //						obj.complete(ply);
      //
      //					}
      //
      //				}
      //			}else{
      //
      //			}
      //			//Bukkit.broadcastMessage("Retard!");
    } else {
      evt.setCancelled(true);
    }
  }
Beispiel #5
0
  /** Removes chests when they're destroyed. */
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onBreak(final BlockBreakEvent e) {
    if (e.isCancelled()) return;

    Block b = e.getBlock();
    Player p = e.getPlayer();

    // If the chest was a chest
    if (b.getType() == Material.CHEST) {
      Shop shop = plugin.getShopManager().getShop(b.getLocation());
      // If it was a shop
      if (shop != null) {
        if (plugin.lock) {
          // If they owned it or have bypass perms, they can destroy it
          if (!shop.getOwner().equalsIgnoreCase(p.getName())
              && !p.hasPermission("quickshop.other.destroy")) {
            e.setCancelled(true);
            p.sendMessage(MsgUtil.getMessage("no-permission"));
            return;
          }
        }

        // If they're either survival or the owner, they can break it
        if (p.getGameMode() == GameMode.CREATIVE
            && !p.getName().equalsIgnoreCase(shop.getOwner())) {
          e.setCancelled(true);
          p.sendMessage(MsgUtil.getMessage("no-creative-break"));
          return;
        }

        // Cancel their current menu... Doesnt cancel other's menu's.
        Info action = plugin.getShopManager().getActions().get(p.getName());
        if (action != null) {
          action.setAction(ShopAction.CANCELLED);
        }
        shop.delete();
        p.sendMessage(MsgUtil.getMessage("success-removed-shop"));
      }
    } else if (b.getType() == Material.WALL_SIGN) {
      Shop shop = getShopNextTo(e.getBlock().getLocation());
      if (shop != null) { // It is a shop sign we're dealing with.
        if (plugin.lock) {
          // If they're the shop owner or have bypass perms, they can destroy it.
          if (!shop.getOwner().equalsIgnoreCase(p.getName())
              && !e.getPlayer().hasPermission("quickshop.other.destroy")) {
            e.setCancelled(true);
            p.sendMessage(MsgUtil.getMessage("no-permission"));
            return;
          }
        }
        // If they're in creative and not the owner, don't let them (accidents happen)
        if (p.getGameMode() == GameMode.CREATIVE
            && !p.getName().equalsIgnoreCase(shop.getOwner())) {
          e.setCancelled(true);
          p.sendMessage(MsgUtil.getMessage("no-creative-break"));
          return;
        }
      }
    }
  }
Beispiel #6
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onBlockBreak(BlockBreakEvent event) {
   Player p = event.getPlayer();
   SFPlayer sfp = SFPlayer.getSFPlayer(p);
   if (!p.isOp()) {
     if (plugin.getConfig().getBoolean("features.spawnprotect", true)) {
       boolean inspawn = SFPlugin.isInSpawnProtect(event.getBlock().getLocation(), plugin);
       if (inspawn) {
         event.setCancelled(true);
         p.sendMessage(ChatColor.RED + sfp.translateString("general.inspawnprotect"));
       }
     }
     if (plugin.getConfig().getBoolean("features.bedrockprotect", true)) {
       if (p.getGameMode().equals(GameMode.CREATIVE)) {
         if (!event.isCancelled()) {
           if (event.getBlock().getY() < Double.valueOf(7)
               && event.getBlock().getType().equals(Material.BEDROCK)) {
             event.setCancelled(true);
             p.sendMessage(ChatColor.RED + sfp.translateString("general.bedrockblocked.removal"));
           }
         }
       }
     }
   }
 }
 /**
  * Blocks block breaking inside an arena for players not in that arena,<br>
  * or if the block's material is not whitelisted for breaking.
  *
  * <p>Stops blocks with ug signs attached from breaking.
  */
 @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onBlockBreak(BlockBreakEvent event) {
   Arena arena = ultimateGames.getArenaManager().getLocationArena(event.getBlock().getLocation());
   if (arena != null) {
     String playerName = event.getPlayer().getName();
     if (ultimateGames.getPlayerManager().isPlayerInArena(playerName)) {
       if (!ultimateGames.getPlayerManager().getArenaPlayer(playerName).isEditing()) {
         if (arena.getStatus() == ArenaStatus.RUNNING
             && ultimateGames
                 .getWhitelistManager()
                 .getBlockBreakWhitelist()
                 .canBreakMaterial(arena.getGame(), event.getBlock().getType())) {
           Block block = event.getBlock();
           if ((block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
               && ultimateGames.getUGSignManager().isUGSign((Sign) block.getState())) {
             event.setCancelled(true);
             return;
           }
           for (Sign attachedSign : UGUtils.getAttachedSigns(block, true)) {
             if (ultimateGames.getUGSignManager().isUGSign(attachedSign)) {
               event.setCancelled(true);
               return;
             }
           }
           arena.getGame().getGamePlugin().onBlockBreak(arena, event);
         } else {
           event.setCancelled(true);
         }
       }
     } else {
       event.setCancelled(true);
     }
   }
 }
  @EventHandler(priority = EventPriority.HIGH) // , ignoreCancelled = true
  public void onBlockBreak(final BlockBreakEvent event) {
    Block b = event.getBlock();

    if (PlotManager.isPlotWorld(b)) {
      Player p = event.getPlayer();
      boolean canbuild = PlotMe.cPerms(event.getPlayer(), "plotme.admin.buildanywhere");
      String id = PlotManager.getPlotId(b.getLocation());

      if (id.equalsIgnoreCase("")) {
        if (!canbuild) {
          p.sendMessage(PlotMe.caption("ErrCannotBuild"));
          event.setCancelled(true);
        }
      } else {
        Plot plot = PlotManager.getMap(p).plots.get(id);

        if (plot == null) {
          if (!canbuild) {
            p.sendMessage(PlotMe.caption("ErrCannotBuild"));
            event.setCancelled(true);
          }
        } else if (!plot.isAllowed(p.getName())) {
          if (!canbuild) {
            p.sendMessage(PlotMe.caption("ErrCannotBuild"));
            event.setCancelled(true);
          }
        } else {
          plot.resetExpire(PlotManager.getMap(b).DaysToExpiration);
        }
      }
    }
  }
  @EventHandler(priority = EventPriority.NORMAL)
  public void onBlockBreak(BlockBreakEvent event) {
    Player p = event.getPlayer();
    Location block_pos = event.getBlock().getLocation();

    if (TotalFreedomMod.nukeMonitor) {
      TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);

      Location player_pos = p.getLocation();

      boolean out_of_range = false;
      if (!player_pos.getWorld().equals(block_pos.getWorld())) {
        out_of_range = true;
      } else if (player_pos.distanceSquared(block_pos)
          > (TotalFreedomMod.nukeMonitorRange * TotalFreedomMod.nukeMonitorRange)) {
        out_of_range = true;
      }

      if (out_of_range) {
        playerdata.incrementFreecamDestroyCount();
        if (playerdata.getFreecamDestroyCount() > TotalFreedomMod.freecamTriggerCount) {
          TFM_Util.bcastMsg(
              p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
          TFM_Util.autoEject(
              p, "Freecam (extended range) block breaking is not permitted on this server.");

          playerdata.resetFreecamDestroyCount();

          event.setCancelled(true);
          return;
        }
      }

      playerdata.incrementBlockDestroyCount();
      if (playerdata.getBlockDestroyCount() > TotalFreedomMod.nukeMonitorCountBreak) {
        TFM_Util.bcastMsg(p.getName() + " is breaking blocks too fast!", ChatColor.RED);
        TFM_Util.autoEject(
            p, "You are breaking blocks too fast. Nukers are not permitted on this server.");

        playerdata.resetBlockDestroyCount();

        event.setCancelled(true);
        return;
      }
    }

    if (TotalFreedomMod.protectedAreasEnabled) {
      if (!TFM_SuperadminList.isUserSuperadmin(p)) {
        if (TFM_ProtectedArea.isInProtectedArea(block_pos)) {
          event.setCancelled(true);
          return;
        }
      }
    }
  }
  /** Called when a block is broken. */
  @Override
  public void onBlockBreak(BlockBreakEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Player player = event.getPlayer();
    WorldConfiguration wcfg = getWorldConfig(player);

    if (!wcfg.itemDurability) {
      ItemStack held = player.getItemInHand();
      if (held.getTypeId() > 0) {
        held.setDurability((short) -1);
        player.setItemInHand(held);
      }
    }

    if (!plugin.getGlobalRegionManager().canBuild(player, event.getBlock())) {
      player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
      event.setCancelled(true);
      return;
    }

    if (wcfg.getBlacklist() != null) {
      if (!wcfg.getBlacklist()
          .check(
              new BlockBreakBlacklistEvent(
                  plugin.wrapPlayer(player),
                  toVector(event.getBlock()),
                  event.getBlock().getTypeId()),
              false,
              false)) {
        event.setCancelled(true);
        return;
      }

      if (!wcfg.getBlacklist()
          .check(
              new DestroyWithBlacklistEvent(
                  plugin.wrapPlayer(player),
                  toVector(event.getBlock()),
                  player.getItemInHand().getTypeId()),
              false,
              false)) {
        event.setCancelled(true);
        return;
      }
    }

    if (wcfg.isChestProtected(event.getBlock(), player)) {
      player.sendMessage(ChatColor.DARK_RED + "The chest is protected.");
      event.setCancelled(true);
      return;
    }
  }
  /*
   * Called when a block is broken.
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockBreak(BlockBreakEvent event) {
    Player player = event.getPlayer();
    WorldConfiguration wcfg = getWorldConfig(player);

    if (!wcfg.itemDurability) {
      ItemStack held = player.getItemInHand();
      if (held.getTypeId() > 0
          && !(ItemType.usesDamageValue(held.getTypeId())
              || BlockType.usesData(held.getTypeId()))) {
        held.setDurability((short) 0);
        player.setItemInHand(held);
      }
    }

    if (!plugin.getGlobalRegionManager().canBuild(player, event.getBlock())
        || !plugin.getGlobalRegionManager().canConstruct(player, event.getBlock())) {
      player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
      event.setCancelled(true);
      return;
    }

    if (wcfg.getBlacklist() != null) {
      if (!wcfg.getBlacklist()
          .check(
              new BlockBreakBlacklistEvent(
                  plugin.wrapPlayer(player),
                  toVector(event.getBlock()),
                  event.getBlock().getTypeId()),
              false,
              false)) {
        event.setCancelled(true);
        return;
      }

      if (!wcfg.getBlacklist()
          .check(
              new DestroyWithBlacklistEvent(
                  plugin.wrapPlayer(player),
                  toVector(event.getBlock()),
                  player.getItemInHand().getTypeId()),
              false,
              false)) {
        event.setCancelled(true);
        return;
      }
    }

    if (wcfg.isChestProtected(event.getBlock(), player)) {
      player.sendMessage(ChatColor.DARK_RED + "The chest is protected.");
      event.setCancelled(true);
      return;
    }
  }
Beispiel #12
0
  @EventHandler(priority = EventPriority.HIGH)
  public void onBlockBreak(BlockBreakEvent event) {
    if ((plugin.status != Main.etat.INGAME) && (plugin.status != Main.etat.CONFIGURATION)) {
      event.setCancelled(true);
    }
    if (event.getBlock().getType().getId() == 17
        || event.getBlock().getType().getId() == 126
        || event.getBlock().getType().getId() == 1
        || event.getBlock().getType().getId() == 85
        || event.getBlock().getType().getId() == 183) {
      event.setCancelled(true);
    }

    if (event.getBlock().getType() == Material.BED
        || event.getBlock().getType() == Material.BED_BLOCK) {
      /*for(Player p : Bukkit.getOnlinePlayers()) {
      	if(p.getBedSpawnLocation() == event.getBlock().getLocation()) {
      		//if(Main.bleu)
      	}
      }*/
      // System.out.println(event.getBlock().getLocation());
      // System.out.println(new Location(Bukkit.getWorld("world"),
      // plugin.getConfig().getInt("lit.violet.x"),
      // plugin.getConfig().getInt("lit.violet.y"),
      // plugin.getConfig().getInt("lit.violet.z")));
      // if(event.getBlock().getLocation().equals(new
      // Location(Bukkit.getWorld("world"),
      // plugin.getConfig().getInt("lit.violet.x"),
      // plugin.getConfig().getInt("lit.violet.y"),
      // plugin.getConfig().getInt("lit.violet.z")))) {
      /*
       * if(Main.violet.contains(event.getPlayer().getName())) { //lv =
       * "oui"; } else { for(Player p : Bukkit.getOnlinePlayers()) {
       * p.sendMessage(ChatColor.BOLD + "Le lit des" +
       * ChatColor.DARK_PURPLE + "Violet" + ChatColor.WHITE +
       * "a était détruit par" + event.getPlayer().getCustomName()); } }
       * //} }
       */
      /*
       * if(event.getBlock().getLocation().equals(Bukkit.getPlayer(Main.bleu
       * .get(0)).getWorld().getSpawnLocation())) {
       *
       * }
       */
    }
    for (Location loc : plugin.pngloc) {
      if (event.getBlock().getLocation().getBlockY() == loc.getBlockY() - 1) {
        event.setCancelled(true);
        event.getPlayer().sendMessage("Il est interdit de cassé les Block sous les PNJ");
      }
    }
  }
  @EventHandler(priority = EventPriority.HIGH)
  public void onBlockBreak(BlockBreakEvent event) {
    Block block = event.getBlock();

    // Deny DPortal destroying
    if (block.getType() == Material.PORTAL) {
      if (DPortal.get(event.getBlock()) != null) {
        event.setCancelled(true);
      }
    }

    // Deny DGSignblocks destroying
    if (DGSign.isRelativeSign(block, 1, 0)
        || DGSign.isRelativeSign(block, -1, 0)
        || DGSign.isRelativeSign(block, 0, 1)
        || DGSign.isRelativeSign(block, 0, -1)) {
      event.setCancelled(true);
    }

    // DGSign destroying
    if (DGSign.getSign(block) != null) {
      DGSign.dgsigns.remove(DGSign.getSign(block));
    }

    // Deny LeaveSignblocks destroying
    if (LeaveSign.isRelativeSign(block, 1, 0)
        || LeaveSign.isRelativeSign(block, -1, 0)
        || LeaveSign.isRelativeSign(block, 0, 1)
        || LeaveSign.isRelativeSign(block, 0, -1)) {
      event.setCancelled(true);
    }

    // LeaveSign destroying
    if (LeaveSign.getSign(block) != null) {
      event.setCancelled(true);
      // LeaveSign.lsigns.remove(LeaveSign.getSign(block));
    }

    // Editworld Signs
    EditWorld eworld = EditWorld.get(block.getWorld());
    if (eworld != null) {
      eworld.sign.remove(event.getBlock());
    }

    // Deny GameWorld Blocks
    GameWorld gworld = GameWorld.get(block.getWorld());
    if (gworld != null) {
      event.setCancelled(true);
    }
  }
 @EventHandler(ignoreCancelled = true)
 public void onBlockBreak(BlockBreakEvent event) {
   Player player = event.getPlayer();
   Block block = event.getBlock();
   if (LotteryManager.isSignRegistered(block)) {
     event.setCancelled(true);
     ChatUtils.send(player, "lottery.error.sign.break");
     return;
   }
   if (!checkBlockBroken(block)) {
     event.setCancelled(true);
     ChatUtils.send(player, "lottery.error.block.break");
     return;
   }
 }
Beispiel #15
0
 @EventHandler
 public void onBlockBreak(BlockBreakEvent e) {
   if (Store.jailed.contains(e.getPlayer().getName())) {
     e.setCancelled(true);
     e.getPlayer().sendMessage(Util.colour(pl.getConfig().getString("law.crimeMessage")));
   }
 }
  @EventHandler
  public void onBlockBreak(BlockBreakEvent event) {
    if (event.isCancelled() || event.getPlayer() == null) {
      return;
    }

    Player player = event.getPlayer();
    String name = player.getName().toLowerCase();

    if (CitizensCommunicator.isNPC(player)) {
      return;
    }

    if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
      return;
    }

    if (!data.isAuthAvailable(name)) {
      if (!settings.isForcedRegistrationEnabled()) {
        return;
      }
    }

    event.setCancelled(true);
  }
Beispiel #17
0
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void BlockBreakEvent(BlockBreakEvent e) {

    if (e.getBlock().hasMetadata("ce.Ice")) e.setCancelled(true);

    CEventHandler.handleEvent(e.getPlayer(), e, blockBroken);
    if (e.getBlock().hasMetadata("ce.mine")) {
      Block b = e.getBlock();
      b.removeMetadata("ce.mine", Main.plugin);
      Block[] blocks = {
        b.getRelative(0, 1, 0),
        b.getRelative(1, 0, 0),
        b.getRelative(-1, 0, 0),
        b.getRelative(0, 0, 1),
        b.getRelative(0, 0, -1)
      };

      for (Block block : blocks) {
        if (block.hasMetadata("ce.mine.secondary")) {
          String[] s = block.getMetadata("ce.mine.secondary").get(0).asString().split(" ");
          Location loc =
              new Location(
                  e.getPlayer().getWorld(),
                  Integer.parseInt(s[0]),
                  Integer.parseInt(s[1]),
                  Integer.parseInt(s[2]));
          Location blockLoc = b.getLocation();
          if (loc.getBlockX() == blockLoc.getBlockX()
              && loc.getBlockY() == blockLoc.getBlockY()
              && loc.getBlockZ() == blockLoc.getBlockZ())
            block.removeMetadata("ce.mine.secondary", Main.plugin);
        }
      }
    }
  }
 @EventHandler(ignoreCancelled = true)
 public void onBlockBreak(BlockBreakEvent event) {
   if (!event.getPlayer().hasPermission("permissions.build")) {
     bother(event.getPlayer());
     event.setCancelled(true);
   }
 }
 @EventHandler(priority = EventPriority.LOWEST)
 public void onBlockBreak(BlockBreakEvent e) {
   if (!plugin.isProtected()) return;
   if (plugin.checkBlocks(e.getBlock().getLocation())) {
     e.setCancelled(true);
     e.getPlayer().sendMessage("Cannot edit blocks in Town Warp zone");
   }
 }
Beispiel #20
0
  @EventHandler(ignoreCancelled = true)
  public void onBlockBreak(BlockBreakEvent event) {

    if (!plugin.getConfiguration().chairEnabled) return;
    if (hasChair(event.getBlock())) {
      event.setCancelled(true);
      plugin.wrapPlayer(event.getPlayer()).print("This seat is in use!");
    }
  }
Beispiel #21
0
		@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
		public void onBlockBreak(final BlockBreakEvent event)
		{
			final User user = ess.getUser(event.getPlayer());
			if (user.isJailed())
			{
				event.setCancelled(true);
			}
		}
Beispiel #22
0
  @EventHandler
  public void onPlayerBreakBlock(BlockBreakEvent event) {
    SpleefPlayer player = getHeavySpleef().getSpleefPlayer(event.getPlayer());
    if (!isSpectating(player)) {
      return;
    }

    event.setCancelled(true);
  }
Beispiel #23
0
  /**
   * ブロックを破壊した
   *
   * @param event
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockBreak(final BlockBreakEvent event) {
    Block block = event.getBlock();
    Player player = event.getPlayer();

    if (!canBuild(block.getLocation(), player, true)) {
      event.setCancelled(true);
    }
  }
  @EventHandler
  public void onPlayerBreakBlock(BlockBreakEvent e) {

    Player p = e.getPlayer();

    if (ArenaManager.isPlayerPlaying(p)) {
      e.setCancelled(true);
    }
  }
Beispiel #25
0
 @EventHandler
 public void onBlockBreak_Appliance(final BlockBreakEvent event) {
   if (MadeToBreak.appliances.contains(event.getBlock().getTypeId())) {
     plugin.l.remove(event.getBlock().getLocation()); // remove location from map
     event.setCancelled(true); // cancel entire vanilla event, cancelling the drops as well
     event.getBlock().setTypeId(0); // set the block to air
     // add any extra drops (which are not technically needed in this case)
   }
 }
  @EventHandler(priority = EventPriority.LOW)
  public void onBlockBreak(BlockBreakEvent event) {
    if (event == null) return;
    if (event.getPlayer() == null) event.setCancelled(true);

    if (validateAuthorizer(event.getPlayer())) {

      String[] l = null;
      if (event.getBlock() instanceof Sign) l = ((Sign) event.getBlock()).getLines();

      event.setCancelled(true);

      if (l == null) return;

      if (event.getBlock() instanceof Sign)
        for (int i = 0; i < l.length; i++) ((Sign) event.getBlock()).setLine(i, l[i]);

    } else if (validateClickAuth(event.getPlayer(), null)) event.setCancelled(true);
  }
  // No block breaking allowed on server.
  @EventHandler(priority = EventPriority.NORMAL)
  public void onBlockBreak(BlockBreakEvent event) {
    Player player = event.getPlayer();

    // Block breaking allowed if the player has creative immunity.
    if (mobfighter.getConfig().getList("Creative Immunity").contains(player.getDisplayName()))
      return;

    event.setCancelled(true);
  }
  @EventHandler(priority = EventPriority.NORMAL)
  public void protection(BlockBreakEvent event) {

    Block b = event.getBlock();
    Location loc = b.getLocation();

    if (loc.getWorld().getName().equals(name)) {

      event.setCancelled(true);
    }
  }
 @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
 public void onBlockBreak(BlockBreakEvent event) {
   if (windwalkers.size() > 0 && event.getBlock().getType() == platformBlock) {
     for (BlockPlatform platform : windwalkers.values()) {
       if (platform.blockInPlatform(event.getBlock())) {
         event.setCancelled(true);
         break;
       }
     }
   }
 }
Beispiel #30
0
 public void onBlockBreak(BlockBreakEvent event) {
   Material block = event.getBlock().getType();
   Player player = event.getPlayer();
   for (Material blockedBlock : destroyedBlacklist) {
     if (blockedBlock == block)
       player.sendMessage(
           ChatColor.YELLOW + "I'm afraid i can't let you do that " + player.getDisplayName());
     player.sendMessage(ChatColor.YELLOW + "Only operators can destroy that block.");
     event.setCancelled(true);
   }
 }