From 96721a50538200795dcba8b599bb4d0e27650cd6 Mon Sep 17 00:00:00 2001 From: Matt D Date: Tue, 4 Nov 2014 04:14:45 -0500 Subject: [PATCH] Added support for optional horse protection to allow other plugins to manage these entities --- src/me/ryanhamshire/GriefPrevention/GriefPrevention.java | 3 +++ src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index c25f129..d12c5e8 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -69,6 +69,7 @@ public class GriefPrevention extends JavaPlugin 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_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_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) @@ -319,6 +320,7 @@ public class GriefPrevention extends JavaPlugin this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true); this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true); + this.config_claims_protectHorses = config.getBoolean("GriefPrevention.Claims.ProtectHorses", true); this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true); this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false); this.config_claims_lockTrapDoors = config.getBoolean("GriefPrevention.Claims.LockTrapDoors", false); @@ -564,6 +566,7 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Claims.PreventTheft", this.config_claims_preventTheft); outConfig.set("GriefPrevention.Claims.ProtectCreatures", this.config_claims_protectCreatures); + outConfig.set("GriefPrevention.Claims.ProtectHorses", this.config_claims_protectHorses); outConfig.set("GriefPrevention.Claims.PreventButtonsSwitches", this.config_claims_preventButtonsSwitches); outConfig.set("GriefPrevention.Claims.LockWoodenDoors", this.config_claims_lockWoodenDoors); outConfig.set("GriefPrevention.Claims.LockTrapDoors", this.config_claims_lockTrapDoors); diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 9371ded..1b572de 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -42,6 +42,7 @@ import org.bukkit.entity.Boat; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.Hanging; +import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.entity.Vehicle; import org.bukkit.entity.minecart.PoweredMinecart; @@ -813,6 +814,11 @@ class PlayerEventHandler implements Listener 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 if(entity instanceof Hanging) {