From eeadbfa5681ad7a26cf415f0ec0d6632a952abe7 Mon Sep 17 00:00:00 2001 From: RoboMWM Date: Sun, 20 Nov 2016 18:56:00 -0800 Subject: [PATCH] API: per-player claim limits Note: this is not persistent. --- .../GriefPrevention/PlayerData.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerData.java b/src/me/ryanhamshire/GriefPrevention/PlayerData.java index 10bb25b..1f5a775 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerData.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerData.java @@ -109,6 +109,9 @@ public class PlayerData 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 boolean receivedDropUnlockAdvertisement = false; @@ -320,14 +323,17 @@ public class PlayerData return claims; } - //determine limits based on permissions - private int getAccruedClaimBlocksLimit() + //Limit can be changed by addons + public int getAccruedClaimBlocksLimit() { - //Player player = Bukkit.getServer().getPlayer(this.playerID); - //if the player isn't online, give him the benefit of any doubt - //if(player == null) return Integer.MAX_VALUE; + if (this.AccruedClaimBlocksLimit < 0) + return GriefPrevention.instance.config_claims_maxAccruedBlocks_default; + return this.AccruedClaimBlocksLimit; + } - return GriefPrevention.instance.config_claims_maxAccruedBlocks_default; + public void setAccruedClaimBlocksLimit(int limit) + { + this.AccruedClaimBlocksLimit = limit; } public void accrueBlocks(int howMany)