瀏覽代碼

Fixed custom tools not handling the Ability_Enabled flag properly.

GJ 13 年之前
父節點
當前提交
189f23f407

+ 2 - 1
Changelog.txt

@@ -17,7 +17,8 @@ Version 1.3.10-dev
  = Fixed players never being removed from memory (memory leak)
  = Fixed players never being removed from memory (memory leak)
  = Fixed admin chat being seen by everyone
  = Fixed admin chat being seen by everyone
  = Fixed issue with UTFDataFormatException occurring on occasion when trying to load Chunklets
  = Fixed issue with UTFDataFormatException occurring on occasion when trying to load Chunklets
- = Fixed ArrayIndexOutOfBounds error caused when trying to use /xplock after logging in but before gaining XP
+ = Fixed ArrayIndexOutOfBounds error caused when trying to use /xplock after logging in but before gaining XP
+ = Fixed custom tools not properly respecting the Ability_Enabled flag.
 
 
 Version 1.3.09
 Version 1.3.09
  + Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)
  + Added compatibility with AntiCheat (Which I highly recommend to prevent cheating)

+ 8 - 42
src/main/java/com/gmail/nossr50/listeners/BlockListener.java

@@ -207,14 +207,7 @@ public class BlockListener implements Listener {
             }
             }
 
 
             if (PP.getAbilityMode(AbilityType.TREE_FELLER) && permInstance.treeFeller(player) && ItemChecks.isAxe(inHand)) {
             if (PP.getAbilityMode(AbilityType.TREE_FELLER) && permInstance.treeFeller(player) && ItemChecks.isAxe(inHand)) {
-                if (ModChecks.isCustomTool(inHand)) {
-                    if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
-                        WoodCutting.treeFeller(event);
-                    }
-                }
-                else {
-                    WoodCutting.treeFeller(event);
-                }
+                WoodCutting.treeFeller(event);
             }
             }
         }
         }
 
 
@@ -309,29 +302,12 @@ public class BlockListener implements Listener {
          * ABILITY TRIGGER CHECKS
          * ABILITY TRIGGER CHECKS
          */
          */
         if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && permInstance.greenTerra(player) && BlockChecks.makeMossy(block)) {
         if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && permInstance.greenTerra(player) && BlockChecks.makeMossy(block)) {
-            if (ModChecks.isCustomTool(inHand)) {
-                if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
-                    Herbalism.greenTerra(player, block);
-                }
-            }
-            else {
-                Herbalism.greenTerra(player, block);
-            }
+            Herbalism.greenTerra(player, block);
         }
         }
         else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
         else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
-            if (configInstance.getExcavationRequiresTool()) {
-                if (ItemChecks.isShovel(inHand)) {
-                    if (ModChecks.isCustomTool(inHand)) {
-                        if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
-                            event.setInstaBreak(true);
-                            Excavation.gigaDrillBreaker(player, block);
-                        }
-                    }
-                    else {
-                        event.setInstaBreak(true);
-                        Excavation.gigaDrillBreaker(player, block);
-                    }
-                }
+            if (configInstance.getExcavationRequiresTool() && ItemChecks.isShovel(inHand)) {
+                event.setInstaBreak(true);
+                Excavation.gigaDrillBreaker(player, block);
             }
             }
             else {
             else {
                 event.setInstaBreak(true);
                 event.setInstaBreak(true);
@@ -351,19 +327,9 @@ public class BlockListener implements Listener {
             }
             }
         }
         }
         else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
         else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
-            if (configInstance.getMiningRequiresTool()) {
-                if (ItemChecks.isPickaxe(inHand)) {
-                    if (ModChecks.isCustomTool(inHand)) {
-                        if (ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
-                            event.setInstaBreak(true);
-                            Mining.superBreakerBlockCheck(player, block);
-                        }
-                    }
-                    else {
-                        event.setInstaBreak(true);
-                        Mining.superBreakerBlockCheck(player, block);
-                    }
-                }
+            if (configInstance.getMiningRequiresTool() && ItemChecks.isPickaxe(inHand)) {
+                event.setInstaBreak(true);
+                Mining.superBreakerBlockCheck(player, block);
             }
             }
             else {
             else {
                 event.setInstaBreak(true);
                 event.setInstaBreak(true);

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

@@ -323,12 +323,6 @@ public class Combat {
      * @param type The type of skill being used
      * @param type The type of skill being used
      */
      */
     public static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) {
     public static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, SkillType type) {
-        ItemStack inHand = attacker.getItemInHand();
-
-        if (ModChecks.isCustomTool(inHand) && !ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
-            return;
-        }
-
         int numberOfTargets = Misc.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
         int numberOfTargets = Misc.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
         int damageAmount = damage;
         int damageAmount = damage;
 
 

+ 4 - 0
src/main/java/com/gmail/nossr50/util/Skills.java

@@ -101,6 +101,10 @@ public class Skills {
         ToolType tool = skill.getTool();
         ToolType tool = skill.getTool();
         ItemStack inHand = player.getItemInHand();
         ItemStack inHand = player.getItemInHand();
 
 
+        if (ModChecks.isCustomTool(inHand) && !ModChecks.getToolFromItemStack(inHand).isAbilityEnabled()) {
+            return;
+        }
+
         /* Check if any abilities are active */
         /* Check if any abilities are active */
         if (!PP.getAbilityUse()) {
         if (!PP.getAbilityUse()) {
             return;
             return;