Option to disable horse protections.

Allows other plugins with different horse protections to work.
This commit is contained in:
ryanhamshire 2014-11-12 18:41:51 -08:00
commit 47388f3f7c
2 changed files with 9 additions and 2 deletions

View File

@ -70,6 +70,7 @@ public class GriefPrevention extends JavaPlugin
public boolean config_claims_preventTheft; //whether containers and crafting blocks are protectable public boolean config_claims_preventTheft; //whether containers and crafting blocks are protectable
public boolean config_claims_protectCreatures; //whether claimed animals may be injured by players without permission public boolean config_claims_protectCreatures; //whether claimed animals may be injured by players without permission
public boolean config_claims_protectFires; //whether open flint+steel flames should be protected - optional because it's expensive public boolean config_claims_protectFires; //whether open flint+steel flames should be protected - optional because it's expensive
public boolean config_claims_protectHorses; //whether horses on a claim should be protected by that claim's rules
public boolean config_claims_preventButtonsSwitches; //whether buttons and switches are protectable public boolean config_claims_preventButtonsSwitches; //whether buttons and switches are protectable
public boolean config_claims_lockWoodenDoors; //whether wooden doors should be locked by default (require /accesstrust) public boolean config_claims_lockWoodenDoors; //whether wooden doors should be locked by default (require /accesstrust)
public boolean config_claims_lockTrapDoors; //whether trap doors should be locked by default (require /accesstrust) public boolean config_claims_lockTrapDoors; //whether trap doors should be locked by default (require /accesstrust)
@ -454,6 +455,7 @@ public class GriefPrevention extends JavaPlugin
this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true); this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true);
this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true); this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true);
this.config_claims_protectFires = config.getBoolean("GriefPrevention.Claims.ProtectFires", false); this.config_claims_protectFires = config.getBoolean("GriefPrevention.Claims.ProtectFires", false);
this.config_claims_protectHorses = config.getBoolean("GriefPrevention.Claims.ProtectHorses", true);
this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true); this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true);
this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false); this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false);
this.config_claims_lockTrapDoors = config.getBoolean("GriefPrevention.Claims.LockTrapDoors", false); this.config_claims_lockTrapDoors = config.getBoolean("GriefPrevention.Claims.LockTrapDoors", false);
@ -701,6 +703,7 @@ public class GriefPrevention extends JavaPlugin
outConfig.set("GriefPrevention.Claims.LockFenceGates", this.config_claims_lockFenceGates); outConfig.set("GriefPrevention.Claims.LockFenceGates", this.config_claims_lockFenceGates);
outConfig.set("GriefPrevention.Claims.EnderPearlsRequireAccessTrust", this.config_claims_enderPearlsRequireAccessTrust); outConfig.set("GriefPrevention.Claims.EnderPearlsRequireAccessTrust", this.config_claims_enderPearlsRequireAccessTrust);
outConfig.set("GriefPrevention.Claims.ProtectFires", this.config_claims_protectFires); outConfig.set("GriefPrevention.Claims.ProtectFires", this.config_claims_protectFires);
outConfig.set("GriefPrevention.Claims.ProtectHorses", this.config_claims_protectHorses);
outConfig.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks); outConfig.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks);
outConfig.set("GriefPrevention.Claims.BlocksAccruedPerHour", this.config_claims_blocksAccruedPerHour); outConfig.set("GriefPrevention.Claims.BlocksAccruedPerHour", this.config_claims_blocksAccruedPerHour);
outConfig.set("GriefPrevention.Claims.MaxAccruedBlocks", this.config_claims_maxAccruedBlocks); outConfig.set("GriefPrevention.Claims.MaxAccruedBlocks", this.config_claims_maxAccruedBlocks);

View File

@ -42,6 +42,7 @@ import org.bukkit.entity.Boat;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Hanging; import org.bukkit.entity.Hanging;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.entity.minecart.PoweredMinecart; import org.bukkit.entity.minecart.PoweredMinecart;
@ -811,8 +812,9 @@ class PlayerEventHandler implements Listener
if(!GriefPrevention.instance.claimsEnabledForWorld(entity.getWorld())) return; if(!GriefPrevention.instance.claimsEnabledForWorld(entity.getWorld())) return;
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId()); //allow horse protection to be overridden to allow management from other plugins
if (!GriefPrevention.instance.config_claims_protectHorses && entity instanceof Horse) return;
//don't allow interaction with item frames in claimed areas without build permission //don't allow interaction with item frames in claimed areas without build permission
if(entity instanceof Hanging) if(entity instanceof Hanging)
{ {
@ -825,6 +827,8 @@ class PlayerEventHandler implements Listener
} }
} }
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
//don't allow container access during pvp combat //don't allow container access during pvp combat
if((entity instanceof StorageMinecart || entity instanceof PoweredMinecart)) if((entity instanceof StorageMinecart || entity instanceof PoweredMinecart))
{ {