From b756938fb1e92a07efbfbd489810dee1bfcfe24a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 3 Jul 2019 02:14:56 -0700 Subject: [PATCH] Skill Behaviour Managers --- .../nossr50/core/DynamicSettingsManager.java | 10 +- .../behaviours/AcrobaticsBehaviour.java | 18 +++ .../skills/behaviours/AlchemyBehaviour.java | 20 ++++ .../skills/behaviours/ArcheryBehaviour.java | 19 +++ .../skills/behaviours/AxesBehaviour.java | 19 +++ .../behaviours/ExcavationBehaviour.java | 19 +++ .../skills/behaviours/FishingBehaviour.java | 19 +++ .../behaviours/HerbalismBehaviour.java} | 37 ++++-- .../skills/behaviours/MiningBehaviour.java | 19 +++ .../skills/behaviours/RepairBehaviour.java | 20 ++++ .../skills/behaviours/SalvageBehaviour.java | 19 +++ .../behaviours/SkillBehaviourManager.java | 110 ++++++++++++++++++ .../skills/behaviours/SmeltingBehaviour.java | 19 +++ .../skills/behaviours/SwordsBehaviour.java | 19 +++ .../skills/behaviours/TamingBehaviour.java | 20 ++++ .../skills/behaviours/UnarmedBehaviour.java | 19 +++ .../behaviours/WoodcuttingBehaviour.java | 20 ++++ .../backups/CleanBackupFilesTask.java | 4 +- .../nossr50/skills/axes/AxesManager.java | 2 +- .../skills/fishing/FishingManager.java | 2 +- .../skills/herbalism/HerbalismManager.java | 16 ++- 21 files changed, 429 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AcrobaticsBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AlchemyBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ArcheryBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AxesBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ExcavationBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/FishingBehaviour.java rename src/main/java/com/gmail/nossr50/{skills/herbalism/Herbalism.java => datatypes/skills/behaviours/HerbalismBehaviour.java} (80%) create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/MiningBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/RepairBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SalvageBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SkillBehaviourManager.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SmeltingBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SwordsBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/TamingBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/UnarmedBehaviour.java create mode 100644 src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/WoodcuttingBehaviour.java diff --git a/src/main/java/com/gmail/nossr50/core/DynamicSettingsManager.java b/src/main/java/com/gmail/nossr50/core/DynamicSettingsManager.java index 9eb7b1605..842252751 100644 --- a/src/main/java/com/gmail/nossr50/core/DynamicSettingsManager.java +++ b/src/main/java/com/gmail/nossr50/core/DynamicSettingsManager.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.core; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.datatypes.skills.behaviours.SkillBehaviourManager; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.RepairableManager; @@ -41,6 +42,11 @@ public class DynamicSettingsManager { private HashMap partyItemWeights; private HashMap 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) { this.pluginRef = pluginRef; /* @@ -70,12 +76,14 @@ public class DynamicSettingsManager { * Misc managers */ private void initMiscManagers() { + //Init Skill Behaviour Manager + skillBehaviourManager = new SkillBehaviourManager(pluginRef); + experienceManager = new ExperienceManager(pluginRef); //Set the global XP val experienceManager.setGlobalXpMult(pluginRef.getConfigManager().getConfigExperience().getGlobalXPMultiplier()); experienceManager.buildBlockXPMaps(); //Block XP value maps experienceManager.fillCombatXPMultiplierMap(pluginRef.getConfigManager().getConfigExperience().getCombatExperienceMap()); -// potionManager = new PotionManager(); } /** diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AcrobaticsBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AcrobaticsBehaviour.java new file mode 100644 index 000000000..b94fece06 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AcrobaticsBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AlchemyBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AlchemyBehaviour.java new file mode 100644 index 000000000..929082134 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AlchemyBehaviour.java @@ -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; + } + +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ArcheryBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ArcheryBehaviour.java new file mode 100644 index 000000000..f9da4c787 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ArcheryBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AxesBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AxesBehaviour.java new file mode 100644 index 000000000..a4e9e61d6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/AxesBehaviour.java @@ -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; + } +} 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 new file mode 100644 index 000000000..116a92ecc --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/ExcavationBehaviour.java @@ -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; + } +} 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 new file mode 100644 index 000000000..4520f9d7e --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/FishingBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java similarity index 80% rename from src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java rename to src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java index 4161a9ead..8e86194a7 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/HerbalismBehaviour.java @@ -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.mcMMO; +import com.gmail.nossr50.skills.herbalism.HerbalismManager; import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Material; @@ -10,7 +12,20 @@ import org.bukkit.block.BlockState; 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. @@ -18,7 +33,7 @@ public class Herbalism { * @param blockState The {@link BlockState} to check ability activation for * @return true if the ability was successful, false otherwise */ - protected static boolean convertGreenTerraBlocks(BlockState blockState) { + protected boolean convertGreenTerraBlocks(BlockState blockState) { switch (blockState.getType()) { case 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); } - private static int calculateChorusPlantDropsRecursive(Block target, HashSet traversed, boolean triple, HerbalismManager herbalismManager) { + private int calculateChorusPlantDropsRecursive(Block target, HashSet traversed, boolean triple, HerbalismManager herbalismManager) { if (target.getType() != Material.CHORUS_PLANT) return 0; @@ -81,7 +96,7 @@ public class Herbalism { * @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 static int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { + protected int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { Block block = blockState.getBlock(); Material blockType = blockState.getType(); int dropAmount = 0; @@ -137,7 +152,7 @@ public class Herbalism { * @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 static int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { + protected int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) { Block block = blockState.getBlock(); int kelpMaxHeight = 255; @@ -160,7 +175,7 @@ public class Herbalism { return amount; } - private static int addKelpDrops(int dropAmount, Block relativeBlock) { + private int addKelpDrops(int dropAmount, Block relativeBlock) { if (isKelp(relativeBlock) && !pluginRef.getPlaceStore().isTrue(relativeBlock)) { dropAmount++; } else { @@ -170,7 +185,7 @@ public class Herbalism { return dropAmount; } - private static boolean isKelp(Block relativeBlock) { + private boolean isKelp(Block relativeBlock) { Material kelptype_1 = Material.KELP_PLANT; Material kelptype_2 = Material.KELP; @@ -183,7 +198,7 @@ public class Herbalism { * @param blockState The {@link BlockState} to check ability activation for * @return true if the ability was successful, false otherwise */ - protected static boolean convertShroomThumb(BlockState blockState) { + protected boolean convertShroomThumb(BlockState blockState) { switch (blockState.getType()) { case DIRT: case GRASS_BLOCK: @@ -202,7 +217,7 @@ public class Herbalism { * @param blockState The {@link BlockState} to check green thumb regrown for * @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); } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/MiningBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/MiningBehaviour.java new file mode 100644 index 000000000..2d6be825b --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/MiningBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/RepairBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/RepairBehaviour.java new file mode 100644 index 000000000..a5664a495 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/RepairBehaviour.java @@ -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; + } + +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SalvageBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SalvageBehaviour.java new file mode 100644 index 000000000..e3df1c7eb --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SalvageBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SkillBehaviourManager.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SkillBehaviourManager.java new file mode 100644 index 000000000..64213d61d --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SkillBehaviourManager.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SmeltingBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SmeltingBehaviour.java new file mode 100644 index 000000000..15b1b3770 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SmeltingBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SwordsBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SwordsBehaviour.java new file mode 100644 index 000000000..b0f2bd7be --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/SwordsBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/TamingBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/TamingBehaviour.java new file mode 100644 index 000000000..17ac10293 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/TamingBehaviour.java @@ -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; + } + +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/UnarmedBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/UnarmedBehaviour.java new file mode 100644 index 000000000..1b97bff73 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/UnarmedBehaviour.java @@ -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; + } +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/WoodcuttingBehaviour.java b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/WoodcuttingBehaviour.java new file mode 100644 index 000000000..74f4dc3f6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/behaviours/WoodcuttingBehaviour.java @@ -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; + } + +} diff --git a/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupFilesTask.java b/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupFilesTask.java index 5b9cac5f6..bba98d044 100644 --- a/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupFilesTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupFilesTask.java @@ -24,8 +24,8 @@ public class CleanBackupFilesTask extends BukkitRunnable { @Override public void run() { - List savedDays = new ArrayList<>(); - HashMap> savedYearsWeeks = new HashMap<>(); + List savedDays = new ArrayList<>(); //TODO: Should probably look into why this isn't used... + HashMap> savedYearsWeeks = new HashMap<>(); //TODO: Should probably look into why this isn't used... List toDelete = new ArrayList<>(); int amountTotal = 0; int amountDeleted = 0; diff --git a/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java b/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java index 8dc658a37..95b6dd29f 100644 --- a/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java +++ b/src/main/java/com/gmail/nossr50/skills/axes/AxesManager.java @@ -133,7 +133,7 @@ public class AxesManager extends SkillManager { * @param target The {@link LivingEntity} being affected by the ability */ public double greaterImpact(LivingEntity target) { - //static chance (3rd param) + //chance (3rd param) if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) { return 0; } 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 a55db9077..1a1c3c659 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -49,7 +49,7 @@ public class FishingManager extends SkillManager { private long fishHookSpawnTimestamp; private long lastWarned; 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 FishHook fishHookReference; 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 6c1015229..1f85d9a98 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; 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.mcMMO; 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 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; @@ -28,10 +31,13 @@ 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 { + private final HerbalismBehaviour herbalismBehaviour; + public HerbalismManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) { super(pluginRef, mcMMOPlayer, PrimarySkillType.HERBALISM); } @@ -114,7 +120,7 @@ public class HerbalismManager extends SkillManager { playerInventory.removeItem(seed); player.updateInventory(); // Needed until replacement available - return Herbalism.convertGreenTerraBlocks(blockState); + return convertGreenTerraBlocks(blockState); } /** @@ -152,9 +158,9 @@ public class HerbalismManager extends SkillManager { if (!oneBlockPlant) { //Kelp is actually two blocks mixed together if (material == Material.KELP_PLANT || material == Material.KELP) { - amount = Herbalism.countAndMarkDoubleDropsKelp(blockState, greenTerra, this); + amount = countAndMarkDoubleDropsKelp(blockState, greenTerra, this); } else { - amount = Herbalism.countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this); + amount = countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this); } xp *= amount; @@ -198,7 +204,7 @@ public class HerbalismManager extends SkillManager { return false; } - return Herbalism.convertGreenTerraBlocks(blockState); + return convertGreenTerraBlocks(blockState); } /** @@ -269,7 +275,7 @@ public class HerbalismManager extends SkillManager { return false; } - return Herbalism.convertShroomThumb(blockState); + return convertShroomThumb(blockState); } /**