Reduced frequency of "building outside claims".

Added a 10 minute cooldown period and administrators (those who can
create admin claims) won't see it at all.
This commit is contained in:
ryanhamshire 2015-01-14 19:46:15 -08:00
parent c26e0b3160
commit 696df595bd
2 changed files with 24 additions and 14 deletions

View File

@ -271,13 +271,19 @@ public class BlockEventHandler implements Listener
//FEATURE: warn players when they're placing non-trash blocks outside of their claimed areas
else if(!this.trashBlocks.contains(block.getType()) && GriefPrevention.instance.claimsEnabledForWorld(block.getWorld()))
{
if(!playerData.warnedAboutBuildingOutsideClaims
if(!playerData.warnedAboutBuildingOutsideClaims && !player.hasPermission("griefprevention.adminclaims")
&& ((playerData.lastClaim == null && playerData.getClaims().size() == 0)
|| (playerData.lastClaim != null && playerData.lastClaim.isNear(player.getLocation(), 15))))
{
Long now = null;
if(playerData.buildWarningTimestamp == null || (now = System.currentTimeMillis()) - playerData.buildWarningTimestamp > 600000) //10 minute cooldown
{
GriefPrevention.sendMessage(player, TextMode.Warn, Messages.BuildingOutsideClaims);
playerData.warnedAboutBuildingOutsideClaims = true;
if(now == null) now = System.currentTimeMillis();
playerData.buildWarningTimestamp = now;
if(playerData.getClaims().size() < 2)
{
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
@ -290,6 +296,7 @@ public class BlockEventHandler implements Listener
}
}
}
}
//warn players when they place TNT above sea level, since it doesn't destroy blocks there
if( GriefPrevention.instance.config_blockSurfaceOtherExplosions && block.getType() == Material.TNT &&

View File

@ -125,6 +125,9 @@ public class PlayerData
//player which a pet will be given to when it's right-clicked
OfflinePlayer petGiveawayRecipient = null;
//timestamp for last "you're building outside your land claims" message
Long buildWarningTimestamp = null;
//whether or not this player is "in" pvp combat
public boolean inPvpCombat()
{