From a3a916f7d0c26a53599add73e9eb4e5a4ee34b84 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Mon, 12 Oct 2015 16:10:24 -0700 Subject: [PATCH] Added PvP rules options for lava and flint/steel. --- src/me/ryanhamshire/GriefPrevention/GriefPrevention.java | 8 +++++++- .../ryanhamshire/GriefPrevention/PlayerEventHandler.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 2147c74..d6362fb 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -136,6 +136,8 @@ public class GriefPrevention extends JavaPlugin public boolean config_pvp_noCombatInPlayerLandClaims; //whether players may fight in player-owned land claims public boolean config_pvp_noCombatInAdminLandClaims; //whether players may fight in admin-owned land claims public boolean config_pvp_noCombatInAdminSubdivisions; //whether players may fight in subdivisions of admin-owned land claims + public boolean config_pvp_allowLavaNearPlayers; //whether players may dump lava near other players in pvp worlds + public boolean config_pvp_allowFireNearPlayers; //whether players may start flint/steel fires near other players in pvp worlds public boolean config_lockDeathDropsInPvpWorlds; //whether players' dropped on death items are protected in pvp worlds public boolean config_lockDeathDropsInNonPvpWorlds; //whether players' dropped on death items are protected in non-pvp worlds @@ -692,6 +694,8 @@ public class GriefPrevention extends JavaPlugin 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); + this.config_pvp_allowLavaNearPlayers = config.getBoolean("GriefPrevention.PvP.AllowLavaDumpingNearOtherPlayers", true); + this.config_pvp_allowFireNearPlayers = config.getBoolean("GriefPrevention.PvP.AllowFlintAndSteelNearOtherPlayers", true); //optional database settings this.databaseUrl = config.getString("GriefPrevention.Database.URL", ""); @@ -765,6 +769,8 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.PvP.ProtectPlayersInLandClaims.PlayerOwnedClaims", this.config_pvp_noCombatInPlayerLandClaims); outConfig.set("GriefPrevention.PvP.ProtectPlayersInLandClaims.AdministrativeClaims", this.config_pvp_noCombatInAdminLandClaims); outConfig.set("GriefPrevention.PvP.ProtectPlayersInLandClaims.AdministrativeSubdivisions", this.config_pvp_noCombatInAdminSubdivisions); + outConfig.set("GriefPrevention.PvP.AllowLavaDumpingNearOtherPlayers", this.config_pvp_allowLavaNearPlayers); + outConfig.set("GriefPrevention.PvP.AllowFlintAndSteelNearOtherPlayers", this.config_pvp_allowFireNearPlayers); outConfig.set("GriefPrevention.Economy.ClaimBlocksPurchaseCost", this.config_economy_claimBlocksPurchaseCost); outConfig.set("GriefPrevention.Economy.ClaimBlocksSellValue", this.config_economy_claimBlocksSellValue); @@ -2545,7 +2551,7 @@ public class GriefPrevention extends JavaPlugin //helper method to resolve a player by name ConcurrentHashMap playerNameToIDMap = new ConcurrentHashMap(); - //thread to build the above cache + //thread to build the above cache private class CacheOfflinePlayerNamesThread extends Thread { private OfflinePlayer [] offlinePlayers; diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 070b447..4f42f0c 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -1391,7 +1391,7 @@ class PlayerEventHandler implements Listener } //lava buckets can't be dumped near other players unless pvp is on - if(!GriefPrevention.instance.pvpRulesApply(block.getWorld()) && !player.hasPermission("griefprevention.lava")) + if((!GriefPrevention.instance.pvpRulesApply(block.getWorld()) || !GriefPrevention.instance.config_pvp_allowLavaNearPlayers) && !player.hasPermission("griefprevention.lava")) { if(bucketEvent.getBucket() == Material.LAVA_BUCKET) {