Advertisement
aopanddie

Untitled

Jan 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. public void reflectiveBlock(EntityDamageByEntityEvent e) {
  2. try {
  3. if (e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
  4. final Player victim = (Player)e.getEntity();
  5. final Player attacker = (Player)e.getDamager();
  6. final FPlayer attackerf = FPlayers.getInstance().getByPlayer(attacker);
  7. final FPlayer victimf = FPlayers.getInstance().getByPlayer(victim);
  8. if (attackerf.getRelationTo((RelationParticipator)victimf) != Relation.ALLY && attackerf.getRelationTo((RelationParticipator)victimf) != Relation.MEMBER) {
  9. if (this.wepLore(victim, "&4Reflective Block III") && ThreadLocalRandom.current().nextInt(101) <= 1) {
  10. if (victim.isBlocking() && ThreadLocalRandom.current().nextInt(101) <= 5) {
  11. victim.sendMessage(Translate("&c&l* REFLECTIVE BLOCK [&7Blocking: Hit Cancelled&c&l] *"));
  12. e.setCancelled(true);
  13. }
  14. RB.add(attacker);
  15. Double damage = e.getFinalDamage();
  16. attacker.damage(damage);
  17. attacker.sendMessage(Translate("&c&l* " + victim.getName() + " REFLECTIVE BLOCK [&7" + Math.round(damage) + "&c&l] *"));
  18. new BukkitRunnable() {
  19. public void run() {
  20. RB.remove(attacker);
  21. }
  22. }.runTaskLater((Plugin)this.main, 1L);
  23.  
  24. }
  25. else if (this.wepLore(victim, "&4Reflective Block II") && ThreadLocalRandom.current().nextInt(101) <= 1) {
  26. if (victim.isBlocking() && ThreadLocalRandom.current().nextInt(101) <= 5) {
  27. victim.sendMessage(Translate("&c&l* REFLECTIVE BLOCK [&7Blocking: Hit Cancelled&c&l] *"));
  28. e.setCancelled(true);
  29. }
  30. RB.add(attacker);
  31. Double damage1 = e.getFinalDamage();
  32. attacker.damage(damage1);
  33. attacker.sendMessage(Translate("&c&l* " + victim.getName() + " REFLECTIVE BLOCK [&7" + Math.round(damage1) + "&c&l] *"));
  34. new BukkitRunnable() {
  35. public void run() {
  36. RB.remove(attacker);
  37. }
  38. }.runTaskLater((Plugin)this.main, 1L);
  39.  
  40.  
  41. }else if (this.wepLore(victim, "&4Reflective Block I") && ThreadLocalRandom.current().nextInt(101) <= 1) {
  42. if (victim.isBlocking() && ThreadLocalRandom.current().nextInt(101) <= 5 ) {
  43. victim.sendMessage(Translate("&c&l* REFLECTIVE BLOCK [&7Blocking: Hit Cancelled&c&l] *"));
  44. e.setCancelled(true);
  45. }
  46. RB.add(attacker);
  47. Double damage2 = e.getFinalDamage() ;
  48. attacker.damage(damage2);
  49. attacker.sendMessage(Translate("&c&l* " + victim.getName() + " REFLECTIVE BLOCK [&7" + Math.round(damage2) + "&c&l] *"));
  50. new BukkitRunnable() {
  51. public void run() {
  52. RB.remove(attacker);
  53. }
  54. }.runTaskLater((Plugin)this.main, 1L);
  55.  
  56.  
  57. }
  58. }
  59. }
  60. }
  61.  
  62. catch (NullPointerException f) {}
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement