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.
This commit is contained in:
ryanhamshire 2014-10-13 14:15:39 -07:00
parent b016ad14e7
commit 5e01b64af4
3 changed files with 17 additions and 17 deletions

View File

@ -248,8 +248,8 @@ public class BlockEventHandler implements Listener
this.dataStore.extendClaim(claim, claim.getLesserBoundaryCorner().getBlockY() - GriefPrevention.instance.config_claims_claimsExtendIntoGroundDistance); 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 //allow for a build warning in the future
playerData.unclaimedBlockPlacementsUntilWarning = 1; playerData.warnedAboutBuildingOutsideClaims = false;
} }
//FEATURE: automatically create a claim when a player who has no claims places a chest //FEATURE: automatically create a claim when a player who has no claims places a chest
@ -332,14 +332,21 @@ public class BlockEventHandler implements Listener
} }
//FEATURE: warn players when they're placing non-trash blocks outside of their claimed areas //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); 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)
{
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 visualization = Visualization.FromClaim(playerData.lastClaim, block.getY(), VisualizationType.Claim, player.getLocation());
Visualization.Apply(player, visualization); Visualization.Apply(player, visualization);

View File

@ -145,8 +145,6 @@ public class GriefPrevention extends JavaPlugin
public List<String> config_mods_ignoreClaimsAccounts; //list of player names which ALWAYS ignore claims public List<String> 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 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<String, Integer> config_seaLevelOverride; //override for sea level, because bukkit doesn't report the right value for all situations public HashMap<String, Integer> 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 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_minSize = config.getInt("GriefPrevention.Claims.MinimumSize", 10);
this.config_claims_maxDepth = config.getInt("GriefPrevention.Claims.MaximumDepth", 0); this.config_claims_maxDepth = config.getInt("GriefPrevention.Claims.MaximumDepth", 0);
this.config_claims_trappedCooldownHours = config.getInt("GriefPrevention.Claims.TrappedCommandCooldownHours", 8); 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); this.config_claims_chestClaimExpirationDays = config.getInt("GriefPrevention.Claims.Expiration.ChestClaimDays", 7);
outConfig.set("GriefPrevention.Claims.Expiration.ChestClaimDays", this.config_claims_chestClaimExpirationDays); 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.TrappedCommandCooldownHours", this.config_claims_trappedCooldownHours);
outConfig.set("GriefPrevention.Claims.InvestigationTool", this.config_claims_investigationTool.name()); outConfig.set("GriefPrevention.Claims.InvestigationTool", this.config_claims_investigationTool.name());
outConfig.set("GriefPrevention.Claims.ModificationTool", this.config_claims_modificationTool.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.Enabled", this.config_spam_enabled);
outConfig.set("GriefPrevention.Spam.LoginCooldownSeconds", this.config_spam_loginCooldownSeconds); outConfig.set("GriefPrevention.Spam.LoginCooldownSeconds", this.config_spam_loginCooldownSeconds);

View File

@ -71,11 +71,8 @@ public class PlayerData
//whether or not the player has a pending /trapped rescue //whether or not the player has a pending /trapped rescue
public boolean pendingTrapped = false; public boolean pendingTrapped = false;
//last place the player damaged a chest //whether this player was recently warned about building outside land claims
public Location lastChestDamageLocation = null; boolean warnedAboutBuildingOutsideClaims = false;
//number of blocks placed outside claims before next warning
int unclaimedBlockPlacementsUntilWarning = 1;
//timestamp of last death, for use in preventing death message spam //timestamp of last death, for use in preventing death message spam
long lastDeathTimeStamp = 0; long lastDeathTimeStamp = 0;