Untitled
@EventHandler(priority = EventPriority.HIGHEST) public void onBreak(BlockBreakEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); if (isInSelfRefillingFarmRegion(block.getLocation())) { return; } if (isInBuildMode(player)) { if (Main.getInstance().getPermissionHelper().isBypassPlayer(player)) { return; } if (isInAllowedRegionOrWorldBuildmode(block.getLocation())) { return; } if (isInForbiddenRegionOrWorldBuildmode(block.getLocation())) { event.setCancelled(true); return; } } else { if (isInForbiddenRegionOrWorld(block.getLocation())) { event.setCancelled(true); return; } } if (block.getWorld().equals(Main.getInstance().getWorldManager().getMall())) { ShopRegion shopRegion = Main.getInstance().getRentHandler().findByOwner(player); if (shopRegion != null && RegionManagerMall.isInRegion(block.getLocation(), shopRegion.getRegionName())) { return; } event.setCancelled(true); } else { } if (!event.isCancelled()) { PlayerStats playerStats = Main.getInstance().getPlayerHelper().getPlayerStats(player); playerStats.addBlocksMined(1); } }
Leave a Comment