Add option to disable negative claim block amount fixing (#236)

This commit is contained in:
RoboMWM 2017-12-19 14:05:27 -08:00 committed by GitHub
parent 8040a17e5d
commit 7aa9680876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -6,7 +6,7 @@
<groupId>me.ryanhamshire</groupId> <groupId>me.ryanhamshire</groupId>
<artifactId>GriefPrevention</artifactId> <artifactId>GriefPrevention</artifactId>
<version>16.7.1</version> <version>16.8-RC2</version>
<properties> <properties>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>

View File

@ -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_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_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 //custom log settings
public int config_logs_daysToKeep; public int config_logs_daysToKeep;
@ -760,6 +762,8 @@ public class GriefPrevention extends JavaPlugin
this.databaseUrl = config.getString("GriefPrevention.Database.URL", ""); this.databaseUrl = config.getString("GriefPrevention.Database.URL", "");
this.databaseUserName = config.getString("GriefPrevention.Database.UserName", ""); this.databaseUserName = config.getString("GriefPrevention.Database.UserName", "");
this.databasePassword = config.getString("GriefPrevention.Database.Password", ""); this.databasePassword = config.getString("GriefPrevention.Database.Password", "");
this.config_advanced_fixNegativeClaimblockAmounts = config.getBoolean("GriefPrevention.Advanced.fixNegativeClaimblockAmounts", true);
//custom logger settings //custom logger settings
this.config_logs_daysToKeep = config.getInt("GriefPrevention.Abridged Logs.Days To Keep", 7); 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.BlockIdsRequiringAccessTrust", accessTrustStrings);
outConfig.set("GriefPrevention.Mods.BlockIdsRequiringContainerTrust", containerTrustStrings); outConfig.set("GriefPrevention.Mods.BlockIdsRequiringContainerTrust", containerTrustStrings);
outConfig.set("GriefPrevention.Mods.BlockIdsExplodable", explodableStrings); outConfig.set("GriefPrevention.Mods.BlockIdsExplodable", explodableStrings);
outConfig.set("GriefPrevention.Advanced.fixNegativeClaimblockAmounts", this.config_advanced_fixNegativeClaimblockAmounts);
//custom logger settings //custom logger settings
outConfig.set("GriefPrevention.Abridged Logs.Days To Keep", this.config_logs_daysToKeep); 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); outConfig.set("GriefPrevention.Abridged Logs.Included Entry Types.Social Activity", this.config_logs_socialEnabled);

View File

@ -226,7 +226,7 @@ public class PlayerData
this.accruedClaimBlocks = storageData.accruedClaimBlocks; this.accruedClaimBlocks = storageData.accruedClaimBlocks;
//ensure at least minimum accrued are accrued (in case of settings changes to increase initial amount) //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; this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
} }
@ -280,7 +280,7 @@ public class PlayerData
//if total claimed area is more than total blocks available //if total claimed area is more than total blocks available
int totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID); 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); 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); GriefPrevention.AddLogEntry(player.getName() + " has more claimed land than blocks available. Adding blocks to fix.", CustomLogEntryTypes.Debug, true);