diff --git a/Changelog.txt b/Changelog.txt index 3e246c26d..931ddd615 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +Version 2.1.97 + Fixed a NPE that could occur if a pet participated in combat and its master's mcMMO data was not available + Version 2.1.96 Added the setting 'Skills.General.LimitBreak.AllowPVE' to advanced.yml to allow Limit Break damage bonus to apply in PVE again, defaults to false Updated Limit Break locale strings diff --git a/pom.xml b/pom.xml index c4f3466af..d4dddacc9 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.96 + 2.1.97-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 1ee0cff4b..b15917943 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -173,25 +173,34 @@ public final class CombatUtils { double initialDamage = event.getDamage(); double finalDamage = initialDamage; - McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master); - TamingManager tamingManager = mcMMOPlayer.getTamingManager(); + if(master != null && !master.isOnline() && master.isValid()) { + McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master); - if (tamingManager.canUseFastFoodService()) { - tamingManager.fastFoodService(wolf, event.getDamage()); + //Make sure the profiles been loaded + if(mcMMOPlayer == null) { + return; + } + + TamingManager tamingManager = mcMMOPlayer.getTamingManager(); + + if (tamingManager.canUseFastFoodService()) { + tamingManager.fastFoodService(wolf, event.getDamage()); + } + + tamingManager.pummel(target, wolf); + + if (tamingManager.canUseSharpenedClaws()) { + finalDamage+=tamingManager.sharpenedClaws(); + } + + if (tamingManager.canUseGore()) { + finalDamage+=tamingManager.gore(target, initialDamage); + } + + applyScaledModifiers(initialDamage, finalDamage, event); + startGainXp(mcMMOPlayer, target, PrimarySkillType.TAMING); } - tamingManager.pummel(target, wolf); - - if (tamingManager.canUseSharpenedClaws()) { - finalDamage+=tamingManager.sharpenedClaws(); - } - - if (tamingManager.canUseGore()) { - finalDamage+=tamingManager.gore(target, initialDamage); - } - - applyScaledModifiers(initialDamage, finalDamage, event); - startGainXp(mcMMOPlayer, target, PrimarySkillType.TAMING); } private static void processArcheryCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Arrow arrow) {