Ver código fonte

Custom blocks should now work right with Super Breaker.

GJ 13 anos atrás
pai
commit
efcc15d89d

+ 47 - 31
src/main/java/com/gmail/nossr50/skills/gathering/Mining.java

@@ -250,37 +250,7 @@ public class Mining {
         int durabilityLoss = Config.getInstance().getAbilityToolDamage();
         FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
 
-        switch (type) {
-        case OBSIDIAN:
-            if (tier < 4) {
-                return;
-            }
-            durabilityLoss = durabilityLoss * 5; //Obsidian needs to do more damage than normal
-            /* FALL THROUGH */
-
-        case DIAMOND_ORE:
-        case GLOWING_REDSTONE_ORE:
-        case GOLD_ORE:
-        case LAPIS_ORE:
-        case REDSTONE_ORE:
-            if (tier < 3) {
-                return;
-            }
-            /* FALL THROUGH */
-
-        case IRON_ORE:
-            if (tier < 2) {
-                return;
-            }
-            /* FALL THROUGH */
-
-        case COAL_ORE:
-        case ENDER_STONE:
-        case GLOWSTONE:
-        case MOSSY_COBBLESTONE:
-        case NETHERRACK:
-        case SANDSTONE:
-        case STONE:
+        if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
             if (mcMMO.placeStore.isTrue(block)) {
                 return;
             }
@@ -294,5 +264,51 @@ public class Mining {
                 SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
             }
         }
+        else {
+            switch (type) {
+            case OBSIDIAN:
+                if (tier < 4) {
+                    return;
+                }
+                durabilityLoss = durabilityLoss * 5; //Obsidian needs to do more damage than normal
+                /* FALL THROUGH */
+
+            case DIAMOND_ORE:
+            case GLOWING_REDSTONE_ORE:
+            case GOLD_ORE:
+            case LAPIS_ORE:
+            case REDSTONE_ORE:
+                if (tier < 3) {
+                    return;
+                }
+                /* FALL THROUGH */
+
+            case IRON_ORE:
+                if (tier < 2) {
+                    return;
+                }
+                /* FALL THROUGH */
+
+            case COAL_ORE:
+            case ENDER_STONE:
+            case GLOWSTONE:
+            case MOSSY_COBBLESTONE:
+            case NETHERRACK:
+            case SANDSTONE:
+            case STONE:
+                if (mcMMO.placeStore.isTrue(block)) {
+                    return;
+                }
+
+                mcMMO.p.getServer().getPluginManager().callEvent(armswing);
+                Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
+
+                miningBlockCheck(player, block);
+
+                if (Config.getInstance().spoutEnabled) {
+                    SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
+                }
+            }
+        }
     }
 }