// restores nature in multiple chunks, as described by a claim instance // this restores all chunks which have ANY number of claim blocks from this claim in them // if the claim is still active (in the data store), then the claimed blocks will not be changed // (only the area bordering the claim) public void restoreClaim(Claim claim, long delayInTicks) { // admin claims aren't automatically cleaned up when deleted or abandoned if (claim.isAdminClaim()) return; // it's too expensive to do this for huge claims if (claim.getArea() > 10000) return; Chunk lesserChunk = claim.getLesserBoundaryCorner().getChunk(); Chunk greaterChunk = claim.getGreaterBoundaryCorner().getChunk(); for (int x = lesserChunk.getX(); x <= greaterChunk.getX(); x++) for (int z = lesserChunk.getZ(); z <= greaterChunk.getZ(); z++) { Chunk chunk = lesserChunk.getWorld().getChunkAt(x, z); this.restoreChunk( chunk, this.getSeaLevel(chunk.getWorld()) - 15, false, delayInTicks, null); } }
public String allowBuild(Player player, Location location) { PlayerData playerData = this.dataStore.getPlayerData(player.getName()); Claim claim = this.dataStore.getClaimAt(location, false, playerData.lastClaim); WorldConfig wc = GriefPrevention.instance.getWorldCfg(player.getWorld()); // exception: administrators in ignore claims mode and special player accounts created by server // mods if (playerData.ignoreClaims || wc.getModsIgnoreClaimsAccounts().contains(player.getName())) return null; // wilderness rules if (claim == null) { // no building in the wilderness in creative mode if (this.creativeRulesApply(location)) { String reason = this.dataStore.getMessage(Messages.NoBuildOutsideClaims) + " " + this.dataStore.getMessage(Messages.CreativeBasicsDemoAdvertisement); if (player.hasPermission("griefprevention.ignoreclaims")) reason += " " + this.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement); return reason; } // no building in survival wilderness when that is configured else if (wc.getApplyTrashBlockRules() && wc.getClaimsEnabled()) { if (wc.getTrashBlockPlacementBehaviour().Allowed(location, player).Denied()) return this.dataStore.getMessage(Messages.NoBuildOutsideClaims) + " " + this.dataStore.getMessage(Messages.SurvivalBasicsDemoAdvertisement); else return null; } else { // but it's fine in creative return null; } } // if not in the wilderness, then apply claim rules (permissions, etc) else { // cache the claim for later reference playerData.lastClaim = claim; return claim.allowBuild(player); } }