if (damager instanceof Player) {
Player striker = (Player) damager;
List<ItemStack> strikerEquipment = new ArrayList<ItemStack>();
strikerEquipment.add(striker.getItemInHand());
for (String s : listEffects(strikerEquipment)) {
ItemEffectEvent iee = new ItemEffectEvent(damaged, damager, s);
Bukkit.getPluginManager().callEvent(iee);
if (!iee.isCancelled())
addEffect(iee.getDamaged(), iee.getDamager(),
iee.getEffect(), event);
}
}
if (damaged instanceof Player) {
Player struck = (Player) damaged;
List<ItemStack> struckEquipment = new ArrayList<ItemStack>();
struckEquipment.addAll(Arrays.asList(struck.getInventory()
.getArmorContents()));
for (String s : listEffects(struckEquipment)) {
ItemEffectEvent iee = new ItemEffectEvent(damaged, damager, s);
Bukkit.getPluginManager().callEvent(iee);
if (!iee.isCancelled())
addEffect(iee.getDamager(), iee.getDamaged(),
iee.getEffect(), event);
}
}
}