2012-05-01 19:58:47 +02:00
|
|
|
package com.gmail.nossr50.skills.gathering;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
2012-03-26 17:04:17 +02:00
|
|
|
import java.util.Random;
|
|
|
|
|
2012-03-13 08:31:07 +01:00
|
|
|
import org.bukkit.CoalType;
|
2012-01-09 20:00:13 +01:00
|
|
|
import org.bukkit.Location;
|
2012-03-04 09:54:26 +01:00
|
|
|
import org.bukkit.Material;
|
2012-01-09 20:00:13 +01:00
|
|
|
import org.bukkit.block.Block;
|
2012-05-18 17:15:30 +02:00
|
|
|
import org.bukkit.enchantments.Enchantment;
|
2012-01-09 20:00:13 +01:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.getspout.spoutapi.sound.SoundEffect;
|
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2012-06-05 16:13:10 +02:00
|
|
|
import com.gmail.nossr50.config.Config;
|
|
|
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
|
|
|
import com.gmail.nossr50.datatypes.SkillType;
|
2012-06-25 15:39:02 +02:00
|
|
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
2012-06-05 16:13:10 +02:00
|
|
|
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
2012-03-21 03:33:58 +01:00
|
|
|
import com.gmail.nossr50.spout.SpoutSounds;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.util.Misc;
|
2012-05-17 06:24:33 +02:00
|
|
|
import com.gmail.nossr50.util.ModChecks;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2012-05-01 19:58:47 +02:00
|
|
|
import com.gmail.nossr50.util.Skills;
|
2012-04-27 11:47:11 +02:00
|
|
|
import com.gmail.nossr50.util.Users;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
2012-03-26 17:04:17 +02:00
|
|
|
public class Mining {
|
|
|
|
private static Random random = new Random();
|
2012-02-27 23:28:32 +01:00
|
|
|
|
2012-05-18 17:15:30 +02:00
|
|
|
/**
|
|
|
|
* Handle double drops when using Silk Touch.
|
|
|
|
*
|
|
|
|
* @param block The block to process drops for
|
|
|
|
*/
|
|
|
|
private static void silkTouchDrops(Block block) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Location location = block.getLocation();
|
2012-05-18 17:15:30 +02:00
|
|
|
Material type = block.getType();
|
|
|
|
ItemStack item = new ItemStack(type);
|
|
|
|
Config configInstance = Config.getInstance();
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case ENDER_STONE:
|
|
|
|
case GOLD_ORE:
|
|
|
|
case IRON_ORE:
|
|
|
|
case MOSSY_COBBLESTONE:
|
|
|
|
case NETHERRACK:
|
|
|
|
case OBSIDIAN:
|
|
|
|
case SANDSTONE:
|
|
|
|
miningDrops(block);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COAL_ORE:
|
|
|
|
if (configInstance.getCoalDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DIAMOND_ORE:
|
|
|
|
if (configInstance.getDiamondDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GLOWING_REDSTONE_ORE:
|
|
|
|
case REDSTONE_ORE:
|
|
|
|
if (configInstance.getRedstoneDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GLOWSTONE:
|
|
|
|
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LAPIS_ORE:
|
|
|
|
if (configInstance.getLapisDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STONE:
|
|
|
|
if (configInstance.getStoneDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
2012-09-05 10:19:34 +02:00
|
|
|
|
|
|
|
case EMERALD_ORE:
|
|
|
|
if (configInstance.getEmeraldDoubleDropsEnabled()) {
|
|
|
|
Misc.dropItem(location, item);
|
|
|
|
}
|
|
|
|
break;
|
2012-05-18 17:15:30 +02:00
|
|
|
|
|
|
|
default:
|
2012-05-22 05:41:11 +02:00
|
|
|
if (ModChecks.isCustomMiningBlock(block)) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()));
|
2012-05-18 17:15:30 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-03-13 08:31:07 +01:00
|
|
|
/**
|
|
|
|
* Drop items from Mining & Blast Mining skills.
|
|
|
|
*
|
|
|
|
* @param block The block to process drops for
|
|
|
|
*/
|
|
|
|
public static void miningDrops(Block block) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Location location = block.getLocation();
|
2012-03-13 08:31:07 +01:00
|
|
|
Material type = block.getType();
|
2012-03-16 18:45:30 +01:00
|
|
|
ItemStack item = new ItemStack(type);
|
2012-05-01 07:14:32 +02:00
|
|
|
Config configInstance = Config.getInstance();
|
2012-03-13 08:31:07 +01:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case COAL_ORE:
|
2012-05-01 07:14:32 +02:00
|
|
|
if (configInstance.getCoalDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DIAMOND_ORE:
|
2012-05-01 07:14:32 +02:00
|
|
|
if (configInstance.getDiamondDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.DIAMOND);
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ENDER_STONE:
|
|
|
|
if (configInstance.getEndStoneDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GLOWING_REDSTONE_ORE:
|
|
|
|
case REDSTONE_ORE:
|
2012-05-01 07:14:32 +02:00
|
|
|
if (configInstance.getRedstoneDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.REDSTONE);
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItems(location, item, 4);
|
|
|
|
Misc.randomDropItem(location, item, 50);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GLOWSTONE:
|
2012-05-01 07:14:32 +02:00
|
|
|
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.GLOWSTONE_DUST);
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItems(location, item, 2);
|
|
|
|
Misc.randomDropItems(location, item, 50, 2);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GOLD_ORE:
|
|
|
|
if (configInstance.getGoldDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IRON_ORE:
|
|
|
|
if (configInstance.getIronDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LAPIS_ORE:
|
2012-05-01 07:14:32 +02:00
|
|
|
if (configInstance.getLapisDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItems(location, item, 4);
|
|
|
|
Misc.randomDropItems(location, item, 50, 4);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOSSY_COBBLESTONE:
|
|
|
|
if (configInstance.getMossyCobblestoneDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NETHERRACK:
|
|
|
|
if (configInstance.getNetherrackDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBSIDIAN:
|
|
|
|
if (configInstance.getObsidianDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SANDSTONE:
|
|
|
|
if (configInstance.getSandstoneDoubleDropsEnabled()) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STONE:
|
2012-05-01 07:14:32 +02:00
|
|
|
if (configInstance.getStoneDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.COBBLESTONE);
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItem(location, item);
|
2012-05-01 07:14:32 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
2012-09-05 10:19:34 +02:00
|
|
|
|
|
|
|
case EMERALD_ORE:
|
|
|
|
if (configInstance.getEmeraldDoubleDropsEnabled()) {
|
|
|
|
item = new ItemStack(Material.EMERALD);
|
|
|
|
Misc.dropItem(location, item);
|
|
|
|
}
|
|
|
|
break;
|
2012-03-13 08:31:07 +01:00
|
|
|
|
|
|
|
default:
|
2012-05-22 05:41:11 +02:00
|
|
|
if (ModChecks.isCustomMiningBlock(block)) {
|
2012-06-25 15:39:02 +02:00
|
|
|
CustomBlock customBlock = ModChecks.getCustomBlock(block);
|
|
|
|
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
|
|
|
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
|
|
|
|
2012-05-17 06:24:33 +02:00
|
|
|
item = ModChecks.getCustomBlock(block).getItemDrop();
|
2012-06-25 15:39:02 +02:00
|
|
|
|
|
|
|
if (minimumDropAmount != maximumDropAmount) {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItems(location, item, minimumDropAmount);
|
|
|
|
Misc.randomDropItems(location, item, 50, maximumDropAmount - minimumDropAmount);
|
2012-06-25 15:39:02 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-07-04 21:35:14 +02:00
|
|
|
Misc.dropItems(location, item, minimumDropAmount);
|
2012-06-25 15:39:02 +02:00
|
|
|
}
|
2012-05-17 06:24:33 +02:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|
2012-01-31 18:59:33 +01:00
|
|
|
|
2012-03-13 08:31:07 +01:00
|
|
|
/**
|
|
|
|
* Award XP for Mining blocks.
|
|
|
|
*
|
|
|
|
* @param player The player to award XP to
|
|
|
|
* @param block The block to award XP for
|
|
|
|
*/
|
|
|
|
public static void miningXP(Player player, Block block) {
|
2012-07-03 16:04:04 +02:00
|
|
|
PlayerProfile profile = Users.getProfile(player);
|
2012-03-13 08:31:07 +01:00
|
|
|
Material type = block.getType();
|
|
|
|
int xp = 0;
|
2012-06-05 15:57:10 +02:00
|
|
|
|
2012-03-13 08:31:07 +01:00
|
|
|
switch (type) {
|
|
|
|
case COAL_ORE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPCoalOre();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DIAMOND_ORE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPDiamondOre();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ENDER_STONE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPEndStone();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GLOWING_REDSTONE_ORE:
|
|
|
|
case REDSTONE_ORE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPRedstoneOre();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GLOWSTONE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPGlowstone();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GOLD_ORE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPGoldOre();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IRON_ORE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPIronOre();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LAPIS_ORE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPLapisOre();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MOSSY_COBBLESTONE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPMossyStone();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NETHERRACK:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPNetherrack();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBSIDIAN:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPObsidian();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SANDSTONE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPSandstone();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STONE:
|
2012-04-27 05:58:21 +02:00
|
|
|
xp += Config.getInstance().getMiningXPStone();
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
2012-09-05 10:19:34 +02:00
|
|
|
|
|
|
|
case EMERALD_ORE:
|
|
|
|
xp += Config.getInstance().getMiningXPEmeraldOre();
|
|
|
|
break;
|
2012-03-13 08:31:07 +01:00
|
|
|
|
|
|
|
default:
|
2012-05-22 05:41:11 +02:00
|
|
|
if (ModChecks.isCustomMiningBlock(block)) {
|
2012-05-17 06:24:33 +02:00
|
|
|
xp += ModChecks.getCustomBlock(block).getXpGain();
|
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-07-03 16:04:04 +02:00
|
|
|
Skills.xpProcessing(player, profile, SkillType.MINING, xp);
|
2012-03-13 08:31:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process Mining block drops.
|
|
|
|
*
|
|
|
|
* @param player The player mining the block
|
|
|
|
* @param block The block being broken
|
|
|
|
*/
|
2012-03-15 22:29:27 +01:00
|
|
|
public static void miningBlockCheck(Player player, Block block) {
|
2012-06-07 00:02:22 +02:00
|
|
|
if (mcMMO.placeStore.isTrue(block)) {
|
2012-03-13 08:31:07 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
miningXP(player, block);
|
|
|
|
|
2012-05-18 17:15:30 +02:00
|
|
|
final int MAX_BONUS_LEVEL = 1000;
|
|
|
|
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
2012-05-22 05:41:11 +02:00
|
|
|
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
2012-03-13 08:31:07 +01:00
|
|
|
|
2012-07-02 17:09:55 +02:00
|
|
|
int randomChance = 1000;
|
|
|
|
|
|
|
|
if (player.hasPermission("mcmmo.perks.lucky.mining")) {
|
|
|
|
randomChance = (int) (randomChance * 0.75);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (random.nextInt(randomChance) <= skillCheck && Permissions.getInstance().miningDoubleDrops(player)) {
|
2012-05-18 17:15:30 +02:00
|
|
|
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
|
|
|
silkTouchDrops(block);
|
|
|
|
}
|
|
|
|
else {
|
2012-04-30 18:30:07 +02:00
|
|
|
miningDrops(block);
|
2012-03-13 08:31:07 +01:00
|
|
|
}
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|
2012-03-13 08:31:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle the Super Breaker ability.
|
|
|
|
*
|
|
|
|
* @param player The player using the ability
|
|
|
|
* @param block The block being affected
|
|
|
|
*/
|
2012-05-18 17:15:30 +02:00
|
|
|
public static void superBreakerBlockCheck(Player player, Block block) {
|
2012-03-13 08:31:07 +01:00
|
|
|
Material type = block.getType();
|
2012-04-27 11:47:11 +02:00
|
|
|
int tier = Misc.getTier(player.getItemInHand());
|
2012-04-27 05:58:21 +02:00
|
|
|
int durabilityLoss = Config.getInstance().getAbilityToolDamage();
|
2012-03-27 05:01:51 +02:00
|
|
|
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
|
2012-03-13 08:31:07 +01:00
|
|
|
|
2012-05-22 05:41:11 +02:00
|
|
|
if (ModChecks.isCustomMiningBlock(block)) {
|
2012-05-18 03:57:41 +02:00
|
|
|
if (ModChecks.getCustomBlock(block).getTier() < tier) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-08-14 22:52:31 +02:00
|
|
|
if (mcMMO.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) {
|
2012-03-13 08:31:07 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
2012-03-13 08:31:07 +01:00
|
|
|
Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
|
|
|
|
|
2012-03-15 22:29:27 +01:00
|
|
|
miningBlockCheck(player, block);
|
2012-03-13 08:31:07 +01:00
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
if (mcMMO.spoutEnabled) {
|
2012-03-21 03:33:58 +01:00
|
|
|
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
2012-03-13 08:31:07 +01:00
|
|
|
}
|
|
|
|
}
|
2012-05-18 03:37:14 +02:00
|
|
|
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:
|
2012-09-07 23:49:00 +02:00
|
|
|
case EMERALD_ORE:
|
2012-05-18 03:37:14 +02:00
|
|
|
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:
|
2012-08-17 06:28:28 +02:00
|
|
|
if (mcMMO.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) {
|
2012-05-18 03:37:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
2012-05-18 03:37:14 +02:00
|
|
|
Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
|
|
|
|
|
|
|
|
miningBlockCheck(player, block);
|
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
if (mcMMO.spoutEnabled) {
|
2012-05-18 03:37:14 +02:00
|
|
|
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
|
|
|
}
|
2012-07-03 01:26:40 +02:00
|
|
|
|
|
|
|
default:
|
2012-07-03 03:05:55 +02:00
|
|
|
return;
|
2012-05-18 03:37:14 +02:00
|
|
|
}
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|
|
|
|
}
|