Prechádzať zdrojové kódy

Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows

nossr50 5 rokov pred
rodič
commit
2020fdd4ea

+ 3 - 0
Changelog.txt

@@ -48,6 +48,9 @@ Version 2.2.000
 
     Notes:
     These are the first new skills that I've written for mcMMO in about 9 years, I'll be listening closely to feedback and tweaking them often.
+Version 2.1.137
+    Added some code to avoid NPE errors when checking armor on entities
+
 Version 2.1.136
     Furnace ownership is no longer lost when the furnace stops doing a job
     Furnaces remember owners between restarts (requires MC 1.14 or higher)

+ 4 - 1
src/main/java/com/gmail/nossr50/skills/axes/Axes.java

@@ -23,10 +23,13 @@ public class Axes {
     public static double skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier();
 
     protected static boolean hasArmor(LivingEntity target) {
-        if(target.getEquipment() == null)
+        if(target == null || !target.isValid() || target.getEquipment() == null)
             return false;
 
         for (ItemStack itemStack : target.getEquipment().getArmorContents()) {
+            if(itemStack == null)
+                continue;
+
             if (ItemUtils.isArmor(itemStack)) {
                 return true;
             }

+ 6 - 0
src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java

@@ -92,6 +92,12 @@ public class SmeltingTracker {
         if(!Permissions.skillEnabled(player, PrimarySkillType.SMELTING))
             return;
 
+        //Don't swap ownership if its the same player
+        if(getFurnaceOwner(furnace) != null) {
+            if(getFurnaceOwner(furnace).getUniqueId().equals(player.getUniqueId()))
+                return;
+        }
+
         changeFurnaceOwnership(furnace, player);
     }
 }