Skill Behaviour Managers

This commit is contained in:
nossr50 2019-07-03 02:14:56 -07:00
parent cf46ec7498
commit b756938fb1
21 changed files with 429 additions and 21 deletions

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.core;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.behaviours.SkillBehaviourManager;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableManager; import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
@ -41,6 +42,11 @@ public class DynamicSettingsManager {
private HashMap<Material, Integer> partyItemWeights; private HashMap<Material, Integer> partyItemWeights;
private HashMap<PartyFeature, Integer> partyFeatureUnlocks; private HashMap<PartyFeature, Integer> partyFeatureUnlocks;
/* Skill Behaviours */
private SkillBehaviourManager skillBehaviourManager;
//TODO: This class is a band-aid fix for a large problem with mcMMO code, they will be removed once the new skill system is in place
public DynamicSettingsManager(mcMMO pluginRef) { public DynamicSettingsManager(mcMMO pluginRef) {
this.pluginRef = pluginRef; this.pluginRef = pluginRef;
/* /*
@ -70,12 +76,14 @@ public class DynamicSettingsManager {
* Misc managers * Misc managers
*/ */
private void initMiscManagers() { private void initMiscManagers() {
//Init Skill Behaviour Manager
skillBehaviourManager = new SkillBehaviourManager(pluginRef);
experienceManager = new ExperienceManager(pluginRef); experienceManager = new ExperienceManager(pluginRef);
//Set the global XP val //Set the global XP val
experienceManager.setGlobalXpMult(pluginRef.getConfigManager().getConfigExperience().getGlobalXPMultiplier()); experienceManager.setGlobalXpMult(pluginRef.getConfigManager().getConfigExperience().getGlobalXPMultiplier());
experienceManager.buildBlockXPMaps(); //Block XP value maps experienceManager.buildBlockXPMaps(); //Block XP value maps
experienceManager.fillCombatXPMultiplierMap(pluginRef.getConfigManager().getConfigExperience().getCombatExperienceMap()); experienceManager.fillCombatXPMultiplierMap(pluginRef.getConfigManager().getConfigExperience().getCombatExperienceMap());
// potionManager = new PotionManager();
} }
/** /**

View File

@ -0,0 +1,18 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class AcrobaticsBehaviour {
private final mcMMO pluginRef;
public AcrobaticsBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,20 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class AlchemyBehaviour {
private final mcMMO pluginRef;
public AlchemyBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class ArcheryBehaviour {
private final mcMMO pluginRef;
public ArcheryBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class AxesBehaviour {
private final mcMMO pluginRef;
public AxesBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class ExcavationBehaviour {
private final mcMMO pluginRef;
public ExcavationBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class FishingBehaviour {
private final mcMMO pluginRef;
public FishingBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.skills.herbalism; package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.core.MetadataConstants; import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material; import org.bukkit.Material;
@ -10,7 +12,20 @@ import org.bukkit.block.BlockState;
import java.util.HashSet; import java.util.HashSet;
public class Herbalism { /**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class HerbalismBehaviour {
private final mcMMO pluginRef;
public HerbalismBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
/** /**
* Convert blocks affected by the Green Thumb & Green Terra abilities. * Convert blocks affected by the Green Thumb & Green Terra abilities.
@ -18,7 +33,7 @@ public class Herbalism {
* @param blockState The {@link BlockState} to check ability activation for * @param blockState The {@link BlockState} to check ability activation for
* @return true if the ability was successful, false otherwise * @return true if the ability was successful, false otherwise
*/ */
protected static boolean convertGreenTerraBlocks(BlockState blockState) { protected boolean convertGreenTerraBlocks(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case COBBLESTONE_WALL: case COBBLESTONE_WALL:
blockState.setType(Material.MOSSY_COBBLESTONE_WALL); blockState.setType(Material.MOSSY_COBBLESTONE_WALL);
@ -42,11 +57,11 @@ public class Herbalism {
} }
} }
private static int calculateChorusPlantDrops(Block target, boolean triple, HerbalismManager herbalismManager) { private int calculateChorusPlantDrops(Block target, boolean triple, HerbalismManager herbalismManager) {
return calculateChorusPlantDropsRecursive(target, new HashSet<>(), triple, herbalismManager); return calculateChorusPlantDropsRecursive(target, new HashSet<>(), triple, herbalismManager);
} }
private static int calculateChorusPlantDropsRecursive(Block target, HashSet<Block> traversed, boolean triple, HerbalismManager herbalismManager) { private int calculateChorusPlantDropsRecursive(Block target, HashSet<Block> traversed, boolean triple, HerbalismManager herbalismManager) {
if (target.getType() != Material.CHORUS_PLANT) if (target.getType() != Material.CHORUS_PLANT)
return 0; return 0;
@ -81,7 +96,7 @@ public class Herbalism {
* @param blockState The {@link BlockState} of the bottom block of the plant * @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 * @return the number of bonus drops to award from the blocks in this plant
*/ */
protected static int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { protected int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) {
Block block = blockState.getBlock(); Block block = blockState.getBlock();
Material blockType = blockState.getType(); Material blockType = blockState.getType();
int dropAmount = 0; int dropAmount = 0;
@ -137,7 +152,7 @@ public class Herbalism {
* @param blockState The {@link BlockState} of the bottom block of the plant * @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 * @return the number of bonus drops to award from the blocks in this plant
*/ */
protected static int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { protected int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) {
Block block = blockState.getBlock(); Block block = blockState.getBlock();
int kelpMaxHeight = 255; int kelpMaxHeight = 255;
@ -160,7 +175,7 @@ public class Herbalism {
return amount; return amount;
} }
private static int addKelpDrops(int dropAmount, Block relativeBlock) { private int addKelpDrops(int dropAmount, Block relativeBlock) {
if (isKelp(relativeBlock) && !pluginRef.getPlaceStore().isTrue(relativeBlock)) { if (isKelp(relativeBlock) && !pluginRef.getPlaceStore().isTrue(relativeBlock)) {
dropAmount++; dropAmount++;
} else { } else {
@ -170,7 +185,7 @@ public class Herbalism {
return dropAmount; return dropAmount;
} }
private static boolean isKelp(Block relativeBlock) { private boolean isKelp(Block relativeBlock) {
Material kelptype_1 = Material.KELP_PLANT; Material kelptype_1 = Material.KELP_PLANT;
Material kelptype_2 = Material.KELP; Material kelptype_2 = Material.KELP;
@ -183,7 +198,7 @@ public class Herbalism {
* @param blockState The {@link BlockState} to check ability activation for * @param blockState The {@link BlockState} to check ability activation for
* @return true if the ability was successful, false otherwise * @return true if the ability was successful, false otherwise
*/ */
protected static boolean convertShroomThumb(BlockState blockState) { protected boolean convertShroomThumb(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case DIRT: case DIRT:
case GRASS_BLOCK: case GRASS_BLOCK:
@ -202,7 +217,7 @@ public class Herbalism {
* @param blockState The {@link BlockState} to check green thumb regrown for * @param blockState The {@link BlockState} to check green thumb regrown for
* @return true if the block is recently regrown, false otherwise * @return true if the block is recently regrown, false otherwise
*/ */
public static boolean isRecentlyRegrown(BlockState blockState) { public boolean isRecentlyRegrown(BlockState blockState) {
return blockState.hasMetadata(MetadataConstants.GREEN_THUMB_METAKEY) && !SkillUtils.cooldownExpired(blockState.getMetadata(MetadataConstants.GREEN_THUMB_METAKEY).get(0).asInt(), 1); return blockState.hasMetadata(MetadataConstants.GREEN_THUMB_METAKEY) && !SkillUtils.cooldownExpired(blockState.getMetadata(MetadataConstants.GREEN_THUMB_METAKEY).get(0).asInt(), 1);
} }
} }

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class MiningBehaviour {
private final mcMMO pluginRef;
public MiningBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,20 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class RepairBehaviour {
private final mcMMO pluginRef;
public RepairBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class SalvageBehaviour {
private final mcMMO pluginRef;
public SalvageBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,110 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class SkillBehaviourManager {
private final mcMMO pluginRef;
private final AcrobaticsBehaviour acrobaticsBehaviour;
private final AlchemyBehaviour alchemyBehaviour;
private final ArcheryBehaviour archeryBehaviour;
private final AxesBehaviour axesBehaviour;
private final ExcavationBehaviour excavationBehaviour;
private final FishingBehaviour fishingBehaviour;
private final HerbalismBehaviour herbalismBehaviour;
private final MiningBehaviour miningBehaviour;
private final RepairBehaviour repairBehaviour;
private final SalvageBehaviour salvageBehaviour;
private final SmeltingBehaviour smeltingBehaviour;
private final SwordsBehaviour swordsBehaviour;
private final TamingBehaviour tamingBehaviour;
private final UnarmedBehaviour unarmedBehaviour;
private final WoodcuttingBehaviour woodcuttingBehaviour;
public SkillBehaviourManager(mcMMO pluginRef) {
this.pluginRef = pluginRef;
acrobaticsBehaviour = new AcrobaticsBehaviour(pluginRef);
alchemyBehaviour = new AlchemyBehaviour(pluginRef);
archeryBehaviour = new ArcheryBehaviour(pluginRef);
axesBehaviour = new AxesBehaviour(pluginRef);
excavationBehaviour = new ExcavationBehaviour(pluginRef);
fishingBehaviour = new FishingBehaviour(pluginRef);
herbalismBehaviour = new HerbalismBehaviour(pluginRef);
miningBehaviour = new MiningBehaviour(pluginRef);
repairBehaviour = new RepairBehaviour(pluginRef);
salvageBehaviour = new SalvageBehaviour(pluginRef);
smeltingBehaviour = new SmeltingBehaviour(pluginRef);
swordsBehaviour = new SwordsBehaviour(pluginRef);
tamingBehaviour = new TamingBehaviour(pluginRef);
unarmedBehaviour = new UnarmedBehaviour(pluginRef);
woodcuttingBehaviour = new WoodcuttingBehaviour(pluginRef);
}
public AcrobaticsBehaviour getAcrobaticsBehaviour() {
return acrobaticsBehaviour;
}
public AlchemyBehaviour getAlchemyBehaviour() {
return alchemyBehaviour;
}
public ArcheryBehaviour getArcheryBehaviour() {
return archeryBehaviour;
}
public AxesBehaviour getAxesBehaviour() {
return axesBehaviour;
}
public ExcavationBehaviour getExcavationBehaviour() {
return excavationBehaviour;
}
public FishingBehaviour getFishingBehaviour() {
return fishingBehaviour;
}
public HerbalismBehaviour getHerbalismBehaviour() {
return herbalismBehaviour;
}
public MiningBehaviour getMiningBehaviour() {
return miningBehaviour;
}
public RepairBehaviour getRepairBehaviour() {
return repairBehaviour;
}
public SalvageBehaviour getSalvageBehaviour() {
return salvageBehaviour;
}
public SmeltingBehaviour getSmeltingBehaviour() {
return smeltingBehaviour;
}
public SwordsBehaviour getSwordsBehaviour() {
return swordsBehaviour;
}
public TamingBehaviour getTamingBehaviour() {
return tamingBehaviour;
}
public UnarmedBehaviour getUnarmedBehaviour() {
return unarmedBehaviour;
}
public WoodcuttingBehaviour getWoodcuttingBehaviour() {
return woodcuttingBehaviour;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class SmeltingBehaviour {
private final mcMMO pluginRef;
public SmeltingBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class SwordsBehaviour {
private final mcMMO pluginRef;
public SwordsBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,20 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class TamingBehaviour {
private final mcMMO pluginRef;
public TamingBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class UnarmedBehaviour {
private final mcMMO pluginRef;
public UnarmedBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -0,0 +1,20 @@
package com.gmail.nossr50.datatypes.skills.behaviours;
import com.gmail.nossr50.mcMMO;
/**
* These behaviour classes are a band-aid fix for a larger problem
* Until the new skill system for mcMMO is finished/implemented, there is no good place to store the hardcoded behaviours for each skill
* These behaviour classes server this purpose, they act as a bad solution to a bad problem
* These classes will be removed when the new skill system is in place
*/
@Deprecated
public class WoodcuttingBehaviour {
private final mcMMO pluginRef;
public WoodcuttingBehaviour(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@ -24,8 +24,8 @@ public class CleanBackupFilesTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
List<Integer> savedDays = new ArrayList<>(); List<Integer> savedDays = new ArrayList<>(); //TODO: Should probably look into why this isn't used...
HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<>(); HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<>(); //TODO: Should probably look into why this isn't used...
List<File> toDelete = new ArrayList<>(); List<File> toDelete = new ArrayList<>();
int amountTotal = 0; int amountTotal = 0;
int amountDeleted = 0; int amountDeleted = 0;

View File

@ -133,7 +133,7 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability * @param target The {@link LivingEntity} being affected by the ability
*/ */
public double greaterImpact(LivingEntity target) { public double greaterImpact(LivingEntity target) {
//static chance (3rd param) //chance (3rd param)
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) { if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) {
return 0; return 0;
} }

View File

@ -49,7 +49,7 @@ public class FishingManager extends SkillManager {
private long fishHookSpawnTimestamp; private long fishHookSpawnTimestamp;
private long lastWarned; private long lastWarned;
private long lastWarnedExhaust; private long lastWarnedExhaust;
public static final int FISHING_ROD_CAST_CD_MILLISECONDS = 100; public final int FISHING_ROD_CAST_CD_MILLISECONDS = 100;
private final long FISHING_COOLDOWN_SECONDS = 1000L; private final long FISHING_COOLDOWN_SECONDS = 1000L;
private FishHook fishHookReference; private FishHook fishHookReference;

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.datatypes.skills.behaviours.HerbalismBehaviour;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure; import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask; import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
@ -21,6 +22,8 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.data.Ageable; import org.bukkit.block.data.Ageable;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -28,10 +31,13 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import java.util.HashSet;
import java.util.List; import java.util.List;
public class HerbalismManager extends SkillManager { public class HerbalismManager extends SkillManager {
private final HerbalismBehaviour herbalismBehaviour;
public HerbalismManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) { public HerbalismManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.HERBALISM); super(pluginRef, mcMMOPlayer, PrimarySkillType.HERBALISM);
} }
@ -114,7 +120,7 @@ public class HerbalismManager extends SkillManager {
playerInventory.removeItem(seed); playerInventory.removeItem(seed);
player.updateInventory(); // Needed until replacement available player.updateInventory(); // Needed until replacement available
return Herbalism.convertGreenTerraBlocks(blockState); return convertGreenTerraBlocks(blockState);
} }
/** /**
@ -152,9 +158,9 @@ public class HerbalismManager extends SkillManager {
if (!oneBlockPlant) { if (!oneBlockPlant) {
//Kelp is actually two blocks mixed together //Kelp is actually two blocks mixed together
if (material == Material.KELP_PLANT || material == Material.KELP) { if (material == Material.KELP_PLANT || material == Material.KELP) {
amount = Herbalism.countAndMarkDoubleDropsKelp(blockState, greenTerra, this); amount = countAndMarkDoubleDropsKelp(blockState, greenTerra, this);
} else { } else {
amount = Herbalism.countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this); amount = countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this);
} }
xp *= amount; xp *= amount;
@ -198,7 +204,7 @@ public class HerbalismManager extends SkillManager {
return false; return false;
} }
return Herbalism.convertGreenTerraBlocks(blockState); return convertGreenTerraBlocks(blockState);
} }
/** /**
@ -269,7 +275,7 @@ public class HerbalismManager extends SkillManager {
return false; return false;
} }
return Herbalism.convertShroomThumb(blockState); return convertShroomThumb(blockState);
} }
/** /**