This commit is contained in:
boy0001 2015-04-24 19:47:31 +10:00
parent 0da524bfde
commit 41bb2c0284

View File

@ -20,12 +20,14 @@ import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LargeFireball; import org.bukkit.entity.LargeFireball;
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.Projectile;
import org.bukkit.entity.SmallFireball; import org.bukkit.entity.SmallFireball;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
@ -1298,27 +1300,29 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
else if (damager instanceof Projectile) { else if (damager instanceof Projectile) {
projectile = (Projectile) damager; projectile = (Projectile) damager;
//Arrow, Egg, EnderPearl, Fireball, Fish, FishHook, LargeFireball, SmallFireball, Snowball, ThrownExpBottle, ThrownPotion, WitherSkull //Arrow, Egg, EnderPearl, Fireball, Fish, FishHook, LargeFireball, SmallFireball, Snowball, ThrownExpBottle, ThrownPotion, WitherSkull
if (damager instanceof Arrow || damager instanceof LargeFireball || damager instanceof Fireball || damager instanceof SmallFireball) { if (damager instanceof Projectile) {
ProjectileSource shooter = projectile.getShooter(); if (damager instanceof ThrownPotion) {
if (shooter == null || !(shooter instanceof Player)) { ThrownPotion potion = (ThrownPotion) damager;
return; Collection<PotionEffect> effects = potion.getEffects();
} for (PotionEffect effect : effects) {
p = (Player) shooter; PotionEffectType type = effect.getType();
} if (type == PotionEffectType.BLINDNESS || type == PotionEffectType.CONFUSION || type == PotionEffectType.HARM || type == PotionEffectType.INVISIBILITY || type == PotionEffectType.POISON || type == PotionEffectType.SLOW || type == PotionEffectType.SLOW_DIGGING || type == PotionEffectType.WEAKNESS || type == PotionEffectType.WITHER) {
else if (damager instanceof ThrownPotion) { ProjectileSource shooter = ((Projectile) damager).getShooter();
ThrownPotion potion = (ThrownPotion) damager; if (shooter == null || !(shooter instanceof Player)) {
Collection<PotionEffect> effects = potion.getEffects(); return;
for (PotionEffect effect : effects) { }
PotionEffectType type = effect.getType(); p = (Player) shooter;
if (type == PotionEffectType.BLINDNESS || type == PotionEffectType.CONFUSION || type == PotionEffectType.HARM || type == PotionEffectType.INVISIBILITY || type == PotionEffectType.POISON || type == PotionEffectType.SLOW || type == PotionEffectType.SLOW_DIGGING || type == PotionEffectType.WEAKNESS || type == PotionEffectType.WITHER) { break;
ProjectileSource shooter = ((Projectile) damager).getShooter();
if (shooter == null || !(shooter instanceof Player)) {
return;
} }
p = (Player) shooter;
break;
} }
} }
else {
ProjectileSource shooter = projectile.getShooter();
if (shooter == null || !(shooter instanceof Player)) {
return;
}
p = (Player) shooter;
}
} }
else { else {
return; return;