Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void reflectiveBlock(EntityDamageByEntityEvent e) {
- try {
- if (e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
- final Player victim = (Player)e.getEntity();
- final Player attacker = (Player)e.getDamager();
- final FPlayer attackerf = FPlayers.getInstance().getByPlayer(attacker);
- final FPlayer victimf = FPlayers.getInstance().getByPlayer(victim);
- if (attackerf.getRelationTo((RelationParticipator)victimf) != Relation.ALLY && attackerf.getRelationTo((RelationParticipator)victimf) != Relation.MEMBER) {
- if (this.wepLore(victim, "&4Reflective Block III") && ThreadLocalRandom.current().nextInt(101) <= 1) {
- if (victim.isBlocking() && ThreadLocalRandom.current().nextInt(101) <= 5) {
- victim.sendMessage(Translate("&c&l* REFLECTIVE BLOCK [&7Blocking: Hit Cancelled&c&l] *"));
- e.setCancelled(true);
- }
- RB.add(attacker);
- Double damage = e.getFinalDamage();
- attacker.damage(damage);
- attacker.sendMessage(Translate("&c&l* " + victim.getName() + " REFLECTIVE BLOCK [&7" + Math.round(damage) + "&c&l] *"));
- new BukkitRunnable() {
- public void run() {
- RB.remove(attacker);
- }
- }.runTaskLater((Plugin)this.main, 1L);
- }
- else if (this.wepLore(victim, "&4Reflective Block II") && ThreadLocalRandom.current().nextInt(101) <= 1) {
- if (victim.isBlocking() && ThreadLocalRandom.current().nextInt(101) <= 5) {
- victim.sendMessage(Translate("&c&l* REFLECTIVE BLOCK [&7Blocking: Hit Cancelled&c&l] *"));
- e.setCancelled(true);
- }
- RB.add(attacker);
- Double damage1 = e.getFinalDamage();
- attacker.damage(damage1);
- attacker.sendMessage(Translate("&c&l* " + victim.getName() + " REFLECTIVE BLOCK [&7" + Math.round(damage1) + "&c&l] *"));
- new BukkitRunnable() {
- public void run() {
- RB.remove(attacker);
- }
- }.runTaskLater((Plugin)this.main, 1L);
- }else if (this.wepLore(victim, "&4Reflective Block I") && ThreadLocalRandom.current().nextInt(101) <= 1) {
- if (victim.isBlocking() && ThreadLocalRandom.current().nextInt(101) <= 5 ) {
- victim.sendMessage(Translate("&c&l* REFLECTIVE BLOCK [&7Blocking: Hit Cancelled&c&l] *"));
- e.setCancelled(true);
- }
- RB.add(attacker);
- Double damage2 = e.getFinalDamage() ;
- attacker.damage(damage2);
- attacker.sendMessage(Translate("&c&l* " + victim.getName() + " REFLECTIVE BLOCK [&7" + Math.round(damage2) + "&c&l] *"));
- new BukkitRunnable() {
- public void run() {
- RB.remove(attacker);
- }
- }.runTaskLater((Plugin)this.main, 1L);
- }
- }
- }
- }
- catch (NullPointerException f) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement