Advertisement
Guest User

Untitled

a guest
Jan 11th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.66 KB | None | 0 0
  1. @EventHandler
  2.     public void naturesProc(EntityDamageByEntityEvent e) {
  3.         if (e.getEntity() instanceof Player) {
  4.             if (e.getDamager() instanceof Player) {
  5.                 final Player victim = (Player) e.getEntity();
  6.                 //Player attacker = (Player) e.getDamager();
  7.                 int chance = 1; //Percent
  8.                 int soulsPerUse = 75; //Souls
  9.                 if (victim.getInventory().getLeggings() != null) {
  10.                     ItemStack legs = victim.getInventory().getLeggings();
  11.                     if (legs.hasItemMeta()) {
  12.                         if (legs.getItemMeta().hasLore()) {
  13.                             if (legs.getItemMeta().getLore().contains(Translate("&cNatures Wrath IV"))) {
  14.                                 if (!main.nwProc.contains(victim)) {
  15.                                     if (main.canPvp(victim)) {
  16.                                         if (ThreadLocalRandom.current().nextInt(101) <= chance) {
  17.                                             main.nwProc.add(victim);
  18.                                             for (ItemStack rune : victim.getInventory().getContents()) {
  19.                                                 if (rune != null) {
  20.                                                     if (rune.hasItemMeta()) {
  21.                                                         if (rune.getItemMeta().hasLore()) {
  22.                                                             if (rune.getItemMeta().hasDisplayName()) {
  23.                                                                 if (rune.getType() == Material.EMERALD) {
  24.                                                                     if (rune.getItemMeta().getLore().contains(Translate("&c&lUSES"))) {
  25.                                                                         String[] section = ChatColor.stripColor(rune.getItemMeta().getDisplayName()).split("\\[");
  26.                                                                         int gem = Integer.parseInt(section[1].substring(0, (section[1].length() - 1)));
  27.                                                                         if (gem >= soulsPerUse) {
  28.                                                                             int math = gem - soulsPerUse;
  29.                                                                             main.setEnergy(rune, math);
  30.                                                                            
  31.                                                                             victim.sendMessage(" ");
  32.                                                                             victim.sendMessage(Translate("&a&l** NATURE'S WRATH **"));
  33.                                                                             victim.sendMessage(Translate("&c&l- ") + soulsPerUse + Translate(" &c&lEnergy"));
  34.                                                                             victim.sendMessage(Translate("&7You have &7&n" + math + Translate("&r &7souls left.")));
  35.                                                                             victim.sendMessage(" ");
  36.                                                                             victim.updateInventory();
  37.                                                                             victim.playSound(victim.getLocation(), Sound.ORB_PICKUP, 3f, 0.4f);
  38.                                                                             victim.playSound(victim.getLocation(), Sound.EXPLODE, 3f, 0.1f);
  39.                                                                             new BukkitRunnable() {
  40.                                                                                 public void run() {
  41.                                                                                     victim.playSound(victim.getLocation(), Sound.ORB_PICKUP, 3f, 0.6f);
  42.                                                                                 }
  43.                                                                             }.runTaskLater(main, 5L);
  44.                                                                            
  45.                                                                             new BukkitRunnable() {
  46.                                                                                 public void run() {
  47.                                                                                     victim.playSound(victim.getLocation(), Sound.ORB_PICKUP, 3f, 0.7f);
  48.                                                                                 }
  49.                                                                             }.runTaskLater(main, 6L);
  50.                                                                            
  51.                                                                             List<Entity> list = new ArrayList<Entity>();
  52.                                                                            
  53.                                                                             for (Entity p : victim.getNearbyEntities(20, 20, 20)) {
  54.                                                                                 if (p instanceof Player) {
  55.                                                                                     Player plr = (Player) p;
  56.                                                                                     if (main.canPvp(plr)) {
  57.                                                                                         FPlayer fp1 = FPlayers.getInstance().getByPlayer(victim);
  58.                                                                                         FPlayer fp2 = FPlayers.getInstance().getByPlayer(plr);
  59.                                                                                         if (!(fp2.getRelationTo(fp1) == Relation.MEMBER) || !(fp2.getRelationTo(fp1) == Relation.ALLY)) {
  60.                                                                                             plr.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 240, 100));
  61.                                                                                             plr.playSound(plr.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 2f);
  62.                                                                                             //plr.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 240, 100));
  63.                                                                                             plr.setNoDamageTicks(1);
  64.                                                                                             list.add(plr);
  65.                                                                                         }
  66.                                                                                     }
  67.                                                                                 }
  68.                                                                             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement