From c3eaec513ba46c8ce15129cfbfdb4d4a0b1d913c Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 27 Feb 2013 15:45:15 -0500 Subject: [PATCH] GIANT Blast Mining update. Lots of new config options in advanced.yml --- .../gmail/nossr50/config/AdvancedConfig.java | 45 +++ .../nossr50/listeners/BlockListener.java | 7 +- .../nossr50/listeners/EntityListener.java | 21 +- .../nossr50/listeners/PlayerListener.java | 14 +- .../mining/BiggerBombsEventHandler.java | 42 --- .../nossr50/skills/mining/BlastMining.java | 115 +++++-- .../mining/BlastMiningDropEventHandler.java | 149 --------- .../gmail/nossr50/skills/mining/Mining.java | 31 +- .../nossr50/skills/mining/MiningCommand.java | 76 ++--- .../nossr50/skills/mining/MiningManager.java | 284 +++++++++++++++--- .../mining/RemoteDetonationEventHandler.java | 89 ------ src/main/resources/advanced.yml | 50 +++ .../resources/locale/locale_en_US.properties | 9 +- 13 files changed, 474 insertions(+), 458 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/skills/mining/BiggerBombsEventHandler.java delete mode 100644 src/main/java/com/gmail/nossr50/skills/mining/BlastMiningDropEventHandler.java delete mode 100644 src/main/java/com/gmail/nossr50/skills/mining/RemoteDetonationEventHandler.java diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index f6d0f130b..d1c3cdec4 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -128,6 +128,51 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public int getBlastMiningRank7() { return config.getInt("Skills.Mining.BlastMining_Rank7", 875); } public int getBlastMiningRank8() { return config.getInt("Skills.Mining.BlastMining_Rank8", 1000); } + public double getBlastDamageDecreaseRank1() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank1", 0.0D); } + public double getBlastDamageDecreaseRank2() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank2", 0.0D); } + public double getBlastDamageDecreaseRank3() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank3", 0.0D); } + public double getBlastDamageDecreaseRank4() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank4", 25.0D); } + public double getBlastDamageDecreaseRank5() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank5", 25.0D); } + public double getBlastDamageDecreaseRank6() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank6", 50.0D); } + public double getBlastDamageDecreaseRank7() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank7", 50.0D); } + public double getBlastDamageDecreaseRank8() { return config.getDouble("Skills.Mining.BlastDamageDecrease_Rank8", 100.0D); } + + public double getOreBonusRank1() { return config.getDouble("Skills.Mining.OreBonus_Rank1", 35.0D); } + public double getOreBonusRank2() { return config.getDouble("Skills.Mining.OreBonus_Rank2", 40.0D); } + public double getOreBonusRank3() { return config.getDouble("Skills.Mining.OreBonus_Rank3", 45.0D); } + public double getOreBonusRank4() { return config.getDouble("Skills.Mining.OreBonus_Rank4", 50.0D); } + public double getOreBonusRank5() { return config.getDouble("Skills.Mining.OreBonus_Rank5", 55.0D); } + public double getOreBonusRank6() { return config.getDouble("Skills.Mining.OreBonus_Rank6", 60.0D); } + public double getOreBonusRank7() { return config.getDouble("Skills.Mining.OreBonus_Rank7", 65.0D); } + public double getOreBonusRank8() { return config.getDouble("Skills.Mining.OreBonus_Rank8", 70.0D); } + + public double getDebrisReductionRank1() { return config.getDouble("Skills.Mining.DebrisReduction_Rank1", 10.0D); } + public double getDebrisReductionRank2() { return config.getDouble("Skills.Mining.DebrisReduction_Rank2", 20.0D); } + public double getDebrisReductionRank3() { return config.getDouble("Skills.Mining.DebrisReduction_Rank3", 30.0D); } + public double getDebrisReductionRank4() { return config.getDouble("Skills.Mining.DebrisReduction_Rank4", 30.0D); } + public double getDebrisReductionRank5() { return config.getDouble("Skills.Mining.DebrisReduction_Rank5", 30.0D); } + public double getDebrisReductionRank6() { return config.getDouble("Skills.Mining.DebrisReduction_Rank6", 30.0D); } + public double getDebrisReductionRank7() { return config.getDouble("Skills.Mining.DebrisReduction_Rank7", 30.0D); } + public double getDebrisReductionRank8() { return config.getDouble("Skills.Mining.DebrisReduction_Rank8", 30.0D); } + + public int getDropMultiplierRank1() { return config.getInt("Skills.Mining.DropMultiplier_Rank1", 1); } + public int getDropMultiplierRank2() { return config.getInt("Skills.Mining.DropMultiplier_Rank2", 1); } + public int getDropMultiplierRank3() { return config.getInt("Skills.Mining.DropMultiplier_Rank3", 1); } + public int getDropMultiplierRank4() { return config.getInt("Skills.Mining.DropMultiplier_Rank4", 1); } + public int getDropMultiplierRank5() { return config.getInt("Skills.Mining.DropMultiplier_Rank5", 2); } + public int getDropMultiplierRank6() { return config.getInt("Skills.Mining.DropMultiplier_Rank6", 2); } + public int getDropMultiplierRank7() { return config.getInt("Skills.Mining.DropMultiplier_Rank7", 3); } + public int getDropMultiplierRank8() { return config.getInt("Skills.Mining.DropMultiplier_Rank8", 3); } + + public double getBlastRadiusModifierRank1() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank1", 1.0); } + public double getBlastRadiusModifierRank2() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank2", 1.0); } + public double getBlastRadiusModifierRank3() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank3", 2.0); } + public double getBlastRadiusModifierRank4() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank4", 2.0); } + public double getBlastRadiusModifierRank5() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank5", 3.0); } + public double getBlastRadiusModifierRank6() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank6", 3.0); } + public double getBlastRadiusModifierRank7() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank7", 4.0); } + public double getBlastRadiusModifierRank8() { return config.getDouble("Skills.Mining.BlastRadiusModifier_Rank8", 4.0); } + /* REPAIR */ public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery_MaxBonusPercentage", 200.0D); } public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusLevel", 1000); } diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 6627c8e64..a95f1fcde 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -32,7 +32,7 @@ import com.gmail.nossr50.runnables.StickyPistonTracker; import com.gmail.nossr50.skills.SkillManagerStore; import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.herbalism.HerbalismManager; -import com.gmail.nossr50.skills.mining.Mining; +import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.smelting.Smelting; @@ -179,10 +179,11 @@ public class BlockListener implements Listener { /* MINING */ else if (BlockChecks.affectedBySuperBreaker(blockState) && ItemChecks.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.placeStore.isTrue(blockState)) { - Mining.miningBlockCheck(blockState, player); + MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(player.getName()); + miningManager.miningBlockCheck(blockState); if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) { - Mining.miningBlockCheck(blockState, player); + miningManager.miningBlockCheck(blockState); } } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 8418961e1..02d35ea20 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -36,7 +36,7 @@ import com.gmail.nossr50.skills.SkillManagerStore; import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.fishing.Fishing; import com.gmail.nossr50.skills.herbalism.Herbalism; -import com.gmail.nossr50.skills.mining.BlastMining; +import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.runnables.BleedTimer; import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.utilities.CombatTools; @@ -189,8 +189,10 @@ public class EntityListener implements Listener { break; case BLOCK_EXPLOSION: - if (Permissions.demolitionsExpertise(player)) { - event.setDamage(BlastMining.processDemolitionsExpertise(player, event.getDamage())); + MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(player.getName()); + + if (miningManager.canUseDemolitionsExpertise()) { + event.setDamage(miningManager.processDemolitionsExpertise(event.getDamage())); if (event.getDamage() == 0) { event.setCancelled(true); @@ -323,10 +325,10 @@ public class EntityListener implements Listener { int id = entity.getEntityId(); if (plugin.tntIsTracked(id)) { - Player player = plugin.getTNTPlayer(id); + MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(plugin.getTNTPlayer(id).getName()); - if (Permissions.biggerBombs(player)) { - SkillManagerStore.getInstance().getMiningManager(player.getName()).biggerBombs(event); + if (miningManager.canUseBiggerBombs()) { + event.setRadius(miningManager.biggerBombs(event.getRadius())); } } } @@ -345,9 +347,12 @@ public class EntityListener implements Listener { int id = entity.getEntityId(); if (plugin.tntIsTracked(id)) { - Player player = plugin.getTNTPlayer(id); + MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(plugin.getTNTPlayer(id).getName()); - SkillManagerStore.getInstance().getMiningManager(player.getName()).blastMiningDropProcessing(event); + if (miningManager.canUseBlastMining()) { + miningManager.blastMiningDropProcessing(event.getYield(), event.blockList()); + event.setYield(0); + } plugin.removeFromTNTTracker(id); } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 1bd7ed624..757177950 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -36,7 +36,6 @@ import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.skills.SkillManagerStore; import com.gmail.nossr50.skills.fishing.FishingManager; import com.gmail.nossr50.skills.herbalism.HerbalismManager; -import com.gmail.nossr50.skills.mining.BlastMining; import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.runnables.BleedTimer; @@ -296,16 +295,21 @@ public class PlayerListener implements Listener { player.updateInventory(); } /* BLAST MINING CHECK */ - else if (player.isSneaking() && Permissions.remoteDetonation(player) && heldItem.getTypeId() == BlastMining.detonatorID) { - SkillManagerStore.getInstance().getMiningManager(player.getName()).detonate(event); + else if (SkillManagerStore.getInstance().getMiningManager(player.getName()).canDetonate()) { + if (blockID == Material.TNT.getId()) { + event.setCancelled(true); // Don't detonate the TNT if they're too close + } + else { + SkillManagerStore.getInstance().getMiningManager(player.getName()).remoteDetonation(); + } } break; case RIGHT_CLICK_AIR: /* BLAST MINING CHECK */ - if (player.isSneaking() && Permissions.remoteDetonation(player) && heldItem.getTypeId() == BlastMining.detonatorID) { - SkillManagerStore.getInstance().getMiningManager(player.getName()).detonate(event); + if (SkillManagerStore.getInstance().getMiningManager(player.getName()).canDetonate()) { + SkillManagerStore.getInstance().getMiningManager(player.getName()).remoteDetonation(); } break; diff --git a/src/main/java/com/gmail/nossr50/skills/mining/BiggerBombsEventHandler.java b/src/main/java/com/gmail/nossr50/skills/mining/BiggerBombsEventHandler.java deleted file mode 100644 index d7575cb95..000000000 --- a/src/main/java/com/gmail/nossr50/skills/mining/BiggerBombsEventHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gmail.nossr50.skills.mining; - -import org.bukkit.event.entity.ExplosionPrimeEvent; - -public class BiggerBombsEventHandler { - private int skillLevel; - - private ExplosionPrimeEvent event; - private float radius; - private float radiusModifier; - - protected BiggerBombsEventHandler(MiningManager manager, ExplosionPrimeEvent event) { - this.skillLevel = manager.getSkillLevel(); - - this.event = event; - this.radius = event.getRadius(); - } - - protected void calculateRadiusIncrease() { - if (skillLevel < BlastMining.rank2) { - return; - } - - if (skillLevel >= BlastMining.rank8) { - radiusModifier = 4.0f; - } - else if (skillLevel >= BlastMining.rank6) { - radiusModifier = 3.0f; - } - else if (skillLevel >= BlastMining.rank4) { - radiusModifier = 2.0f; - } - else if (skillLevel >= BlastMining.rank2) { - radiusModifier = 1.0f; - } - } - - protected void modifyBlastRadius() { - radius = radius + radiusModifier; - event.setRadius(radius); - } -} diff --git a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java index 0d31b3acd..0152b0909 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java @@ -1,46 +1,103 @@ package com.gmail.nossr50.skills.mining; -import org.bukkit.entity.Player; +import java.util.HashSet; + +import org.bukkit.Material; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; -import com.gmail.nossr50.skills.utilities.SkillTools; -import com.gmail.nossr50.skills.utilities.SkillType; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.Users; public class BlastMining { - public static int rank1 = AdvancedConfig.getInstance().getBlastMiningRank1(); - public static int rank2 = AdvancedConfig.getInstance().getBlastMiningRank2(); - public static int rank3 = AdvancedConfig.getInstance().getBlastMiningRank3(); - public static int rank4 = AdvancedConfig.getInstance().getBlastMiningRank4(); - public static int rank5 = AdvancedConfig.getInstance().getBlastMiningRank5(); - public static int rank6 = AdvancedConfig.getInstance().getBlastMiningRank6(); - public static int rank7 = AdvancedConfig.getInstance().getBlastMiningRank7(); - public static int rank8 = AdvancedConfig.getInstance().getBlastMiningRank8(); + // The order of the values is extremely important, a few methods depend on it to work properly + protected enum Tier { + EIGHT(8) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank8();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank8();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank8();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank8();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank8();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank8();}}, + SEVEN(7) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank7();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank7();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank7();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank7();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank7();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank7();}}, + SIX(6) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank6();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank6();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank6();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank6();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank6();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank6();}}, + FIVE(5) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank5();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank5();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank5();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank5();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank5();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank5();}}, + FOUR(4) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank4();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank4();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank4();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank4();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank4();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank4();}}, + THREE(3) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank3();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank3();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank3();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank3();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank3();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank3();}}, + TWO(2) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank2();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank2();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank2();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank2();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank2();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank2();}}, + ONE(1) { + @Override public int getLevel() {return AdvancedConfig.getInstance().getBlastMiningRank1();} + @Override public double getBlastRadiusModifier() {return AdvancedConfig.getInstance().getBlastRadiusModifierRank1();} + @Override public double getOreBonus() {return AdvancedConfig.getInstance().getOreBonusRank1();} + @Override public double getDebrisReduction() {return AdvancedConfig.getInstance().getDebrisReductionRank1();} + @Override public double getBlastDamageDecrease() {return AdvancedConfig.getInstance().getBlastDamageDecreaseRank1();} + @Override public int getDropMultiplier() {return AdvancedConfig.getInstance().getDropMultiplierRank1();}}; + + int numerical; + + private Tier(int numerical) { + this.numerical = numerical; + } + + public int toNumerical() { + return numerical; + } + + abstract protected int getLevel(); + abstract protected double getBlastRadiusModifier(); + abstract protected double getOreBonus(); + abstract protected double getDebrisReduction(); + abstract protected double getBlastDamageDecrease(); + abstract protected int getDropMultiplier(); + } public static int detonatorID = Config.getInstance().getDetonatorItemID(); public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100; - public static boolean canUseDemolitionsExpertise(Player player) { - return SkillTools.unlockLevelReached(player, SkillType.MINING, rank4) && Permissions.demolitionsExpertise(player); - } + protected static HashSet generateTransparentBlockList() { + HashSet transparentBlocks = new HashSet(); - public static int processDemolitionsExpertise(Player player, int damage) { - int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(SkillType.MINING); - int modifiedDamage; - - if (skillLevel >= BlastMining.rank8) { - modifiedDamage = 0; - } - else if (skillLevel >= BlastMining.rank6) { - modifiedDamage = damage / 4; - } - else { - modifiedDamage = damage / 2; + for (Material material : Material.values()) { + if (material.isTransparent()) { + transparentBlocks.add((byte) material.getId()); + } } - return modifiedDamage; + return transparentBlocks; } } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/BlastMiningDropEventHandler.java b/src/main/java/com/gmail/nossr50/skills/mining/BlastMiningDropEventHandler.java deleted file mode 100644 index 77c9ade0b..000000000 --- a/src/main/java/com/gmail/nossr50/skills/mining/BlastMiningDropEventHandler.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.gmail.nossr50.skills.mining; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.inventory.ItemStack; - -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.BlockChecks; -import com.gmail.nossr50.util.Misc; - -public class BlastMiningDropEventHandler { - private MiningManager manager; - private int skillLevel; - private EntityExplodeEvent event; - private float yield; - private List blocks; - private List ores = new ArrayList(); - private List debris = new ArrayList(); - private List droppedOres = new ArrayList(); - private float oreBonus; - private float debrisReduction; - private int dropMultiplier; - - public BlastMiningDropEventHandler(MiningManager manager, EntityExplodeEvent event) { - this.manager = manager; - this.skillLevel = manager.getSkillLevel(); - - this.event = event; - this.yield = event.getYield(); - this.blocks = event.blockList(); - } - - protected void sortExplosionBlocks() { - for (Block block : blocks) { - BlockState blockState = block.getState(); - - if (BlockChecks.isOre(blockState)) { - ores.add(blockState); - } - else { - debris.add(blockState); - } - } - } - - protected void processXPGain() { - for (BlockState blockState : droppedOres) { - if (!mcMMO.placeStore.isTrue(blockState)) { - Mining.awardMiningXp(blockState, manager.getMcMMOPlayer().getPlayer()); - } - } - } - - protected void processDroppedBlocks() { - for (BlockState blockState : ores) { - if (Misc.getRandom().nextFloat() < (yield + oreBonus)) { - droppedOres.add(blockState); - Mining.handleMiningDrops(blockState); - - if (!mcMMO.placeStore.isTrue(blockState)) { - for (int i = 1 ; i < dropMultiplier ; i++) { - droppedOres.add(blockState); - Mining.handleMiningDrops(blockState); - } - } - } - } - - float debrisYield = yield - debrisReduction; - - if (debrisYield > 0) { - for (BlockState blockState : debris) { - Location location = blockState.getLocation(); - Material type = blockState.getType(); - - if (Misc.getRandom().nextFloat() < debrisYield) { - Misc.dropItem(location, new ItemStack(type)); - } - } - } - } - - protected void modifyEventYield() { - event.setYield(0); - } - - protected void calcuateDropModifiers() { - calculateOreBonus(); - calculateDebrisReduction(); - calculateDropMultiplier(); - } - - private void calculateOreBonus() { - if (skillLevel >= BlastMining.rank8) { - oreBonus = .70f; - } - else if (skillLevel >= BlastMining.rank7) { - oreBonus = .65f; - } - else if (skillLevel >= BlastMining.rank6) { - oreBonus = .60f; - } - else if (skillLevel >= BlastMining.rank5) { - oreBonus = .55f; - } - else if (skillLevel >= BlastMining.rank4) { - oreBonus = .50f; - } - else if (skillLevel >= BlastMining.rank3) { - oreBonus = .45f; - } - else if (skillLevel >= BlastMining.rank2) { - oreBonus = .40f; - } - else { - debrisReduction = .35f; - } - } - - private void calculateDebrisReduction() { - if (skillLevel >= BlastMining.rank3) { - debrisReduction = .30f; - } - else if (skillLevel >= BlastMining.rank2) { - debrisReduction = .20f; - } - else { - debrisReduction = .10f; - } - } - - private void calculateDropMultiplier() { - if (skillLevel >= BlastMining.rank7) { - dropMultiplier = 3; - } - else if (skillLevel >= BlastMining.rank5) { - dropMultiplier = 2; - } - else { - dropMultiplier = 1; - } - } -} diff --git a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java index 9655af76e..7dd154666 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -3,19 +3,14 @@ package com.gmail.nossr50.skills.mining; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockState; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.mods.ModChecks; import com.gmail.nossr50.mods.datatypes.CustomBlock; -import com.gmail.nossr50.skills.utilities.SkillTools; import com.gmail.nossr50.skills.utilities.SkillType; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.Users; public class Mining { private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); @@ -24,31 +19,11 @@ public class Mining { public static double doubleDropsMaxChance = advancedConfig.getMiningDoubleDropChance(); /** - * Process double drops & XP gain for Mining. + * Calculate XP gain for Mining. * * @param blockState The {@link BlockState} to check ability activation for - * @param player The {@link Player} using this ability */ - public static void miningBlockCheck(BlockState blockState, Player player) { - awardMiningXp(blockState, player); - - if (Permissions.doubleDrops(player, SkillType.MINING) && SkillTools.activationSuccessful(player, SkillType.MINING, doubleDropsMaxChance, doubleDropsMaxLevel)) { - if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) { - handleSilkTouchDrops(blockState); - } - else { - handleMiningDrops(blockState); - } - } - } - - /** - * Award XP gain for Mining. - * - * @param blockState The {@link BlockState} to check ability activation for - * @param player The {@link Player} using this ability - */ - protected static void awardMiningXp(BlockState blockState, Player player) { + protected static int getBlockXp(BlockState blockState) { Material blockType = blockState.getType(); int xp = Config.getInstance().getXp(SkillType.MINING, blockType); @@ -59,7 +34,7 @@ public class Mining { xp = ModChecks.getCustomBlock(blockState).getXpGain(); } - Users.getPlayer(player).beginXpGain(SkillType.MINING, xp); + return xp; } /** diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningCommand.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningCommand.java index 2bee93bd9..dd44ee0f7 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningCommand.java @@ -1,7 +1,9 @@ package com.gmail.nossr50.skills.mining; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.SkillCommand; +import com.gmail.nossr50.skills.SkillManagerStore; import com.gmail.nossr50.skills.utilities.SkillType; import com.gmail.nossr50.util.Permissions; @@ -10,8 +12,12 @@ public class MiningCommand extends SkillCommand { private String doubleDropChanceLucky; private String superBreakerLength; private String superBreakerLengthEndurance; - private String blastMiningRank; - private String blastRadiusIncrease; + + private int blastMiningRank; + private int bonusTNTDrops; + private double blastRadiusIncrease; + private String oreBonus; + private String debrisReduction; private String blastDamageDecrease; private boolean canSuperBreaker; @@ -38,51 +44,13 @@ public class MiningCommand extends SkillCommand { doubleDropChanceLucky = doubleDropStrings[1]; //BLAST MINING - if (skillValue >= BlastMining.rank8) { - blastMiningRank = "8"; - blastDamageDecrease = "100.00%"; - blastRadiusIncrease = "4"; - } - else if (skillValue >= BlastMining.rank7) { - blastMiningRank = "7"; - blastDamageDecrease = "50.00%"; - blastRadiusIncrease = "3"; - } - else if (skillValue >= BlastMining.rank6) { - blastMiningRank = "6"; - blastDamageDecrease = "50.00%"; - blastRadiusIncrease = "3"; - } - else if (skillValue >= BlastMining.rank5) { - blastMiningRank = "5"; - blastDamageDecrease = "25.00%"; - blastRadiusIncrease = "2"; - } - else if (skillValue >= BlastMining.rank4) { - blastMiningRank = "4"; - blastDamageDecrease = "25.00%"; - blastRadiusIncrease = "2"; - } - else if (skillValue >= BlastMining.rank3) { - blastMiningRank = "3"; - blastDamageDecrease = "0.00%"; - blastRadiusIncrease = "1"; - } - else if (skillValue >= BlastMining.rank2) { - blastMiningRank = "2"; - blastDamageDecrease = "0.00%"; - blastRadiusIncrease = "1"; - } - else if (skillValue >= BlastMining.rank1) { - blastMiningRank = "1"; - blastDamageDecrease = "0.00%"; - blastRadiusIncrease = "0"; - } - else { - blastMiningRank = "0"; - blastDamageDecrease = "0.00%"; - blastRadiusIncrease = "0"; - } + MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(player.getName()); + blastMiningRank = miningManager.getBlastMiningTier(); + bonusTNTDrops = miningManager.getDropMultiplier(); + oreBonus = percent.format(miningManager.getOreBonus() / 30.0D); // Base received in TNT is 30% + debrisReduction = percent.format(miningManager.getDebrisReduction() / 30.0D); // Base received in TNT is 30% + blastDamageDecrease = percent.format(miningManager.getBlastDamageModifier() / 100.0D); + blastRadiusIncrease = miningManager.getBlastRadiusModifier(); } @Override @@ -151,17 +119,17 @@ public class MiningCommand extends SkillCommand { } if (canBlast) { - if (skillValue < BlastMining.rank1) { - player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.0", BlastMining.rank1))); + if (skillValue < AdvancedConfig.getInstance().getBlastMiningRank1()) { + player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.0", AdvancedConfig.getInstance().getBlastMiningRank1()))); } else { - player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (Integer.parseInt(blastMiningRank) - 1)))); + player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops))); } } if (canBiggerBombs) { - if (skillValue < BlastMining.rank2) { - player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", BlastMining.rank2))); + if (skillValue < AdvancedConfig.getInstance().getBlastMiningRank2()) { + player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", AdvancedConfig.getInstance().getBlastMiningRank2()))); } else { player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease)); @@ -169,8 +137,8 @@ public class MiningCommand extends SkillCommand { } if (canDemoExpert) { - if (skillValue < BlastMining.rank4) { - player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", BlastMining.rank4))); + if (skillValue < AdvancedConfig.getInstance().getBlastMiningRank4()) { + player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", AdvancedConfig.getInstance().getBlastMiningRank4()))); } else { player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease)); 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 bf6d55aa6..2f219f4e3 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -1,50 +1,104 @@ package com.gmail.nossr50.skills.mining; -import org.bukkit.Material; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.event.player.PlayerInteractEvent; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; + +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.McMMOPlayer; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.SkillManager; +import com.gmail.nossr50.skills.mining.BlastMining.Tier; +import com.gmail.nossr50.skills.utilities.AbilityType; import com.gmail.nossr50.skills.utilities.SkillTools; import com.gmail.nossr50.skills.utilities.SkillType; +import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.Permissions; public class MiningManager extends SkillManager{ public MiningManager (McMMOPlayer mcMMOPlayer) { super(mcMMOPlayer, SkillType.MINING); } + public boolean canUseDemolitionsExpertise() { + Player player = getPlayer(); + + return SkillTools.unlockLevelReached(player, skill, BlastMining.Tier.FOUR.getLevel()) && Permissions.demolitionsExpertise(player); + } + + public boolean canDetonate() { + Player player = getPlayer(); + + return player.isSneaking() && player.getItemInHand().getTypeId() == BlastMining.detonatorID && Permissions.remoteDetonation(player) && SkillTools.unlockLevelReached(player, skill, BlastMining.Tier.ONE.getLevel()); + } + + public boolean canUseBlastMining() { + return SkillTools.unlockLevelReached(getPlayer(), skill, BlastMining.Tier.ONE.getLevel()); + } + + public boolean canUseBiggerBombs() { + Player player = getPlayer(); + + return Permissions.biggerBombs(player) && SkillTools.unlockLevelReached(getPlayer(), skill, BlastMining.Tier.TWO.getLevel()); + } + + /** + * Process double drops & XP gain for Mining. + * + * @param blockState The {@link BlockState} to check ability activation for + * @param player The {@link Player} using this ability + */ + public void miningBlockCheck(BlockState blockState) { + Player player = getPlayer(); + int xp = Mining.getBlockXp(blockState); + + if (Permissions.doubleDrops(player, skill) && SkillTools.activationSuccessful(player, skill, Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) { + if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) { + Mining.handleSilkTouchDrops(blockState); + } + else { + Mining.handleMiningDrops(blockState); + } + } + + applyXpGain(xp); + } + /** * Detonate TNT for Blast Mining - * - * @param event The PlayerInteractEvent */ - public void detonate(PlayerInteractEvent event) { - if (getSkillLevel() < BlastMining.rank1) { + public void remoteDetonation() { + Player player = getPlayer(); + + HashSet transparentBlocks = BlastMining.generateTransparentBlockList(); + Block targetBlock = player.getTargetBlock(transparentBlocks, BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE); + + if (targetBlock.getType() != Material.TNT || !SkillTools.blockBreakSimulate(targetBlock, player, true) || !blastMiningCooldownOver()) { return; } - RemoteDetonationEventHandler eventHandler = new RemoteDetonationEventHandler(this, event); + PlayerProfile profile = getProfile(); + TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class); - eventHandler.targetTNT(); + SkillTools.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player)); + player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom")); - if (eventHandler.getBlock().getType() != Material.TNT) { - return; - } + mcMMO.p.addToTNTTracker(tnt.getEntityId(), player.getName()); + tnt.setFuseTicks(0); + targetBlock.setData((byte) 0x0); + targetBlock.setType(Material.AIR); - if (!SkillTools.blockBreakSimulate(eventHandler.getBlock(), mcMMOPlayer.getPlayer(), true)) { - return; - } - - if (!eventHandler.cooldownOver()) { - return; - } - - eventHandler.sendMessages(); - eventHandler.handleDetonation(); - eventHandler.setProfileData(); + profile.setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis()); + profile.setAbilityInformed(AbilityType.BLAST_MINING, false); } /** @@ -52,24 +106,54 @@ public class MiningManager extends SkillManager{ * * @param event Event whose explosion is being processed */ - public void blastMiningDropProcessing(EntityExplodeEvent event) { - if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) { - return; + public void blastMiningDropProcessing(float yield, List blockList) { + List ores = new ArrayList(); + List debris = new ArrayList(); + int xp = 0; + + float oreBonus = (float) (getOreBonus() / 100); + float debrisReduction = (float) (getDebrisReduction() / 100); + int dropMultiplier = getDropMultiplier(); + + float debrisYield = yield - debrisReduction; + + for (Block block : blockList) { + BlockState blockState = block.getState(); + + if (BlockChecks.isOre(blockState)) { + ores.add(blockState); + } + else { + debris.add(blockState); + } } - if (getSkillLevel() < BlastMining.rank1) { - return; + for (BlockState blockState : ores) { + if (Misc.getRandom().nextFloat() < (yield + oreBonus)) { + if (!mcMMO.placeStore.isTrue(blockState)) { + xp += Mining.getBlockXp(blockState); + } + + Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack()); // Initial block that would have been dropped + + if (!mcMMO.placeStore.isTrue(blockState)) { + for (int i = 1 ; i < dropMultiplier ; i++) { + xp += Mining.getBlockXp(blockState); + Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items + } + } + } } - BlastMiningDropEventHandler eventHandler = new BlastMiningDropEventHandler(this, event); + if (debrisYield > 0) { + for (BlockState blockState : debris) { + if (Misc.getRandom().nextFloat() < debrisYield) { + Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack()); + } + } + } - eventHandler.sortExplosionBlocks(); - eventHandler.modifyEventYield(); - - eventHandler.calcuateDropModifiers(); - eventHandler.processDroppedBlocks(); - - eventHandler.processXPGain(); + applyXpGain(xp); } /** @@ -77,14 +161,128 @@ public class MiningManager extends SkillManager{ * * @param event Event whose explosion radius is being changed */ - public void biggerBombs(ExplosionPrimeEvent event) { - if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) { - return; + public float biggerBombs(float radius) { + return (float) (radius + getBlastRadiusModifier()); + } + + public int processDemolitionsExpertise(int damage) { + return (int) (damage * (100.0 - getBlastDamageModifier())); + } + + private boolean blastMiningCooldownOver() { + Player player = getPlayer(); + PlayerProfile profile = getProfile(); + + long oldTime = profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR; + int cooldown = AbilityType.BLAST_MINING.getCooldown(); + + if (!SkillTools.cooldownOver(oldTime, cooldown, player)) { + player.sendMessage(LocaleLoader.getString("Skills.TooTired", SkillTools.calculateTimeLeft(oldTime, cooldown, player))); + return false; } - BiggerBombsEventHandler eventHandler = new BiggerBombsEventHandler(this, event); + return true; + } - eventHandler.calculateRadiusIncrease(); - eventHandler.modifyBlastRadius(); + /** + * Gets the Blast Mining tier + * + * @return the Blast Mining tier + */ + public int getBlastMiningTier() { + int skillLevel = getSkillLevel(); + + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.toNumerical(); + } + } + + return 0; + } + + /** + * Gets the Blast Mining tier + * + * @return the Blast Mining tier + */ + public double getOreBonus() { + int skillLevel = getSkillLevel(); + + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.getOreBonus(); + } + } + + return 0; + } + + /** + * Gets the Blast Mining tier + * + * @return the Blast Mining tier + */ + public double getDebrisReduction() { + int skillLevel = getSkillLevel(); + + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.getDebrisReduction(); + } + } + + return 0; + } + + /** + * Gets the Blast Mining tier + * + * @return the Blast Mining tier + */ + public int getDropMultiplier() { + int skillLevel = getSkillLevel(); + + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.getDropMultiplier(); + } + } + + return 0; + } + + /** + * Gets the Blast Mining tier + * + * @return the Blast Mining tier + */ + public double getBlastRadiusModifier() { + int skillLevel = getSkillLevel(); + + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.getBlastRadiusModifier(); + } + } + + return 0; + } + + /** + * Gets the Blast Mining tier + * + * @return the Blast Mining tier + */ + public double getBlastDamageModifier() { + int skillLevel = getSkillLevel(); + + for (Tier tier : Tier.values()) { + if (skillLevel >= tier.getLevel()) { + return tier.getBlastDamageDecrease(); + } + } + + return 0; } } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/RemoteDetonationEventHandler.java b/src/main/java/com/gmail/nossr50/skills/mining/RemoteDetonationEventHandler.java deleted file mode 100644 index d37e52f26..000000000 --- a/src/main/java/com/gmail/nossr50/skills/mining/RemoteDetonationEventHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gmail.nossr50.skills.mining; - -import java.util.HashSet; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.event.player.PlayerInteractEvent; - -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.datatypes.McMMOPlayer; -import com.gmail.nossr50.datatypes.PlayerProfile; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.skills.utilities.AbilityType; -import com.gmail.nossr50.skills.utilities.SkillTools; -import com.gmail.nossr50.util.Misc; - -public class RemoteDetonationEventHandler { - private MiningManager manager; - private PlayerInteractEvent event; - private Block block; - private HashSet transparentBlocks = new HashSet(); - - public RemoteDetonationEventHandler(MiningManager manager, PlayerInteractEvent event) { - this.manager = manager; - this.event = event; - this.block = event.getClickedBlock(); - } - - protected void targetTNT() { - if (block == null || block.getType() != Material.TNT) { - generateTransparentBlockList(); - block = manager.getMcMMOPlayer().getPlayer().getTargetBlock(transparentBlocks, BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE); - } - else { - event.setCancelled(true); // This is the only way I know to avoid the original TNT to be triggered (in case the player is close to it) - } - } - - protected boolean cooldownOver() { - McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer(); - Player player = mcMMOPlayer.getPlayer(); - PlayerProfile profile = mcMMOPlayer.getProfile(); - - if (!SkillTools.cooldownOver(profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR, AbilityType.BLAST_MINING.getCooldown(), player)) { - player.sendMessage(LocaleLoader.getString("Skills.TooTired", SkillTools.calculateTimeLeft(profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR, AbilityType.BLAST_MINING.getCooldown(), player))); - - return false; - } - - return true; - } - - protected void sendMessages() { - Player player = manager.getMcMMOPlayer().getPlayer(); - - SkillTools.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player)); - player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom")); - } - - protected void handleDetonation() { - Player player = manager.getMcMMOPlayer().getPlayer(); - TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class); - - mcMMO.p.addToTNTTracker(tnt.getEntityId(), player.getName()); - tnt.setFuseTicks(0); - block.setType(Material.AIR); - } - - protected void setProfileData() { - PlayerProfile profile = manager.getMcMMOPlayer().getProfile(); - - profile.setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis()); - profile.setAbilityInformed(AbilityType.BLAST_MINING, false); - } - - private void generateTransparentBlockList() { - for (Material material : Material.values()) { - if (material.isTransparent()) { - transparentBlocks.add((byte) material.getId()); - } - } - } - - protected Block getBlock() { - return block; - } -} diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index e9a028b85..7dcbae73a 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -183,6 +183,56 @@ Skills: BlastMining_Rank6: 750 BlastMining_Rank7: 875 BlastMining_Rank8: 1000 + + # BlastDamageDecrease_Rank: % of damage reduced from TNT explosions + BlastDamageDecrease_Rank1: 0.0 + BlastDamageDecrease_Rank2: 0.0 + BlastDamageDecrease_Rank3: 0.0 + BlastDamageDecrease_Rank4: 25.0 + BlastDamageDecrease_Rank5: 25.0 + BlastDamageDecrease_Rank6: 50.0 + BlastDamageDecrease_Rank7: 50.0 + BlastDamageDecrease_Rank8: 100.0 + + # OreBonus_Rank: % of extra ores received when Blast Mining + OreBonus_Rank1: 35.0 + OreBonus_Rank2: 40.0 + OreBonus_Rank3: 45.0 + OreBonus_Rank4: 50.0 + OreBonus_Rank5: 55.0 + OreBonus_Rank6: 60.0 + OreBonus_Rank7: 65.0 + OreBonus_Rank8: 70.0 + + # DebrisReduction_Rank: % of fewer non-ores received when Blast Mining + DebrisReduction_Rank1: 10.0 + DebrisReduction_Rank2: 20.0 + DebrisReduction_Rank3: 30.0 + DebrisReduction_Rank4: 30.0 + DebrisReduction_Rank5: 30.0 + DebrisReduction_Rank6: 30.0 + DebrisReduction_Rank7: 30.0 + DebrisReduction_Rank8: 30.0 + + # DropMultiplier_Rank: # of times each ore will drop + DropMultiplier_Rank1: 1 + DropMultiplier_Rank2: 1 + DropMultiplier_Rank3: 1 + DropMultiplier_Rank4: 1 + DropMultiplier_Rank5: 2 + DropMultiplier_Rank6: 2 + DropMultiplier_Rank7: 3 + DropMultiplier_Rank8: 3 + + # BlastRadiusModifier_Rank: Increases the blast radius by this amount + BlastRadiusModifier_Rank1: 1.0 + BlastRadiusModifier_Rank2: 1.0 + BlastRadiusModifier_Rank3: 2.0 + BlastRadiusModifier_Rank4: 2.0 + BlastRadiusModifier_Rank5: 3.0 + BlastRadiusModifier_Rank6: 3.0 + BlastRadiusModifier_Rank7: 4.0 + BlastRadiusModifier_Rank8: 4.0 # # Settings for Repair ### diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 5177e7736..5aa71ee97 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -187,14 +187,7 @@ Mining.Skillup=[[YELLOW]]Mining skill increased by {0}. Total ({1}) #Blast Mining Mining.Blast.Boom=[[GRAY]]**BOOM** -Mining.Blast.Effect.0=+35% ore yield -Mining.Blast.Effect.1=+40% ore yield -Mining.Blast.Effect.2=+45% ore yield, no debris -Mining.Blast.Effect.3=+50% ore yield, no debris -Mining.Blast.Effect.4=+55% ore yield, no debris, double drops -Mining.Blast.Effect.5=+60% ore yield, no debris, double drops -Mining.Blast.Effect.6=+65% ore yield, no debris, triple drops -Mining.Blast.Effect.7=+70% ore yield, no debris, triple drops +Mining.Blast.Effect=+{0} ore yield, -{1} debris yield, {2}x drops Mining.Blast.Radius.Increase=[[RED]]Blast Radius Increase: [[YELLOW]]+{0} Mining.Blast.Rank=[[RED]]Blast Mining: [[YELLOW]] Rank {0}/8 [[GRAY]]({1}) Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Blast Mining!