Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. HashMap<String, Integer> hits = new HashMap<String, Integer>();
  2.    
  3.     // Player causing damage, attacking another entity
  4.     private void onPlayerAttack(Player attacker, ItemStack weapon, Entity entity, EntityDamageByEntityEvent event) {
  5.         hits.put(attacker.getName(), hits.get(attacker.getName()) + 1);
  6.         if (weapon != null) {
  7.             if (isAxe(weapon.getType())) {
  8.                
  9.             }
  10.  
  11.             if (isSword(weapon.getType())) {
  12.                 // Sword + Aqua Affinity = Slowness
  13.                 if (hasEnch(weapon, AQUA_AFFINITY, attacker)) {
  14.                     if (entity instanceof LivingEntity) {
  15.                         ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, getLevel(weapon, AQUA_AFFINITY) * 20, 0));
  16.                     }
  17.                 }
  18.                 // Sword + Bane of Arthropods = Poison one second per level
  19.                 if(hasEnch(weapon, BANE_OF_ARTHROPODS, attacker)){
  20.                     if(entity instanceof LivingEntity){
  21.                         ((LivingEntity)entity).addPotionEffect(new PotionEffect(PotionEffectType.POISON, getLevel(weapon, BANE_OF_ARTHROPODS) * 20, 0));
  22.                     }
  23.                 }
  24.                 // Sword + Infinity = heals 1/4 of the damage you did to the enemy every 3rd hit.
  25.                 if(hasEnch(weapon, INFINITY, attacker)){
  26.                     if(hits.get(attacker.getName()) % 3 == 0)
  27.                     {
  28.                         attacker.setHealth(attacker.getHealth() + (event.getDamage() / 4));
  29.                     }
  30.                    
  31.                 }
  32.             }
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement