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,14 +1300,8 @@ 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)) {
return;
}
p = (Player) shooter;
}
else if (damager instanceof ThrownPotion) {
ThrownPotion potion = (ThrownPotion) damager; ThrownPotion potion = (ThrownPotion) damager;
Collection<PotionEffect> effects = potion.getEffects(); Collection<PotionEffect> effects = potion.getEffects();
for (PotionEffect effect : effects) { for (PotionEffect effect : effects) {
@ -1320,6 +1316,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
} }
else {
ProjectileSource shooter = projectile.getShooter();
if (shooter == null || !(shooter instanceof Player)) {
return;
}
p = (Player) shooter;
}
}
else { else {
return; return;
} }