From b80e1cc2cd3466628ae81d28c298cbb3f3a5a07a Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Mon, 10 Nov 2014 19:08:11 -0800 Subject: [PATCH] Removed wilderness bucket ban for survival worlds. It generates a lot of complaints. /RestoreNature can be used manually to quickly clean up any above-sea-level water or lava. --- .../GriefPrevention/BlockEventHandler.java | 4 ++-- .../ryanhamshire/GriefPrevention/Claim.java | 19 ++++++------------- .../GriefPrevention/DataStore.java | 2 +- .../GriefPrevention/GriefPrevention.java | 10 ---------- .../GriefPrevention/PlayerEventHandler.java | 6 +++--- 5 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java index 39bb3bb..d242653 100644 --- a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java @@ -691,9 +691,9 @@ public class BlockEventHandler implements Listener Claim fromClaim = this.dataStore.getClaimAt(fromBlock.getLocation(), false, null); Claim toClaim = this.dataStore.getClaimAt(toBlock.getLocation(), false, fromClaim); - //into wilderness is NOT OK when surface buckets are limited + //into wilderness is NOT OK in creative mode worlds Material materialDispensed = dispenseEvent.getItem().getType(); - if((materialDispensed == Material.WATER_BUCKET || materialDispensed == Material.LAVA_BUCKET) && GriefPrevention.instance.config_blockWildernessWaterBuckets && GriefPrevention.instance.claimsEnabledForWorld(fromBlock.getWorld()) && toClaim == null) + if((materialDispensed == Material.WATER_BUCKET || materialDispensed == Material.LAVA_BUCKET) && GriefPrevention.instance.creativeRulesApply(dispenseEvent.getBlock().getLocation()) && toClaim == null) { dispenseEvent.setCancelled(true); return; diff --git a/src/me/ryanhamshire/GriefPrevention/Claim.java b/src/me/ryanhamshire/GriefPrevention/Claim.java index c7ecdc4..e52f443 100644 --- a/src/me/ryanhamshire/GriefPrevention/Claim.java +++ b/src/me/ryanhamshire/GriefPrevention/Claim.java @@ -107,7 +107,7 @@ public class Claim return true; } - //removes any fluids above sea level in a claim + //removes any lava above sea level in a claim //exclusionClaim is another claim indicating an sub-area to be excluded from this operation //it may be null public void removeSurfaceFluids(Claim exclusionClaim) @@ -118,8 +118,8 @@ public class Claim //don't do it for very large claims if(this.getArea() > 10000) return; - //don't do it when surface fluids are allowed to be dumped - if(!GriefPrevention.instance.config_blockWildernessWaterBuckets) return; + //only in creative mode worlds + if(!GriefPrevention.instance.creativeRulesApply(this.lesserBoundaryCorner)) return; Location lesser = this.getLesserBoundaryCorner(); Location greater = this.getGreaterBoundaryCorner(); @@ -141,7 +141,7 @@ public class Claim Block block = lesser.getWorld().getBlockAt(x, y, z); if(exclusionClaim != null && exclusionClaim.contains(block.getLocation(), true, false)) continue; - if(block.getType() == Material.STATIONARY_WATER || block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.LAVA || block.getType() == Material.WATER) + if(block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.LAVA) { block.setType(Material.AIR); } @@ -150,7 +150,7 @@ public class Claim } } - //determines whether or not a claim has surface fluids (lots of water blocks, or any lava blocks) + //determines whether or not a claim has surface lava //used to warn players when they abandon their claims about automatic fluid cleanup boolean hasSurfaceFluids() { @@ -165,7 +165,6 @@ public class Claim //respect sea level in normal worlds if(lesser.getWorld().getEnvironment() == Environment.NORMAL) seaLevel = GriefPrevention.instance.getSeaLevel(lesser.getWorld()); - int waterCount = 0; for(int x = lesser.getBlockX(); x <= greater.getBlockX(); x++) { for(int z = lesser.getBlockZ(); z <= greater.getBlockZ(); z++) @@ -175,13 +174,7 @@ public class Claim //dodge the exclusion claim Block block = lesser.getWorld().getBlockAt(x, y, z); - if(block.getType() == Material.STATIONARY_WATER || block.getType() == Material.WATER) - { - waterCount++; - if(waterCount > 10) return true; - } - - else if(block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.LAVA) + if(block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.LAVA) { return true; } diff --git a/src/me/ryanhamshire/GriefPrevention/DataStore.java b/src/me/ryanhamshire/GriefPrevention/DataStore.java index 2d3a463..01bbd02 100644 --- a/src/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DataStore.java @@ -1148,7 +1148,7 @@ public abstract class DataStore this.addDefault(defaults, Messages.ClaimTooSmallForEntities, "This claim isn't big enough for that. Try enlarging it.", null); this.addDefault(defaults, Messages.TooManyEntitiesInClaim, "This claim has too many entities already. Try enlarging the claim or removing some animals, monsters, paintings, or minecarts.", null); this.addDefault(defaults, Messages.YouHaveNoClaims, "You don't have any land claims.", null); - this.addDefault(defaults, Messages.ConfirmFluidRemoval, "Abandoning this claim will remove all your lava and water. If you're sure, use /AbandonClaim again.", null); + this.addDefault(defaults, Messages.ConfirmFluidRemoval, "Abandoning this claim will remove lava inside the claim. If you're sure, use /AbandonClaim again.", null); this.addDefault(defaults, Messages.AutoBanNotify, "Auto-banned {0}({1}). See logs for details.", null); this.addDefault(defaults, Messages.AdjustGroupBlocksSuccess, "Adjusted bonus claim blocks for players with the {0} permission by {1}. New total: {2}.", "0: permission; 1: adjustment amount; 2: new total bonus"); this.addDefault(defaults, Messages.InvalidPermissionID, "Please specify a player name, or a permission in [brackets].", null); diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index cddc18a..cfb6e4a 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -123,7 +123,6 @@ public class GriefPrevention extends JavaPlugin public boolean config_blockSurfaceCreeperExplosions; //whether creeper explosions near or above the surface destroy blocks public boolean config_blockSurfaceOtherExplosions; //whether non-creeper explosions near or above the surface destroy blocks - public boolean config_blockWildernessWaterBuckets; //whether players can dump water buckets outside their claims public boolean config_blockSkyTrees; //whether players can build trees on platforms in the sky public boolean config_fireSpreads; //whether fire spreads outside of claims @@ -496,7 +495,6 @@ public class GriefPrevention extends JavaPlugin this.config_blockSurfaceCreeperExplosions = config.getBoolean("GriefPrevention.BlockSurfaceCreeperExplosions", true); this.config_blockSurfaceOtherExplosions = config.getBoolean("GriefPrevention.BlockSurfaceOtherExplosions", true); - this.config_blockWildernessWaterBuckets = config.getBoolean("GriefPrevention.LimitSurfaceWaterBuckets", true); this.config_blockSkyTrees = config.getBoolean("GriefPrevention.LimitSkyTrees", true); this.config_limitTreeGrowth = config.getBoolean("GriefPrevention.LimitTreeGrowth", false); this.config_pistonsInClaimsOnly = config.getBoolean("GriefPrevention.LimitPistonsToLandClaims", true); @@ -747,7 +745,6 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.BlockSurfaceCreeperExplosions", this.config_blockSurfaceCreeperExplosions); outConfig.set("GriefPrevention.BlockSurfaceOtherExplosions", this.config_blockSurfaceOtherExplosions); - outConfig.set("GriefPrevention.LimitSurfaceWaterBuckets", this.config_blockWildernessWaterBuckets); outConfig.set("GriefPrevention.LimitSkyTrees", this.config_blockSkyTrees); outConfig.set("GriefPrevention.LimitTreeGrowth", this.config_limitTreeGrowth); outConfig.set("GriefPrevention.LimitPistonsToLandClaims", this.config_pistonsInClaimsOnly); @@ -2006,13 +2003,6 @@ public class GriefPrevention extends JavaPlugin return true; } - //if the claim has lots of surface water or some surface lava, warn the player it will be cleaned up - else if(!playerData.warnedAboutMajorDeletion && claim.hasSurfaceFluids()) - { - GriefPrevention.sendMessage(player, TextMode.Warn, Messages.ConfirmFluidRemoval); - playerData.warnedAboutMajorDeletion = true; - } - else { //delete it diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 9371ded..6eb4feb 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -1026,12 +1026,12 @@ class PlayerEventHandler implements Listener minLavaDistance = 3; } - //otherwise no wilderness dumping (unless underground) in worlds where claims are enabled - else if(GriefPrevention.instance.claimsEnabledForWorld(block.getWorld())) + //otherwise no wilderness dumping in creative mode worlds + else if(GriefPrevention.instance.creativeRulesApply(block.getLocation())) { if(block.getY() >= GriefPrevention.instance.getSeaLevel(block.getWorld()) - 5 && !player.hasPermission("griefprevention.lava")) { - if(bucketEvent.getBucket() == Material.LAVA_BUCKET || GriefPrevention.instance.config_blockWildernessWaterBuckets) + if(bucketEvent.getBucket() == Material.LAVA_BUCKET) { GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoWildernessBuckets); bucketEvent.setCancelled(true);