mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Fixes #3832 - Resolved issue with double drops & herbalism, similar fixes coming to woodcutting/mining soon. Reminder to update config.yml, read changelog for instructions.
If you harvest crops with a Hoe it does not require seeds to replant on successful Green Thumb
This commit is contained in:
@ -1,14 +1,19 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@ -16,6 +21,34 @@ public final class BlockUtils {
|
||||
|
||||
private BlockUtils() {}
|
||||
|
||||
/**
|
||||
* Mark a block for giving bonus drops, double drops are used if triple is false
|
||||
* @param blockState target blockstate
|
||||
* @param triple marks the block to give triple drops
|
||||
*/
|
||||
public static void markBlocksForBonusDrops(BlockState blockState, boolean triple)
|
||||
{
|
||||
if(triple)
|
||||
blockState.setMetadata(mcMMO.tripleDropKey, mcMMO.metadataValue);
|
||||
else
|
||||
blockState.setMetadata(mcMMO.doubleDropKey, mcMMO.metadataValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player successfully passed the double drop check
|
||||
* @param blockState the blockstate
|
||||
* @return true if the player succeeded in the check
|
||||
*/
|
||||
public static boolean checkDoubleDrops(Player player, BlockState blockState, PrimarySkillType skillType, SubSkillType subSkillType)
|
||||
{
|
||||
if(Config.getInstance().getDoubleDropsEnabled(skillType, blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType))
|
||||
{
|
||||
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a given block awards XP.
|
||||
*
|
||||
|
Reference in New Issue
Block a user