From 750fd1de5b26901d08974b2245125c77062121d9 Mon Sep 17 00:00:00 2001 From: Erik1988 Date: Thu, 22 Sep 2016 22:14:03 +0200 Subject: [PATCH] Add option to allow /trapped to be used in administrative claims (#8) erik1988: Its now possible to allow players to use /trapped inside adminclaims. Note that its off by default. --- src/me/ryanhamshire/GriefPrevention/GriefPrevention.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 943460f..bab39e2 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -122,6 +122,7 @@ public class GriefPrevention extends JavaPlugin public int config_claims_chestClaimExpirationDays; //number of days of inactivity before an automatic chest claim will be deleted public int config_claims_unusedClaimExpirationDays; //number of days of inactivity before an unused (nothing build) claim will be deleted public boolean config_claims_survivalAutoNatureRestoration; //whether survival claims will be automatically restored to nature when auto-deleted + public boolean config_claims_allowTrappedInAdminClaims; //whether it should be allowed to use /trapped in adminclaims. public Material config_claims_investigationTool; //which material will be used to investigate claims with a right click public Material config_claims_modificationTool; //which material will be used to create/resize claims with a right click @@ -554,6 +555,8 @@ public class GriefPrevention extends JavaPlugin this.config_claims_expirationExemptionTotalBlocks = config.getInt("GriefPrevention.Claims.Expiration.AllClaims.ExceptWhenOwnerHasTotalClaimBlocks", 10000); this.config_claims_expirationExemptionBonusBlocks = config.getInt("GriefPrevention.Claims.Expiration.AllClaims.ExceptWhenOwnerHasBonusClaimBlocks", 5000); this.config_claims_survivalAutoNatureRestoration = config.getBoolean("GriefPrevention.Claims.Expiration.AutomaticNatureRestoration.SurvivalWorlds", false); + this.config_claims_allowTrappedInAdminClaims = config.getBoolean("GriefPrevention.Claims.AllowTrappedInAdminClaims", false); + this.config_claims_maxClaimsPerPlayer = config.getInt("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", 0); this.config_claims_respectWorldGuard = config.getBoolean("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", true); this.config_claims_portalsRequirePermission = config.getBoolean("GriefPrevention.Claims.PortalGenerationRequiresPermission", false); @@ -796,6 +799,7 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Claims.Expiration.AllClaims.ExceptWhenOwnerHasTotalClaimBlocks", this.config_claims_expirationExemptionTotalBlocks); outConfig.set("GriefPrevention.Claims.Expiration.AllClaims.ExceptWhenOwnerHasBonusClaimBlocks", this.config_claims_expirationExemptionBonusBlocks); outConfig.set("GriefPrevention.Claims.Expiration.AutomaticNatureRestoration.SurvivalWorlds", this.config_claims_survivalAutoNatureRestoration); + outConfig.set("GriefPrevention.Claims.AllowTrappedInAdminClaims", this.config_claims_allowTrappedInAdminClaims); outConfig.set("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", this.config_claims_maxClaimsPerPlayer); outConfig.set("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", this.config_claims_respectWorldGuard); outConfig.set("GriefPrevention.Claims.PortalGenerationRequiresPermission", this.config_claims_portalsRequirePermission); @@ -2343,13 +2347,12 @@ public class GriefPrevention extends JavaPlugin return true; } - //if the player is in an administrative claim, he should contact an admin - if(claim.isAdminClaim() && event.getDestination() == null) + //if the player is in an administrative claim and AllowTrappedInAdminClaims is false, he should contact an admin + if(!GriefPrevention.instance.config_claims_allowTrappedInAdminClaims && claim.isAdminClaim() && event.getDestination() == null) { GriefPrevention.sendMessage(player, TextMode.Err, Messages.TrappedWontWorkHere); return true; } - //send instructions GriefPrevention.sendMessage(player, TextMode.Instr, Messages.RescuePending);