From cf6d28a1bd4f139760ce08f40e2f02fb3eb9898f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 3 Jul 2019 02:29:51 -0700 Subject: [PATCH] Wire up Excavation, Fishing, and Herbalism behaviours --- .../behaviours/ExcavationBehaviour.java | 26 ++++ .../skills/behaviours/FishingBehaviour.java | 111 +++++++++++++++ .../skills/behaviours/HerbalismBehaviour.java | 8 +- .../nossr50/skills/excavation/Excavation.java | 30 ----- .../skills/excavation/ExcavationManager.java | 11 +- .../gmail/nossr50/skills/fishing/Fishing.java | 126 ------------------ .../skills/fishing/FishingManager.java | 25 ++-- .../skills/herbalism/HerbalismManager.java | 14 +- 8 files changed, 169 insertions(+), 182 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java delete mode 100644 src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ExcavationBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ExcavationBehaviour.java index 116a92ecc..4c6ecc519 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ExcavationBehaviour.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ExcavationBehaviour.java @@ -1,6 +1,13 @@ package com.gmail.nossr50.datatypes.skills.behaviours; +import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig; +import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.StringUtils; +import org.bukkit.block.BlockState; + +import java.util.ArrayList; +import java.util.List; /** * These behaviour classes are a band-aid fix for a larger problem @@ -16,4 +23,23 @@ public class ExcavationBehaviour { public ExcavationBehaviour(mcMMO pluginRef) { this.pluginRef = pluginRef; } + + /** + * Get the list of possible {@link ExcavationTreasure|ExcavationTreasures} obtained from a given block. + * + * @param blockState The {@link BlockState} of the block to check. + * @return the list of treasures that could be found + */ + public List getTreasures(BlockState blockState) { + String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData()); + if (ExcavationTreasureConfig.getInstance().excavationMap.containsKey(friendly)) + return ExcavationTreasureConfig.getInstance().excavationMap.get(friendly); + return new ArrayList<>(); + } + + public int getBlockXP(BlockState blockState) { + int xp = pluginRef.getDynamicSettingsManager().getExperienceManager().getExcavationXp(blockState.getType()); + + return xp; + } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/FishingBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/FishingBehaviour.java index 4520f9d7e..f636b1f22 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/FishingBehaviour.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/FishingBehaviour.java @@ -1,6 +1,19 @@ package com.gmail.nossr50.datatypes.skills.behaviours; +import com.gmail.nossr50.config.treasure.FishingTreasureConfig; +import com.gmail.nossr50.datatypes.treasure.ShakeTreasure; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.adapter.BiomeAdapter; +import org.bukkit.Material; +import org.bukkit.block.Biome; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.LivingEntity; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; +import java.util.List; +import java.util.Set; /** * These behaviour classes are a band-aid fix for a larger problem @@ -13,7 +26,105 @@ public class FishingBehaviour { private final mcMMO pluginRef; + private final long fishingRodCastCdMilliseconds; + private final int overfishLimit; + private final double boundingBoxSize; + private HashMap> enchantableCache = new HashMap<>(); + private HashMap fishingXpRewardMap; + private Set masterAnglerBiomes = BiomeAdapter.WATER_BIOMES; + private Set iceFishingBiomes = BiomeAdapter.ICE_BIOMES; + public FishingBehaviour(mcMMO pluginRef) { this.pluginRef = pluginRef; + + overfishLimit = pluginRef.getConfigManager().getConfigExploitPrevention().getOverfishingLimit() + 1; + fishingRodCastCdMilliseconds = pluginRef.getConfigManager().getConfigExploitPrevention().getFishingRodSpamMilliseconds(); + boundingBoxSize = pluginRef.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize(); + initFishingXPRewardMap(); + } + + /** + * Inits the Fishing Catch -> XP Reward map + */ + private void initFishingXPRewardMap() { + fishingXpRewardMap = new HashMap<>(); + HashMap nameRegisterMap = pluginRef.getConfigManager().getConfigExperience().getFishingXPMap(); + + for (String qualifiedName : nameRegisterMap.keySet()) { + Material material = Material.matchMaterial(qualifiedName); + + if (material == null) { + pluginRef.getLogger().info("Unable to match qualified name to item for fishing xp map: " + qualifiedName); + continue; + } + + fishingXpRewardMap.putIfAbsent(material, nameRegisterMap.get(qualifiedName)); + } + } + + /** + * Finds the possible drops of an entity + * + * @param target Targeted entity + * @return possibleDrops List of ItemStack that can be dropped + */ + public List findPossibleDrops(LivingEntity target) { + if (FishingTreasureConfig.getInstance().shakeMap.containsKey(target.getType())) + return FishingTreasureConfig.getInstance().shakeMap.get(target.getType()); + + return null; + } + + /** + * Randomly chooses a drop among the list + * + * @param possibleDrops List of ItemStack that can be dropped + * @return Chosen ItemStack + */ + public ItemStack chooseDrop(List possibleDrops) { + int dropProbability = Misc.getRandom().nextInt(100); + double cumulatedProbability = 0; + + for (ShakeTreasure treasure : possibleDrops) { + cumulatedProbability += treasure.getDropChance(); + + if (dropProbability < cumulatedProbability) { + return treasure.getDrop().clone(); + } + } + + return null; + } + + public HashMap> getEnchantableCache() { + return enchantableCache; + } + + public HashMap getFishingXpRewardMap() { + return fishingXpRewardMap; + } + + public Set getMasterAnglerBiomes() { + return masterAnglerBiomes; + } + + public Set getIceFishingBiomes() { + return iceFishingBiomes; + } + + public int getFishXPValue(Material material) { + return fishingXpRewardMap.get(material); + } + + public long getFishingRodCastCdMilliseconds() { + return fishingRodCastCdMilliseconds; + } + + public int getOverfishLimit() { + return overfishLimit; + } + + public double getBoundingBoxSize() { + return boundingBoxSize; } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java index 8e86194a7..f216b1847 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java @@ -33,7 +33,7 @@ public class HerbalismBehaviour { * @param blockState The {@link BlockState} to check ability activation for * @return true if the ability was successful, false otherwise */ - protected boolean convertGreenTerraBlocks(BlockState blockState) { + public boolean convertGreenTerraBlocks(BlockState blockState) { switch (blockState.getType()) { case COBBLESTONE_WALL: blockState.setType(Material.MOSSY_COBBLESTONE_WALL); @@ -96,7 +96,7 @@ public class HerbalismBehaviour { * @param blockState The {@link BlockState} of the bottom block of the plant * @return the number of bonus drops to award from the blocks in this plant */ - protected int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { + public int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { Block block = blockState.getBlock(); Material blockType = blockState.getType(); int dropAmount = 0; @@ -152,7 +152,7 @@ public class HerbalismBehaviour { * @param blockState The {@link BlockState} of the bottom block of the plant * @return the number of bonus drops to award from the blocks in this plant */ - protected int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { + public int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { Block block = blockState.getBlock(); int kelpMaxHeight = 255; @@ -198,7 +198,7 @@ public class HerbalismBehaviour { * @param blockState The {@link BlockState} to check ability activation for * @return true if the ability was successful, false otherwise */ - protected boolean convertShroomThumb(BlockState blockState) { + public boolean convertShroomThumb(BlockState blockState) { switch (blockState.getType()) { case DIRT: case GRASS_BLOCK: diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java deleted file mode 100644 index f8eccdf60..000000000 --- a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.gmail.nossr50.skills.excavation; - -import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig; -import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; -import com.gmail.nossr50.util.StringUtils; -import org.bukkit.block.BlockState; - -import java.util.ArrayList; -import java.util.List; - -public class Excavation { - /** - * Get the list of possible {@link ExcavationTreasure|ExcavationTreasures} obtained from a given block. - * - * @param blockState The {@link BlockState} of the block to check. - * @return the list of treasures that could be found - */ - protected static List getTreasures(BlockState blockState) { - String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData()); - if (ExcavationTreasureConfig.getInstance().excavationMap.containsKey(friendly)) - return ExcavationTreasureConfig.getInstance().excavationMap.get(friendly); - return new ArrayList<>(); - } - - protected static int getBlockXP(BlockState blockState) { - int xp = pluginRef.getDynamicSettingsManager().getExperienceManager().getExcavationXp(blockState.getType()); - - return xp; - } -} diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java b/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java index 0d1b9d184..7962bf68e 100644 --- a/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java +++ b/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.datatypes.skills.behaviours.ExcavationBehaviour; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.SkillManager; @@ -21,8 +22,12 @@ import org.bukkit.entity.Player; import java.util.List; public class ExcavationManager extends SkillManager { + + private final ExcavationBehaviour excavationBehaviour; + public ExcavationManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) { super(pluginRef, mcMMOPlayer, PrimarySkillType.EXCAVATION); + this.excavationBehaviour = pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getExcavationBehaviour(); } /** @@ -31,10 +36,10 @@ public class ExcavationManager extends SkillManager { * @param blockState The {@link BlockState} to check ability activation for */ public void excavationBlockCheck(BlockState blockState) { - int xp = Excavation.getBlockXP(blockState); + int xp = excavationBehaviour.getBlockXP(blockState); if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) { - List treasures = Excavation.getTreasures(blockState); + List treasures = excavationBehaviour.getTreasures(blockState); if (!treasures.isEmpty()) { int skillLevel = getSkillLevel(); @@ -75,7 +80,7 @@ public class ExcavationManager extends SkillManager { public void printExcavationDebug(Player player, BlockState blockState) { if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) { - List treasures = Excavation.getTreasures(blockState); + List treasures = excavationBehaviour.getTreasures(blockState); if (!treasures.isEmpty()) { for (ExcavationTreasure treasure : treasures) { diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java deleted file mode 100644 index 5ece33972..000000000 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.gmail.nossr50.skills.fishing; - -import com.gmail.nossr50.config.treasure.FishingTreasureConfig; -import com.gmail.nossr50.datatypes.treasure.ShakeTreasure; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.adapter.BiomeAdapter; -import org.bukkit.Material; -import org.bukkit.block.Biome; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.inventory.ItemStack; - -import java.util.HashMap; -import java.util.List; -import java.util.Set; - -public final class Fishing { - - public static Fishing instance; - private final long fishingRodCastCdMilliseconds; - private final int overfishLimit; - private final double boundingBoxSize; - private HashMap> enchantableCache = new HashMap<>(); - private HashMap fishingXpRewardMap; - private Set masterAnglerBiomes = BiomeAdapter.WATER_BIOMES; - private Set iceFishingBiomes = BiomeAdapter.ICE_BIOMES; - - public Fishing() { - overfishLimit = pluginRef.getConfigManager().getConfigExploitPrevention().getOverfishingLimit() + 1; - fishingRodCastCdMilliseconds = pluginRef.getConfigManager().getConfigExploitPrevention().getFishingRodSpamMilliseconds(); - boundingBoxSize = pluginRef.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize(); - initFishingXPRewardMap(); - } - - public static Fishing getInstance() { - if (instance == null) - instance = new Fishing(); - - return instance; - } - - /** - * Inits the Fishing Catch -> XP Reward map - */ - private void initFishingXPRewardMap() { - fishingXpRewardMap = new HashMap<>(); - HashMap nameRegisterMap = pluginRef.getConfigManager().getConfigExperience().getFishingXPMap(); - - for (String qualifiedName : nameRegisterMap.keySet()) { - Material material = Material.matchMaterial(qualifiedName); - - if (material == null) { - pluginRef.getLogger().info("Unable to match qualified name to item for fishing xp map: " + qualifiedName); - continue; - } - - fishingXpRewardMap.putIfAbsent(material, nameRegisterMap.get(qualifiedName)); - } - } - - /** - * Finds the possible drops of an entity - * - * @param target Targeted entity - * @return possibleDrops List of ItemStack that can be dropped - */ - public List findPossibleDrops(LivingEntity target) { - if (FishingTreasureConfig.getInstance().shakeMap.containsKey(target.getType())) - return FishingTreasureConfig.getInstance().shakeMap.get(target.getType()); - - return null; - } - - /** - * Randomly chooses a drop among the list - * - * @param possibleDrops List of ItemStack that can be dropped - * @return Chosen ItemStack - */ - public ItemStack chooseDrop(List possibleDrops) { - int dropProbability = Misc.getRandom().nextInt(100); - double cumulatedProbability = 0; - - for (ShakeTreasure treasure : possibleDrops) { - cumulatedProbability += treasure.getDropChance(); - - if (dropProbability < cumulatedProbability) { - return treasure.getDrop().clone(); - } - } - - return null; - } - - public HashMap> getEnchantableCache() { - return enchantableCache; - } - - public HashMap getFishingXpRewardMap() { - return fishingXpRewardMap; - } - - public Set getMasterAnglerBiomes() { - return masterAnglerBiomes; - } - - public Set getIceFishingBiomes() { - return iceFishingBiomes; - } - - public int getFishXPValue(Material material) { - return fishingXpRewardMap.get(material); - } - - public long getFishingRodCastCdMilliseconds() { - return fishingRodCastCdMilliseconds; - } - - public int getOverfishLimit() { - return overfishLimit; - } - - public double getBoundingBoxSize() { - return boundingBoxSize; - } -} diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 1a1c3c659..23ccd4885 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.datatypes.skills.behaviours.FishingBehaviour; import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure; import com.gmail.nossr50.datatypes.treasure.FishingTreasure; import com.gmail.nossr50.datatypes.treasure.Rarity; @@ -57,9 +58,11 @@ public class FishingManager extends SkillManager { private Location hookLocation; private int fishCaughtCounter; private int overFishCount; + private FishingBehaviour fishingBehaviour; public FishingManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) { super(pluginRef, mcMMOPlayer, PrimarySkillType.FISHING); + fishingBehaviour = pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getFishingBehaviour(); fishCaughtCounter = 1; } @@ -78,7 +81,7 @@ public class FishingManager extends SkillManager { if (currentTime > fishHookSpawnTimestamp + 1000) return; - if (currentTime < fishingRodCastTimestamp + Fishing.getInstance().getFishingRodCastCdMilliseconds()) { + if (currentTime < fishingRodCastTimestamp + fishingBehaviour.getFishingRodCastCdMilliseconds()) { getPlayer().setFoodLevel(Math.max(getPlayer().getFoodLevel() - 1, 0)); getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5)); getPlayer().updateInventory(); @@ -123,7 +126,7 @@ public class FishingManager extends SkillManager { return false; }*/ - int overfishLimit = Fishing.getInstance().getOverfishLimit(); + int overfishLimit = fishingBehaviour.getOverfishLimit(); BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector); @@ -159,7 +162,7 @@ public class FishingManager extends SkillManager { } public BoundingBox makeBoundingBox(Vector centerOfCastVector) { - double boundingBoxSize = Fishing.getInstance().getBoundingBoxSize(); + double boundingBoxSize = fishingBehaviour.getBoundingBoxSize(); return BoundingBox.of(centerOfCastVector, boundingBoxSize, boundingBoxSize, boundingBoxSize); } @@ -177,7 +180,7 @@ public class FishingManager extends SkillManager { } // Make sure this is a body of water, not just a block of ice. - if (!Fishing.getInstance().getIceFishingBiomes().contains(block.getBiome()) && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.WATER)) { + if (!fishingBehaviour.getIceFishingBiomes().contains(block.getBiome()) && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.WATER)) { return false; } @@ -251,7 +254,7 @@ public class FishingManager extends SkillManager { hookLocation = location; - if (Fishing.getInstance().getMasterAnglerBiomes().contains(location.getBlock().getBiome())) { + if (fishingBehaviour.getMasterAnglerBiomes().contains(location.getBlock().getBiome())) { biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier(); } @@ -274,7 +277,7 @@ public class FishingManager extends SkillManager { * @param fishingCatch The {@link Item} initially caught */ public void handleFishing(Item fishingCatch) { - int fishXp = Fishing.getInstance().getFishXPValue(fishingCatch.getItemStack().getType()); + int fishXp = fishingBehaviour.getFishXPValue(fishingCatch.getItemStack().getType()); int treasureXp = 0; Player player = getPlayer(); FishingTreasure treasure = null; @@ -349,13 +352,13 @@ public class FishingManager extends SkillManager { */ public void shakeCheck(LivingEntity target) { if (RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getShakeChance(), getPlayer(), SubSkillType.FISHING_SHAKE))) { - List possibleDrops = Fishing.getInstance().findPossibleDrops(target); + List possibleDrops = fishingBehaviour.findPossibleDrops(target); if (possibleDrops == null || possibleDrops.isEmpty()) { return; } - ItemStack drop = Fishing.getInstance().chooseDrop(possibleDrops); + ItemStack drop = fishingBehaviour.chooseDrop(possibleDrops); // It's possible that chooseDrop returns null if the sum of probability in possibleDrops is inferior than 100 if (drop == null) { @@ -565,8 +568,8 @@ public class FishingManager extends SkillManager { private List getPossibleEnchantments(ItemStack treasureDrop) { Material dropType = treasureDrop.getType(); - if (Fishing.getInstance().getEnchantableCache().containsKey(dropType)) { - return Fishing.getInstance().getEnchantableCache().get(dropType); + if (fishingBehaviour.getEnchantableCache().containsKey(dropType)) { + return fishingBehaviour.getEnchantableCache().get(dropType); } List possibleEnchantments = new ArrayList<>(); @@ -577,7 +580,7 @@ public class FishingManager extends SkillManager { } } - Fishing.getInstance().getEnchantableCache().put(dropType, possibleEnchantments); + fishingBehaviour.getEnchantableCache().put(dropType, possibleEnchantments); return possibleEnchantments; } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 1f85d9a98..bf3635c16 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -22,8 +22,6 @@ import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.data.Ageable; import org.bukkit.entity.Player; @@ -31,7 +29,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.metadata.FixedMetadataValue; -import java.util.HashSet; import java.util.List; public class HerbalismManager extends SkillManager { @@ -40,6 +37,7 @@ public class HerbalismManager extends SkillManager { public HerbalismManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) { super(pluginRef, mcMMOPlayer, PrimarySkillType.HERBALISM); + herbalismBehaviour = pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getHerbalismBehaviour(); } public boolean canBlockCheck() { @@ -120,7 +118,7 @@ public class HerbalismManager extends SkillManager { playerInventory.removeItem(seed); player.updateInventory(); // Needed until replacement available - return convertGreenTerraBlocks(blockState); + return herbalismBehaviour.convertGreenTerraBlocks(blockState); } /** @@ -158,9 +156,9 @@ public class HerbalismManager extends SkillManager { if (!oneBlockPlant) { //Kelp is actually two blocks mixed together if (material == Material.KELP_PLANT || material == Material.KELP) { - amount = countAndMarkDoubleDropsKelp(blockState, greenTerra, this); + amount = herbalismBehaviour.countAndMarkDoubleDropsKelp(blockState, greenTerra, this); } else { - amount = countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this); + amount = herbalismBehaviour.countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this); } xp *= amount; @@ -204,7 +202,7 @@ public class HerbalismManager extends SkillManager { return false; } - return convertGreenTerraBlocks(blockState); + return herbalismBehaviour.convertGreenTerraBlocks(blockState); } /** @@ -275,7 +273,7 @@ public class HerbalismManager extends SkillManager { return false; } - return convertShroomThumb(blockState); + return herbalismBehaviour.convertShroomThumb(blockState); } /**