From 7aa96808762004f445b8ba6c2b6cbcb7c5857c5b Mon Sep 17 00:00:00 2001 From: RoboMWM Date: Tue, 19 Dec 2017 14:05:27 -0800 Subject: [PATCH] Add option to disable negative claim block amount fixing (#236) --- pom.xml | 2 +- src/me/ryanhamshire/GriefPrevention/GriefPrevention.java | 8 +++++++- src/me/ryanhamshire/GriefPrevention/PlayerData.java | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ae691fa..59088e0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.ryanhamshire GriefPrevention - 16.7.1 + 16.8-RC2 1.8 1.8 diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 58e9cae..c42ac2b 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -199,6 +199,8 @@ public class GriefPrevention extends JavaPlugin public boolean config_limitTreeGrowth; //whether trees should be prevented from growing into a claim from outside public boolean config_pistonsInClaimsOnly; //whether pistons are limited to only move blocks located within the piston's land claim + + public boolean config_advanced_fixNegativeClaimblockAmounts; //whether to attempt to fix negative claim block amounts (some addons cause/assume players can go into negative amounts) //custom log settings public int config_logs_daysToKeep; @@ -760,6 +762,8 @@ public class GriefPrevention extends JavaPlugin this.databaseUrl = config.getString("GriefPrevention.Database.URL", ""); this.databaseUserName = config.getString("GriefPrevention.Database.UserName", ""); this.databasePassword = config.getString("GriefPrevention.Database.Password", ""); + + this.config_advanced_fixNegativeClaimblockAmounts = config.getBoolean("GriefPrevention.Advanced.fixNegativeClaimblockAmounts", true); //custom logger settings this.config_logs_daysToKeep = config.getInt("GriefPrevention.Abridged Logs.Days To Keep", 7); @@ -902,7 +906,9 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Mods.BlockIdsRequiringAccessTrust", accessTrustStrings); outConfig.set("GriefPrevention.Mods.BlockIdsRequiringContainerTrust", containerTrustStrings); outConfig.set("GriefPrevention.Mods.BlockIdsExplodable", explodableStrings); - + + outConfig.set("GriefPrevention.Advanced.fixNegativeClaimblockAmounts", this.config_advanced_fixNegativeClaimblockAmounts); + //custom logger settings outConfig.set("GriefPrevention.Abridged Logs.Days To Keep", this.config_logs_daysToKeep); outConfig.set("GriefPrevention.Abridged Logs.Included Entry Types.Social Activity", this.config_logs_socialEnabled); diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerData.java b/src/me/ryanhamshire/GriefPrevention/PlayerData.java index 60bd8e5..14037c3 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerData.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerData.java @@ -226,7 +226,7 @@ public class PlayerData this.accruedClaimBlocks = storageData.accruedClaimBlocks; //ensure at least minimum accrued are accrued (in case of settings changes to increase initial amount) - if(this.accruedClaimBlocks < GriefPrevention.instance.config_claims_initialBlocks) + if(GriefPrevention.instance.config_advanced_fixNegativeClaimblockAmounts && (this.accruedClaimBlocks < GriefPrevention.instance.config_claims_initialBlocks)) { this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks; } @@ -280,7 +280,7 @@ public class PlayerData //if total claimed area is more than total blocks available int totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID); - if(totalBlocks < totalClaimsArea) + if(GriefPrevention.instance.config_advanced_fixNegativeClaimblockAmounts && totalBlocks < totalClaimsArea) { OfflinePlayer player = GriefPrevention.instance.getServer().getOfflinePlayer(this.playerID); GriefPrevention.AddLogEntry(player.getName() + " has more claimed land than blocks available. Adding blocks to fix.", CustomLogEntryTypes.Debug, true);