Guest User

Untitled

a guest
Oct 31st, 2014
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @EventHandler
  2. public void onHit(EntityDamageByEntityEvent e){
  3. if(e.getDamager().isValid()){
  4. EntityType damager = e.getDamager().getType();
  5. Entity damaged = (Entity) e.getEntity();
  6. if(damager.equals(EntityType.PLAYER) && damaged instanceof Player){
  7. Player dmged = (Player) e.getEntity();
  8. Player dmgr = (Player) e.getDamager();
  9. ItemStack hand = dmgr.getItemInHand();
  10. if(hand.hasItemMeta() && hand.getItemMeta().hasLore()){
  11. for(int i = 0;i <hand.getItemMeta().getLore().size(); i++){
  12. if(hand.getItemMeta().getLore().get(i).equalsIgnoreCase("Venom III")){
  13. dmged.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20*8, 2));
  14. dmged.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 20*8, 1));
  15. }
  16. }
  17. }
  18. }
  19. }
  20. }
RAW Paste Data