From 00fbb0f25724af1dadf1464eb98e62ae07ae5b55 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Wed, 29 Oct 2014 15:10:04 -0700 Subject: [PATCH] Sheep can't be dyed or sheared without permission. Note: The client will still update the sheep color even when the event is cancelled. Reconnecting to the server or shearing the sheep (with /ignoreclaims) will prove the sheep was not actually dyed. --- .../GriefPrevention/PlayerEventHandler.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index e17cb02..dc73dc6 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -818,22 +818,27 @@ class PlayerEventHandler implements Listener event.setCancelled(true); } } - - //if the entity is an animal, apply container rules - else if(entity instanceof Animals) - { - if(claim.allowContainers(player) != null) - { - String message = GriefPrevention.instance.dataStore.getMessage(Messages.NoDamageClaimedEntity, claim.getOwnerName()); - if(player.hasPermission("griefprevention.ignoreclaims")) - message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement); - GriefPrevention.sendMessage(player, TextMode.Err, message); - event.setCancelled(true); - } - } } } + //if the entity is an animal, apply container rules + if(GriefPrevention.instance.config_claims_preventTheft && entity instanceof Animals) + { + //if the entity is in a claim + Claim claim = this.dataStore.getClaimAt(entity.getLocation(), false, null); + if(claim != null) + { + if(claim.allowContainers(player) != null) + { + String message = GriefPrevention.instance.dataStore.getMessage(Messages.NoDamageClaimedEntity, claim.getOwnerName()); + if(player.hasPermission("griefprevention.ignoreclaims")) + message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement); + GriefPrevention.sendMessage(player, TextMode.Err, message); + event.setCancelled(true); + } + } + } + //if preventing theft, prevent leashing claimed creatures if(GriefPrevention.instance.config_claims_preventTheft && entity instanceof Creature && player.getItemInHand().getType() == Material.LEASH) {