From 5f6b541af8c3459e413f90d6d4e758bcaa871a57 Mon Sep 17 00:00:00 2001 From: David Precious Date: Thu, 31 Aug 2017 23:49:33 +0100 Subject: [PATCH] Configurable siege resecure time (#203) * Configurable time until sieged claim is resecured Fixes #113. Makes the five minute period after winning a siege, during which the claim is not secured, customizable. --- src/me/ryanhamshire/GriefPrevention/DataStore.java | 7 +++++-- src/me/ryanhamshire/GriefPrevention/GriefPrevention.java | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/DataStore.java b/src/me/ryanhamshire/GriefPrevention/DataStore.java index 4b092cb..a0afd2e 100644 --- a/src/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DataStore.java @@ -1059,7 +1059,10 @@ public abstract class DataStore //schedule a task to secure the claims in about 5 minutes SecureClaimTask task = new SecureClaimTask(siegeData); - GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task, 20L * 60 * 5); + + GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask( + GriefPrevention.instance, task, 20L * GriefPrevention.instance.config_siege_doorsOpenSeconds + ); } } @@ -1533,7 +1536,7 @@ public abstract class DataStore this.addDefault(defaults, Messages.AbandonClaimAdvertisement, "To delete another claim and free up some blocks, use /AbandonClaim.", null); this.addDefault(defaults, Messages.CreateClaimFailOverlapShort, "Your selected area overlaps an existing claim.", null); this.addDefault(defaults, Messages.CreateClaimSuccess, "Claim created! Use /trust to share it with friends.", null); - this.addDefault(defaults, Messages.SiegeWinDoorsOpen, "Congratulations! Buttons and levers are temporarily unlocked (five minutes).", null); + this.addDefault(defaults, Messages.SiegeWinDoorsOpen, "Congratulations! Buttons and levers are temporarily unlocked.", null); this.addDefault(defaults, Messages.RescueAbortedMoved, "You moved! Rescue cancelled.", null); this.addDefault(defaults, Messages.SiegeDoorsLockedEjection, "Looting time is up! Ejected from the claim.", null); this.addDefault(defaults, Messages.NoModifyDuringSiege, "Claims can't be modified while under siege.", null); diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index b76b601..74b92c7 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -134,6 +134,7 @@ public class GriefPrevention extends JavaPlugin public ArrayList config_siege_enabledWorlds; //whether or not /siege is enabled on this server public ArrayList config_siege_blocks; //which blocks will be breakable in siege mode + public int config_siege_doorsOpenSeconds; // how before claim is re-secured after siege win public boolean config_spam_enabled; //whether or not to monitor for spam public int config_spam_loginCooldownSeconds; //how long players must wait between logins. combats login spam. @@ -746,6 +747,8 @@ public class GriefPrevention extends JavaPlugin } } + this.config_siege_doorsOpenSeconds = config.getInt("GriefPrevention.Siege.DoorsOpenDelayInSeconds", 5*60); + this.config_pvp_noCombatInPlayerLandClaims = config.getBoolean("GriefPrevention.PvP.ProtectPlayersInLandClaims.PlayerOwnedClaims", this.config_siege_enabledWorlds.size() == 0); this.config_pvp_noCombatInAdminLandClaims = config.getBoolean("GriefPrevention.PvP.ProtectPlayersInLandClaims.AdministrativeClaims", this.config_siege_enabledWorlds.size() == 0); this.config_pvp_noCombatInAdminSubdivisions = config.getBoolean("GriefPrevention.PvP.ProtectPlayersInLandClaims.AdministrativeSubdivisions", this.config_siege_enabledWorlds.size() == 0); @@ -877,6 +880,7 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Siege.Worlds", siegeEnabledWorldNames); outConfig.set("GriefPrevention.Siege.BreakableBlocks", breakableBlocksList); + outConfig.set("GriefPrevention.Siege.DoorsOpenDelayInSeconds", this.config_siege_doorsOpenSeconds); outConfig.set("GriefPrevention.EndermenMoveBlocks", this.config_endermenMoveBlocks); outConfig.set("GriefPrevention.SilverfishBreakBlocks", this.config_silverfishBreakBlocks);