Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HashMap<String, Integer> hits = new HashMap<String, Integer>();
- // Player causing damage, attacking another entity
- private void onPlayerAttack(Player attacker, ItemStack weapon, Entity entity, EntityDamageByEntityEvent event) {
- hits.put(attacker.getName(), hits.get(attacker.getName()) + 1);
- if (weapon != null) {
- if (isAxe(weapon.getType())) {
- }
- if (isSword(weapon.getType())) {
- // Sword + Aqua Affinity = Slowness
- if (hasEnch(weapon, AQUA_AFFINITY, attacker)) {
- if (entity instanceof LivingEntity) {
- ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, getLevel(weapon, AQUA_AFFINITY) * 20, 0));
- }
- }
- // Sword + Bane of Arthropods = Poison one second per level
- if(hasEnch(weapon, BANE_OF_ARTHROPODS, attacker)){
- if(entity instanceof LivingEntity){
- ((LivingEntity)entity).addPotionEffect(new PotionEffect(PotionEffectType.POISON, getLevel(weapon, BANE_OF_ARTHROPODS) * 20, 0));
- }
- }
- // Sword + Infinity = heals 1/4 of the damage you did to the enemy every 3rd hit.
- if(hasEnch(weapon, INFINITY, attacker)){
- if(hits.get(attacker.getName()) % 3 == 0)
- {
- attacker.setHealth(attacker.getHealth() + (event.getDamage() / 4));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement