mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed triple drop awarding experience twice in mining
The previous commit also fixed this for Herbalism
This commit is contained in:
parent
cddcf36016
commit
57e33bbf39
@ -9,6 +9,7 @@ Key:
|
||||
|
||||
Version 1.4.03-dev
|
||||
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
|
||||
= Fixed bug where triple drops would award twice the amount of experience in Herbalism and Mining
|
||||
= Fixed bug where Green Thumb would consume wheat instead of seeds
|
||||
= Fixed bug where Green Terra would consume twice the amount of seed when used on crops
|
||||
= Fixed bug where experience would be awarded in Herbalism for some player-placed blocks
|
||||
|
@ -137,7 +137,6 @@ public class BlockListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
/* HERBALISM */
|
||||
@ -162,10 +161,6 @@ public class BlockListener implements Listener {
|
||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.placeStore.isTrue(blockState)) {
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
|
@ -43,10 +43,6 @@ public class Mining {
|
||||
protected static void handleSilkTouchDrops(BlockState blockState) {
|
||||
Material blockType = blockState.getType();
|
||||
|
||||
if (blockType != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, blockType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (blockType) {
|
||||
case ENDER_STONE:
|
||||
case GOLD_ORE:
|
||||
@ -89,13 +85,7 @@ public class Mining {
|
||||
*/
|
||||
protected static void handleMiningDrops(BlockState blockState) {
|
||||
Material blockType = blockState.getType();
|
||||
|
||||
if (blockType != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, blockType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location location = blockState.getLocation();
|
||||
ItemStack dropItem;
|
||||
|
||||
switch (blockType) {
|
||||
case COAL_ORE:
|
||||
@ -130,7 +120,7 @@ public class Mining {
|
||||
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||
|
||||
dropItem = customBlock.getItemDrop();
|
||||
ItemStack dropItem = customBlock.getItemDrop();
|
||||
|
||||
if (minimumDropAmount != maximumDropAmount) {
|
||||
Misc.dropItems(location, dropItem, minimumDropAmount);
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
@ -54,18 +55,29 @@ public class MiningManager extends SkillManager{
|
||||
*/
|
||||
public void miningBlockCheck(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
int xp = Mining.getBlockXp(blockState);
|
||||
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
Mining.handleSilkTouchDrops(blockState);
|
||||
}
|
||||
else {
|
||||
Mining.handleMiningDrops(blockState);
|
||||
if (!Permissions.doubleDrops(player, skill)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Material material = blockState.getType();
|
||||
|
||||
if (material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
Mining.handleSilkTouchDrops(blockState);
|
||||
}
|
||||
else {
|
||||
Mining.handleMiningDrops(blockState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyXpGain(xp);
|
||||
applyXpGain(Mining.getBlockXp(blockState));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user