Fixes: Fishing Rods and Snowballs
Fixed animal theft with fishing rods, player harassment in pvp safe zones with snowballs.
This commit is contained in:
parent
5df24c1302
commit
23bd87f8e2
|
|
@ -36,6 +36,7 @@ import org.bukkit.entity.Explosive;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
|
|
||||||
|
|
@ -357,28 +358,20 @@ class EntityEventHandler implements Listener
|
||||||
|
|
||||||
//determine which player is attacking, if any
|
//determine which player is attacking, if any
|
||||||
Player attacker = null;
|
Player attacker = null;
|
||||||
Arrow arrow = null;
|
Projectile arrow = null;
|
||||||
Entity damageSource = subEvent.getDamager();
|
Entity damageSource = subEvent.getDamager();
|
||||||
if(damageSource instanceof Player)
|
if(damageSource instanceof Player)
|
||||||
{
|
{
|
||||||
attacker = (Player)damageSource;
|
attacker = (Player)damageSource;
|
||||||
}
|
}
|
||||||
else if(damageSource instanceof Arrow)
|
else if(damageSource instanceof Projectile)
|
||||||
{
|
{
|
||||||
arrow = (Arrow)damageSource;
|
arrow = (Projectile)damageSource;
|
||||||
if(arrow.getShooter() instanceof Player)
|
if(arrow.getShooter() instanceof Player)
|
||||||
{
|
{
|
||||||
attacker = (Player)arrow.getShooter();
|
attacker = (Player)arrow.getShooter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(damageSource instanceof ThrownPotion)
|
|
||||||
{
|
|
||||||
ThrownPotion potion = (ThrownPotion)damageSource;
|
|
||||||
if(potion.getShooter() instanceof Player)
|
|
||||||
{
|
|
||||||
attacker = (Player)potion.getShooter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if the attacker is a player and defender is a player (pvp combat)
|
//if the attacker is a player and defender is a player (pvp combat)
|
||||||
if(attacker != null && event.getEntity() instanceof Player && GriefPrevention.instance.config_pvp_enabledWorlds.contains(attacker.getWorld()))
|
if(attacker != null && event.getEntity() instanceof Player && GriefPrevention.instance.config_pvp_enabledWorlds.contains(attacker.getWorld()))
|
||||||
|
|
@ -577,26 +570,18 @@ class EntityEventHandler implements Listener
|
||||||
//determine which player is attacking, if any
|
//determine which player is attacking, if any
|
||||||
Player attacker = null;
|
Player attacker = null;
|
||||||
Entity damageSource = event.getAttacker();
|
Entity damageSource = event.getAttacker();
|
||||||
if(damageSource instanceof Player)
|
if(damageSource.getType() == EntityType.PLAYER)
|
||||||
{
|
{
|
||||||
attacker = (Player)damageSource;
|
attacker = (Player)damageSource;
|
||||||
}
|
}
|
||||||
else if(damageSource instanceof Arrow)
|
else if(damageSource instanceof Projectile)
|
||||||
{
|
{
|
||||||
Arrow arrow = (Arrow)damageSource;
|
Projectile arrow = (Projectile)damageSource;
|
||||||
if(arrow.getShooter() instanceof Player)
|
if(arrow.getShooter() instanceof Player)
|
||||||
{
|
{
|
||||||
attacker = (Player)arrow.getShooter();
|
attacker = (Player)arrow.getShooter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(damageSource instanceof ThrownPotion)
|
|
||||||
{
|
|
||||||
ThrownPotion potion = (ThrownPotion)damageSource;
|
|
||||||
if(potion.getShooter() instanceof Player)
|
|
||||||
{
|
|
||||||
attacker = (Player)potion.getShooter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if not a player and not an explosion, always allow
|
//if not a player and not an explosion, always allow
|
||||||
if(attacker == null && !(damageSource instanceof Explosive))
|
if(attacker == null && !(damageSource instanceof Explosive))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user