Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void naturesProc(EntityDamageByEntityEvent e) {
- if (e.getEntity() instanceof Player) {
- if (e.getDamager() instanceof Player) {
- final Player victim = (Player) e.getEntity();
- //Player attacker = (Player) e.getDamager();
- int chance = 1; //Percent
- int soulsPerUse = 75; //Souls
- if (victim.getInventory().getLeggings() != null) {
- ItemStack legs = victim.getInventory().getLeggings();
- if (legs.hasItemMeta()) {
- if (legs.getItemMeta().hasLore()) {
- if (legs.getItemMeta().getLore().contains(Translate("&cNatures Wrath IV"))) {
- if (!main.nwProc.contains(victim)) {
- if (main.canPvp(victim)) {
- if (ThreadLocalRandom.current().nextInt(101) <= chance) {
- main.nwProc.add(victim);
- for (ItemStack rune : victim.getInventory().getContents()) {
- if (rune != null) {
- if (rune.hasItemMeta()) {
- if (rune.getItemMeta().hasLore()) {
- if (rune.getItemMeta().hasDisplayName()) {
- if (rune.getType() == Material.EMERALD) {
- if (rune.getItemMeta().getLore().contains(Translate("&c&lUSES"))) {
- String[] section = ChatColor.stripColor(rune.getItemMeta().getDisplayName()).split("\\[");
- int gem = Integer.parseInt(section[1].substring(0, (section[1].length() - 1)));
- if (gem >= soulsPerUse) {
- int math = gem - soulsPerUse;
- main.setEnergy(rune, math);
- victim.sendMessage(" ");
- victim.sendMessage(Translate("&a&l** NATURE'S WRATH **"));
- victim.sendMessage(Translate("&c&l- ") + soulsPerUse + Translate(" &c&lEnergy"));
- victim.sendMessage(Translate("&7You have &7&n" + math + Translate("&r &7souls left.")));
- victim.sendMessage(" ");
- victim.updateInventory();
- victim.playSound(victim.getLocation(), Sound.ORB_PICKUP, 3f, 0.4f);
- victim.playSound(victim.getLocation(), Sound.EXPLODE, 3f, 0.1f);
- new BukkitRunnable() {
- public void run() {
- victim.playSound(victim.getLocation(), Sound.ORB_PICKUP, 3f, 0.6f);
- }
- }.runTaskLater(main, 5L);
- new BukkitRunnable() {
- public void run() {
- victim.playSound(victim.getLocation(), Sound.ORB_PICKUP, 3f, 0.7f);
- }
- }.runTaskLater(main, 6L);
- List<Entity> list = new ArrayList<Entity>();
- for (Entity p : victim.getNearbyEntities(20, 20, 20)) {
- if (p instanceof Player) {
- Player plr = (Player) p;
- if (main.canPvp(plr)) {
- FPlayer fp1 = FPlayers.getInstance().getByPlayer(victim);
- FPlayer fp2 = FPlayers.getInstance().getByPlayer(plr);
- if (!(fp2.getRelationTo(fp1) == Relation.MEMBER) || !(fp2.getRelationTo(fp1) == Relation.ALLY)) {
- plr.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 240, 100));
- plr.playSound(plr.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 2f);
- //plr.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 240, 100));
- plr.setNoDamageTicks(1);
- list.add(plr);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement