diff --git a/Changelog.txt b/Changelog.txt index 5e098a85f..976e63a4a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +Version 2.2.032 + Blast Mining no longer drops infested block variants + Version 2.2.031 Fixed potential NPE when player or blockstate is null for Inventory events on Furnaces Fixed bug where en_us locale was being set system-wide (thanks BlvckBytes) diff --git a/pom.xml b/pom.xml index bf929175e..6f5e9900b 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.2.031 + 2.2.032-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index 9baea5de6..f55c94376 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -28,10 +28,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; +import java.util.*; import static com.gmail.nossr50.util.ItemUtils.isPickaxe; @@ -39,6 +36,9 @@ public class MiningManager extends SkillManager { public static final String BUDDING_AMETHYST = "budding_amethyst"; public static final Collection BLAST_MINING_BLACKLIST = Set.of(Material.SPAWNER); + private final static Set INFESTED_BLOCKS = Set.of("infested_stone", "infested_cobblestone", + "infested_stone_bricks", "infested_cracked_stone_bricks", "infested_mossy_stone_bricks", + "infested_chiseled_stone_bricks", "infested_deepslate"); public MiningManager(@NotNull McMMOPlayer mcMMOPlayer) { super(mcMMOPlayer, PrimarySkillType.MINING); @@ -164,9 +164,7 @@ public class MiningManager extends SkillManager { tnt.setMetadata(MetadataConstants.METADATA_KEY_TRACKED_TNT, mmoPlayer.getPlayerMetadata()); tnt.setFuseTicks(0); - if (mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 16, 4)) { - tnt.setSource(player); - } + tnt.setSource(player); targetBlock.setType(Material.AIR); mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis()); @@ -174,6 +172,10 @@ public class MiningManager extends SkillManager { mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR); } + private boolean isInfestedBlock(String material) { + return INFESTED_BLOCKS.contains(material.toLowerCase(Locale.ENGLISH)); + } + /** * Handler for explosion drops and XP gain. * @@ -255,13 +257,14 @@ public class MiningManager extends SkillManager { /** * Checks if it would be illegal (in vanilla) to obtain the block - * Certain things should never drop ( such as budding_amethyst ) + * Certain things should never drop (such as budding_amethyst and infested blocks) * * @param material target material - * @return true if it's not legal to obtain the block through normal gameplay + * @return true if it's not legal to get the block through normal gameplay */ public boolean isDropIllegal(@NotNull Material material) { - return material.getKey().getKey().equalsIgnoreCase(BUDDING_AMETHYST); + return isInfestedBlock(material.getKey().getKey()) + || material.getKey().getKey().equalsIgnoreCase(BUDDING_AMETHYST); } /**