Bug fixes for animal vs splash potion protections.

This commit is contained in:
ryanhamshire 2015-02-11 19:01:41 -08:00
parent a29f18fe7a
commit da4f0fda73
2 changed files with 3 additions and 4 deletions

View File

@ -887,22 +887,22 @@ class EntityEventHandler implements Listener
for(PotionEffect effect : effects)
{
PotionEffectType effectType = effect.getType();
//restrict some potions on claimed animals (griefers could use this to kill or steal animals over fences)
if(effectType == PotionEffectType.JUMP || effectType == PotionEffectType.POISON)
if(effectType.getName().equals("JUMP") || effectType.getName().equals("POISON"))
{
for(LivingEntity effected : event.getAffectedEntities())
{
Claim cachedClaim = null;
if(effected instanceof Animals)
{
Claim claim = this.dataStore.getClaimAt(effected.getLocation(), false, cachedClaim);
Claim claim = this.dataStore.getClaimAt(effected.getLocation(), false, cachedClaim);
if(claim != null)
{
cachedClaim = claim;
if(claim.allowContainers(thrower) != null)
{
event.setCancelled(true);
GriefPrevention.sendMessage(thrower, TextMode.Err, Messages.NoDamageClaimedEntity, claim.getOwnerName());
return;
}
}

View File

@ -998,7 +998,6 @@ public class GriefPrevention extends JavaPlugin
}
catch(Exception e)
{
e.printStackTrace();
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferTopLevel);
return true;
}