Forráskód Böngészése

Fixed bug where non-player arrows couldn't be deflected.

GJ 12 éve
szülő
commit
b36096e54d

+ 1 - 0
Changelog.txt

@@ -31,6 +31,7 @@ Version 1.4.06-dev
  = Fixed Fishing treasures always having the same enchants
  = Fixed Smelting returning ink sacs instead of Lapis when double-dropping
  = Fixed bug where players could remain in party chat after leaving or being kicked from a party.
+ = Fixed bug where non-player arrows couldn't be deflected.
  ! Changed Berserk to add items to inventory rather than denying pickup
  ! Changed Call of the Wild, newly summoned pet's will have a custom name. (added permission node to disable this)
  ! Changed Chimaera Wing's recipe result to use the ingredient Material

+ 18 - 0
src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java

@@ -284,6 +284,24 @@ public final class CombatUtils {
                     swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
                 }
             }
+
+            if (damager.getType() == EntityType.ARROW) {
+                LivingEntity shooter = ((Arrow) damager).getShooter();
+
+                if (shooter instanceof Player || !SkillType.UNARMED.getPVEEnabled()) {
+                    return;
+                }
+
+                UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
+
+                if (unarmedManager.canDeflect()) {
+                    event.setCancelled(unarmedManager.deflectCheck());
+
+                    if (event.isCancelled()) {
+                        return;
+                    }
+                }
+            }
         }
         else if (attacker instanceof Player) {
             Player player = (Player) attacker;