From 5e01b64af466873872cc7ef6ad58d6943b834236 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Mon, 13 Oct 2014 14:15:39 -0700 Subject: [PATCH] Reduced noise from build warning. Building outside of land claims now triggers many fewer warnings, and those warnings are now always on. They're also more helpful - a link to the claims tutorial video is included for players with less than 2 claims. --- .../GriefPrevention/BlockEventHandler.java | 23 ++++++++++++------- .../GriefPrevention/GriefPrevention.java | 4 ---- .../GriefPrevention/PlayerData.java | 7 ++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java index b01b5e3..8a23b4b 100644 --- a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java @@ -248,8 +248,8 @@ public class BlockEventHandler implements Listener this.dataStore.extendClaim(claim, claim.getLesserBoundaryCorner().getBlockY() - GriefPrevention.instance.config_claims_claimsExtendIntoGroundDistance); } - //reset the counter for warning the player when he places outside his claims - playerData.unclaimedBlockPlacementsUntilWarning = 1; + //allow for a build warning in the future + playerData.warnedAboutBuildingOutsideClaims = false; } //FEATURE: automatically create a claim when a player who has no claims places a chest @@ -332,17 +332,24 @@ public class BlockEventHandler implements Listener } //FEATURE: warn players when they're placing non-trash blocks outside of their claimed areas - else if(GriefPrevention.instance.config_claims_warnOnBuildOutside && !this.trashBlocks.contains(block.getType()) && GriefPrevention.instance.claimsEnabledForWorld(block.getWorld()) && playerData.claims.size() > 0) + else if(!this.trashBlocks.contains(block.getType()) && GriefPrevention.instance.claimsEnabledForWorld(block.getWorld()) && playerData.claims.size() > 0) { - if(--playerData.unclaimedBlockPlacementsUntilWarning <= 0) + if(!playerData.warnedAboutBuildingOutsideClaims + && (playerData.lastClaim == null + || playerData.lastClaim.isNear(player.getLocation(), 15))) { GriefPrevention.sendMessage(player, TextMode.Warn, Messages.BuildingOutsideClaims); - playerData.unclaimedBlockPlacementsUntilWarning = 15; + playerData.warnedAboutBuildingOutsideClaims = true; - if(playerData.lastClaim != null && playerData.lastClaim.allowBuild(player) == null) + if(playerData.claims.size() < 2) { - Visualization visualization = Visualization.FromClaim(playerData.lastClaim, block.getY(), VisualizationType.Claim, player.getLocation()); - Visualization.Apply(player, visualization); + GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo, DataStore.SURVIVAL_VIDEO_URL); + } + + if(playerData.lastClaim != null) + { + Visualization visualization = Visualization.FromClaim(playerData.lastClaim, block.getY(), VisualizationType.Claim, player.getLocation()); + Visualization.Apply(player, visualization); } } } diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index dccb231..3e754f7 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -145,8 +145,6 @@ public class GriefPrevention extends JavaPlugin public List config_mods_ignoreClaimsAccounts; //list of player names which ALWAYS ignore claims public MaterialCollection config_mods_explodableIds; //list of block IDs which can be destroyed by explosions, even in claimed areas - public boolean config_claims_warnOnBuildOutside; //whether players should be warned when they're building in an unclaimed area - public HashMap config_seaLevelOverride; //override for sea level, because bukkit doesn't report the right value for all situations public boolean config_limitTreeGrowth; //whether trees should be prevented from growing into a claim from outside @@ -305,7 +303,6 @@ public class GriefPrevention extends JavaPlugin this.config_claims_minSize = config.getInt("GriefPrevention.Claims.MinimumSize", 10); this.config_claims_maxDepth = config.getInt("GriefPrevention.Claims.MaximumDepth", 0); this.config_claims_trappedCooldownHours = config.getInt("GriefPrevention.Claims.TrappedCommandCooldownHours", 8); - this.config_claims_warnOnBuildOutside = config.getBoolean("GriefPrevention.Claims.WarnWhenBuildingOutsideClaims", true); this.config_claims_chestClaimExpirationDays = config.getInt("GriefPrevention.Claims.Expiration.ChestClaimDays", 7); outConfig.set("GriefPrevention.Claims.Expiration.ChestClaimDays", this.config_claims_chestClaimExpirationDays); @@ -558,7 +555,6 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Claims.TrappedCommandCooldownHours", this.config_claims_trappedCooldownHours); outConfig.set("GriefPrevention.Claims.InvestigationTool", this.config_claims_investigationTool.name()); outConfig.set("GriefPrevention.Claims.ModificationTool", this.config_claims_modificationTool.name()); - outConfig.set("GriefPrevention.Claims.WarnWhenBuildingOutsideClaims", this.config_claims_warnOnBuildOutside); outConfig.set("GriefPrevention.Spam.Enabled", this.config_spam_enabled); outConfig.set("GriefPrevention.Spam.LoginCooldownSeconds", this.config_spam_loginCooldownSeconds); diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerData.java b/src/me/ryanhamshire/GriefPrevention/PlayerData.java index e75204f..eaa2aa1 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerData.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerData.java @@ -71,11 +71,8 @@ public class PlayerData //whether or not the player has a pending /trapped rescue public boolean pendingTrapped = false; - //last place the player damaged a chest - public Location lastChestDamageLocation = null; - - //number of blocks placed outside claims before next warning - int unclaimedBlockPlacementsUntilWarning = 1; + //whether this player was recently warned about building outside land claims + boolean warnedAboutBuildingOutsideClaims = false; //timestamp of last death, for use in preventing death message spam long lastDeathTimeStamp = 0;