Advertisement
Antigrate

Untitled

May 15th, 2014
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.72 KB | None | 0 0
  1. package com.icloud.justin.vitale.classes.warrior;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Material;
  5. import org.bukkit.Sound;
  6. import org.bukkit.entity.Entity;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.block.Action;
  11. import org.bukkit.event.entity.EntityDamageByEntityEvent;
  12. import org.bukkit.event.player.PlayerInteractEvent;
  13. import org.bukkit.util.Vector;
  14.  
  15. public class WarriorDesecratingStrike implements Listener
  16. {
  17.  
  18.     @EventHandler
  19.     public void onPlayerInteract (PlayerInteractEvent e)
  20.     {
  21.         Player p = e.getPlayer();
  22.  
  23.         if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) || e.getAction().equals(Action.RIGHT_CLICK_AIR))
  24.         {
  25.             if (p.getInventory().getHelmet().getType() == Material.IRON_HELMET
  26.                     && p.getInventory().getChestplate().getType() == Material.IRON_CHESTPLATE
  27.                     && p.getInventory().getLeggings().getType() == Material.IRON_LEGGINGS
  28.                     && p.getInventory().getBoots().getType() == Material.IRON_BOOTS)
  29.             {
  30.                 if (p.getItemInHand().getType() == Material.DIAMOND_AXE)
  31.                 {
  32.                     p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "WARRIOR: " + ChatColor.YELLOW + ChatColor.BOLD + "Your next attack will knock the target into the air!");
  33.                 }
  34.             }
  35.         }
  36.     }
  37.  
  38.     @EventHandler
  39.     public void onPlayerHit (EntityDamageByEntityEvent e)
  40.     {
  41.         Player damagee = (Player) e.getEntity();
  42.         Player damager = (Player) e.getDamager();
  43.  
  44.         if (damager instanceof Player && damagee instanceof Entity)
  45.         {
  46.             damager.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "You hit " + ChatColor.BLUE + ChatColor.BOLD + damagee.getName() + ChatColor.YELLOW + ChatColor.BOLD + " with " + ChatColor.RED + ChatColor.BOLD + "Desecrating Strike" + ChatColor.YELLOW + ChatColor.BOLD + "!");
  47.             damager.playSound(damagee.getLocation(), Sound.IRONGOLEM_HIT, 1, 0);
  48.             damagee.setVelocity(new Vector(0, 1.6, 0));
  49.         }
  50.         else if (damager instanceof Player && damagee instanceof Player)
  51.         {
  52.             damagee.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "You were hit by " + ChatColor.BLUE + ChatColor.BOLD + damager.getName() + ChatColor.YELLOW + ChatColor.BOLD + " with " + ChatColor.RED + ChatColor.BOLD + "Desecrating Strike" + ChatColor.YELLOW + ChatColor.BOLD + "!");
  53.             damager.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "You hit " + ChatColor.BLUE + ChatColor.BOLD + damagee.getName() + ChatColor.YELLOW + ChatColor.BOLD + " with " + ChatColor.RED + ChatColor.BOLD + "Desecrating Strike" + ChatColor.YELLOW + ChatColor.BOLD + "!");
  54.             damagee.playSound(damagee.getLocation(), Sound.IRONGOLEM_HIT, 1, 0);
  55.             damager.playSound(damagee.getLocation(), Sound.IRONGOLEM_HIT, 1, 0);
  56.             damagee.setVelocity(new Vector(0, 1.6, 0));
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement