API: per-player claim limits

Note: this is not persistent.
This commit is contained in:
RoboMWM 2016-11-20 18:56:00 -08:00
parent 514b0e5949
commit eeadbfa568

View File

@ -109,6 +109,9 @@ public class PlayerData
public InetAddress ipAddress; public InetAddress ipAddress;
//for addons to set per-player claim limits. Any negative value will use config's value
private int AccruedClaimBlocksLimit = -1;
//whether or not this player has received a message about unlocking death drops since his last death //whether or not this player has received a message about unlocking death drops since his last death
boolean receivedDropUnlockAdvertisement = false; boolean receivedDropUnlockAdvertisement = false;
@ -320,14 +323,17 @@ public class PlayerData
return claims; return claims;
} }
//determine limits based on permissions //Limit can be changed by addons
private int getAccruedClaimBlocksLimit() public int getAccruedClaimBlocksLimit()
{ {
//Player player = Bukkit.getServer().getPlayer(this.playerID); if (this.AccruedClaimBlocksLimit < 0)
//if the player isn't online, give him the benefit of any doubt return GriefPrevention.instance.config_claims_maxAccruedBlocks_default;
//if(player == null) return Integer.MAX_VALUE; return this.AccruedClaimBlocksLimit;
}
return GriefPrevention.instance.config_claims_maxAccruedBlocks_default; public void setAccruedClaimBlocksLimit(int limit)
{
this.AccruedClaimBlocksLimit = limit;
} }
public void accrueBlocks(int howMany) public void accrueBlocks(int howMany)