Part 1 of reworking ability tools

This commit is contained in:
nossr50 2020-08-01 14:42:38 -07:00
parent 916a747f88
commit d80c275abb
19 changed files with 119 additions and 149 deletions

View File

@ -20,7 +20,7 @@ public class McrefreshCommand extends ToggleCommand {
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) { protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.setRecentlyHurt(0); mcMMOPlayer.setRecentlyHurt(0);
mcMMOPlayer.resetCooldowns(); mcMMOPlayer.resetCooldowns();
mcMMOPlayer.getSuperAbilityManager().resetToolPrepMode(); mcMMOPlayer.getSuperAbilityManager().unprimeAllAbilityTools();
mcMMOPlayer.getSuperAbilityManager().resetSuperAbilities(); mcMMOPlayer.getSuperAbilityManager().resetSuperAbilities();
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Ability.Generic.Refresh")); mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));

View File

@ -225,7 +225,7 @@ public abstract class SkillCommand implements TabExecutor {
} }
protected String[] calculateLengthDisplayValues(Player player, float skillValue) { protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
int maxLength = skill.getAbility().getMaxLength(); int maxLength = skill.getSuperAbilityType().getMaxLength();
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();

View File

@ -0,0 +1,30 @@
package com.gmail.nossr50.datatypes.skills;
public enum AbilityToolType {
SKULL_SPLITTER_TOOL("Axes.Ability.Lower", "Axes.Ability.Ready"),
BERSERK_TOOL( "Unarmed.Ability.Lower", "Unarmed.Ability.Ready"),
GREEN_TERRA_TOOL("Herbalism.Ability.Lower", "Herbalism.Ability.Ready"),
SUPER_BREAKER_TOOL("Mining.Ability.Lower", "Mining.Ability.Ready"),
GIGA_DRILL_BREAKER_TOOL("Excavation.Ability.Lower", "Excavation.Ability.Ready"),
SERRATED_STRIKES_TOOL("Swords.Ability.Lower", "Swords.Ability.Ready"),
TREE_FELLER_TOOL("Axes.Ability.Lower", "Axes.Ability.Ready"),
ARCHERY_TOOL("Archery.Ability.Lower", "Archery.Ability.Ready"),
SUPER_SHOTGUN_TOOL("Crossbows.Ability.Lower", "Crossbows.Ability.Ready"),
TRIDENTS_TOOL("Tridents.Ability.Lower", "Tridents.Ability.Ready");
private final String lowerToolLocaleKey;
private final String raiseToolLocaleKey;
AbilityToolType(String lowerToolLocaleKey, String raiseToolLocaleKey) {
this.lowerToolLocaleKey = lowerToolLocaleKey;
this.raiseToolLocaleKey = raiseToolLocaleKey;
}
public String getLowerToolLocaleKey() {
return lowerToolLocaleKey;
}
public String getRaiseToolLocaleKey() {
return raiseToolLocaleKey;
}
}

View File

@ -42,15 +42,15 @@ public enum PrimarySkillType {
ImmutableList.of(SubSkillType.ALCHEMY_CATALYSIS, SubSkillType.ALCHEMY_CONCOCTIONS)), ImmutableList.of(SubSkillType.ALCHEMY_CATALYSIS, SubSkillType.ALCHEMY_CONCOCTIONS)),
ARCHERY(ArcheryManager.class, Color.MAROON, ARCHERY(ArcheryManager.class, Color.MAROON,
ImmutableList.of(SubSkillType.ARCHERY_DAZE, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, SubSkillType.ARCHERY_ARROW_RETRIEVAL, SubSkillType.ARCHERY_SKILL_SHOT)), ImmutableList.of(SubSkillType.ARCHERY_DAZE, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, SubSkillType.ARCHERY_ARROW_RETRIEVAL, SubSkillType.ARCHERY_SKILL_SHOT)),
AXES(AxesManager.class, Color.AQUA, SuperAbilityType.SKULL_SPLITTER, ToolType.AXE, AXES(AxesManager.class, Color.AQUA, SuperAbilityType.SKULL_SPLITTER,
ImmutableList.of(SubSkillType.AXES_SKULL_SPLITTER, SubSkillType.AXES_AXES_LIMIT_BREAK, SubSkillType.AXES_ARMOR_IMPACT, SubSkillType.AXES_AXE_MASTERY, SubSkillType.AXES_CRITICAL_STRIKES, SubSkillType.AXES_GREATER_IMPACT)), ImmutableList.of(SubSkillType.AXES_SKULL_SPLITTER, SubSkillType.AXES_AXES_LIMIT_BREAK, SubSkillType.AXES_ARMOR_IMPACT, SubSkillType.AXES_AXE_MASTERY, SubSkillType.AXES_CRITICAL_STRIKES, SubSkillType.AXES_GREATER_IMPACT)),
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), SuperAbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), SuperAbilityType.GIGA_DRILL_BREAKER,
ImmutableList.of(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, SubSkillType.EXCAVATION_ARCHAEOLOGY)), ImmutableList.of(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, SubSkillType.EXCAVATION_ARCHAEOLOGY)),
FISHING(FishingManager.class, Color.NAVY, FISHING(FishingManager.class, Color.NAVY,
ImmutableList.of(SubSkillType.FISHING_FISHERMANS_DIET, SubSkillType.FISHING_TREASURE_HUNTER, SubSkillType.FISHING_ICE_FISHING, SubSkillType.FISHING_MAGIC_HUNTER, SubSkillType.FISHING_MASTER_ANGLER, SubSkillType.FISHING_SHAKE)), ImmutableList.of(SubSkillType.FISHING_FISHERMANS_DIET, SubSkillType.FISHING_TREASURE_HUNTER, SubSkillType.FISHING_ICE_FISHING, SubSkillType.FISHING_MAGIC_HUNTER, SubSkillType.FISHING_MASTER_ANGLER, SubSkillType.FISHING_SHAKE)),
HERBALISM(HerbalismManager.class, Color.GREEN, SuperAbilityType.GREEN_TERRA, ToolType.HOE, HERBALISM(HerbalismManager.class, Color.GREEN, SuperAbilityType.GREEN_TERRA,
ImmutableList.of(SubSkillType.HERBALISM_GREEN_TERRA, SubSkillType.HERBALISM_FARMERS_DIET, SubSkillType.HERBALISM_GREEN_THUMB, SubSkillType.HERBALISM_DOUBLE_DROPS, SubSkillType.HERBALISM_HYLIAN_LUCK, SubSkillType.HERBALISM_SHROOM_THUMB)), ImmutableList.of(SubSkillType.HERBALISM_GREEN_TERRA, SubSkillType.HERBALISM_FARMERS_DIET, SubSkillType.HERBALISM_GREEN_THUMB, SubSkillType.HERBALISM_DOUBLE_DROPS, SubSkillType.HERBALISM_HYLIAN_LUCK, SubSkillType.HERBALISM_SHROOM_THUMB)),
MINING(MiningManager.class, Color.GRAY, SuperAbilityType.SUPER_BREAKER, ToolType.PICKAXE, MINING(MiningManager.class, Color.GRAY, SuperAbilityType.SUPER_BREAKER,
ImmutableList.of(SubSkillType.MINING_SUPER_BREAKER, SubSkillType.MINING_DEMOLITIONS_EXPERTISE, SubSkillType.MINING_BIGGER_BOMBS, SubSkillType.MINING_BLAST_MINING, SubSkillType.MINING_DOUBLE_DROPS)), ImmutableList.of(SubSkillType.MINING_SUPER_BREAKER, SubSkillType.MINING_DEMOLITIONS_EXPERTISE, SubSkillType.MINING_BIGGER_BOMBS, SubSkillType.MINING_BLAST_MINING, SubSkillType.MINING_DOUBLE_DROPS)),
REPAIR(RepairManager.class, Color.SILVER, REPAIR(RepairManager.class, Color.SILVER,
ImmutableList.of(SubSkillType.REPAIR_ARCANE_FORGING, SubSkillType.REPAIR_REPAIR_MASTERY, SubSkillType.REPAIR_SUPER_REPAIR)), ImmutableList.of(SubSkillType.REPAIR_ARCANE_FORGING, SubSkillType.REPAIR_REPAIR_MASTERY, SubSkillType.REPAIR_SUPER_REPAIR)),
@ -58,21 +58,20 @@ public enum PrimarySkillType {
ImmutableList.of(SubSkillType.SALVAGE_SCRAP_COLLECTOR, SubSkillType.SALVAGE_ARCANE_SALVAGE)), ImmutableList.of(SubSkillType.SALVAGE_SCRAP_COLLECTOR, SubSkillType.SALVAGE_ARCANE_SALVAGE)),
SMELTING(SmeltingManager.class, Color.YELLOW, SMELTING(SmeltingManager.class, Color.YELLOW,
ImmutableList.of(SubSkillType.SMELTING_UNDERSTANDING_THE_ART, /*SubSkillType.SMELTING_FLUX_MINING,*/ SubSkillType.SMELTING_FUEL_EFFICIENCY, SubSkillType.SMELTING_SECOND_SMELT)), ImmutableList.of(SubSkillType.SMELTING_UNDERSTANDING_THE_ART, /*SubSkillType.SMELTING_FLUX_MINING,*/ SubSkillType.SMELTING_FUEL_EFFICIENCY, SubSkillType.SMELTING_SECOND_SMELT)),
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbilityType.SERRATED_STRIKES, ToolType.SWORD, SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), SuperAbilityType.SERRATED_STRIKES,
ImmutableList.of(SubSkillType.SWORDS_SERRATED_STRIKES, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, SubSkillType.SWORDS_STAB, SubSkillType.SWORDS_RUPTURE, SubSkillType.SWORDS_COUNTER_ATTACK)), ImmutableList.of(SubSkillType.SWORDS_SERRATED_STRIKES, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, SubSkillType.SWORDS_STAB, SubSkillType.SWORDS_RUPTURE, SubSkillType.SWORDS_COUNTER_ATTACK)),
TAMING(TamingManager.class, Color.PURPLE, TAMING(TamingManager.class, Color.PURPLE,
ImmutableList.of(SubSkillType.TAMING_BEAST_LORE, SubSkillType.TAMING_CALL_OF_THE_WILD, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE, SubSkillType.TAMING_FAST_FOOD_SERVICE, SubSkillType.TAMING_GORE, SubSkillType.TAMING_HOLY_HOUND, SubSkillType.TAMING_SHARPENED_CLAWS, SubSkillType.TAMING_SHOCK_PROOF, SubSkillType.TAMING_THICK_FUR, SubSkillType.TAMING_PUMMEL)), ImmutableList.of(SubSkillType.TAMING_BEAST_LORE, SubSkillType.TAMING_CALL_OF_THE_WILD, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE, SubSkillType.TAMING_FAST_FOOD_SERVICE, SubSkillType.TAMING_GORE, SubSkillType.TAMING_HOLY_HOUND, SubSkillType.TAMING_SHARPENED_CLAWS, SubSkillType.TAMING_SHOCK_PROOF, SubSkillType.TAMING_THICK_FUR, SubSkillType.TAMING_PUMMEL)),
UNARMED(UnarmedManager.class, Color.BLACK, SuperAbilityType.BERSERK, ToolType.FISTS, UNARMED(UnarmedManager.class, Color.BLACK, SuperAbilityType.BERSERK,
ImmutableList.of(SubSkillType.UNARMED_BERSERK, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, SubSkillType.UNARMED_BLOCK_CRACKER, SubSkillType.UNARMED_ARROW_DEFLECT, SubSkillType.UNARMED_DISARM, SubSkillType.UNARMED_IRON_ARM_STYLE, SubSkillType.UNARMED_IRON_GRIP)), ImmutableList.of(SubSkillType.UNARMED_BERSERK, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, SubSkillType.UNARMED_BLOCK_CRACKER, SubSkillType.UNARMED_ARROW_DEFLECT, SubSkillType.UNARMED_DISARM, SubSkillType.UNARMED_IRON_ARM_STYLE, SubSkillType.UNARMED_IRON_GRIP)),
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbilityType.TREE_FELLER, ToolType.AXE, WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbilityType.TREE_FELLER,
ImmutableList.of(SubSkillType.WOODCUTTING_LEAF_BLOWER, SubSkillType.WOODCUTTING_TREE_FELLER, SubSkillType.WOODCUTTING_HARVEST_LUMBER)), ImmutableList.of(SubSkillType.WOODCUTTING_LEAF_BLOWER, SubSkillType.WOODCUTTING_TREE_FELLER, SubSkillType.WOODCUTTING_HARVEST_LUMBER)),
TRIDENTS(TridentManager.class, Color.TEAL, ImmutableList.of(SubSkillType.TRIDENTS_MULTI_TASKING, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)), TRIDENTS(TridentManager.class, Color.TEAL, ImmutableList.of(SubSkillType.TRIDENTS_MULTI_TASKING, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)),
CROSSBOWS(CrossbowManager.class, Color.ORANGE, ImmutableList.of(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)); CROSSBOWS(CrossbowManager.class, Color.ORANGE, ImmutableList.of(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK));
private final Class<? extends SkillManager> managerClass; private final Class<? extends SkillManager> managerClass;
private final Color skillColor; private final Color skillColor;
private final SuperAbilityType ability; private final SuperAbilityType superAbilityType;
private final ToolType tool;
private final List<SubSkillType> subSkillTypes; private final List<SubSkillType> subSkillTypes;
public static final List<String> SKILL_NAMES; public static final List<String> SKILL_NAMES;
@ -115,14 +114,13 @@ public enum PrimarySkillType {
} }
PrimarySkillType(Class<? extends SkillManager> managerClass, Color skillColor, List<SubSkillType> subSkillTypes) { PrimarySkillType(Class<? extends SkillManager> managerClass, Color skillColor, List<SubSkillType> subSkillTypes) {
this(managerClass, skillColor, null, null, subSkillTypes); this(managerClass, skillColor, null, subSkillTypes);
} }
PrimarySkillType(Class<? extends SkillManager> managerClass, Color skillColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) { PrimarySkillType(Class<? extends SkillManager> managerClass, Color skillColor, SuperAbilityType superAbilityType, List<SubSkillType> subSkillTypes) {
this.managerClass = managerClass; this.managerClass = managerClass;
this.skillColor = skillColor; this.skillColor = skillColor;
this.ability = ability; this.superAbilityType = superAbilityType;
this.tool = tool;
this.subSkillTypes = subSkillTypes; this.subSkillTypes = subSkillTypes;
} }
@ -130,8 +128,8 @@ public enum PrimarySkillType {
return managerClass; return managerClass;
} }
public SuperAbilityType getAbility() { public SuperAbilityType getSuperAbilityType() {
return ability; return superAbilityType;
} }
/** /**
@ -143,7 +141,7 @@ public enum PrimarySkillType {
return Config.getInstance().getLevelCap(this); return Config.getInstance().getLevelCap(this);
} }
public boolean isSuperAbilityUnlocked(Player player) { return RankUtils.getRank(player, getAbility().getSubSkillTypeDefinition()) >= 1; } public boolean isSuperAbilityUnlocked(Player player) { return RankUtils.getRank(player, getSuperAbilityType().getSubSkillTypeDefinition()) >= 1; }
public boolean getPVPEnabled() { public boolean getPVPEnabled() {
return Config.getInstance().getPVPEnabled(this); return Config.getInstance().getPVPEnabled(this);
@ -173,10 +171,6 @@ public enum PrimarySkillType {
Config.getInstance().setHardcoreVampirismEnabled(this, enable); Config.getInstance().setHardcoreVampirismEnabled(this, enable);
} }
public ToolType getTool() {
return tool;
}
public List<SubSkillType> getSkillAbilities() { public List<SubSkillType> getSkillAbilities() {
return subSkillTypes; return subSkillTypes;
} }
@ -230,7 +224,7 @@ public enum PrimarySkillType {
public static PrimarySkillType byAbility(SuperAbilityType ability) { public static PrimarySkillType byAbility(SuperAbilityType ability) {
for (PrimarySkillType type : values()) { for (PrimarySkillType type : values()) {
if (type.getAbility() == ability) { if (type.getSuperAbilityType() == ability) {
return type; return type;
} }
} }

View File

@ -1,61 +0,0 @@
package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.util.ItemUtils;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public enum ToolType {
AXE("Axes.Ability.Lower", "Axes.Ability.Ready"),
FISTS("Unarmed.Ability.Lower", "Unarmed.Ability.Ready"),
HOE("Herbalism.Ability.Lower", "Herbalism.Ability.Ready"),
PICKAXE("Mining.Ability.Lower", "Mining.Ability.Ready"),
SHOVEL("Excavation.Ability.Lower", "Excavation.Ability.Ready"),
SWORD("Swords.Ability.Lower", "Swords.Ability.Ready");
private final String lowerTool;
private final String raiseTool;
ToolType(String lowerTool, String raiseTool) {
this.lowerTool = lowerTool;
this.raiseTool = raiseTool;
}
public String getLowerTool() {
return lowerTool;
}
public String getRaiseTool() {
return raiseTool;
}
/**
* Check to see if the item is of the appropriate type.
*
* @param itemStack The item to check
* @return true if the item is the right type, false otherwise
*/
public boolean inHand(ItemStack itemStack) {
switch (this) {
case AXE:
return ItemUtils.isAxe(itemStack);
case FISTS:
return itemStack.getType() == Material.AIR;
case HOE:
return ItemUtils.isHoe(itemStack);
case PICKAXE:
return ItemUtils.isPickaxe(itemStack);
case SHOVEL:
return ItemUtils.isShovel(itemStack);
case SWORD:
return ItemUtils.isSword(itemStack);
default:
return false;
}
}
}

View File

@ -10,7 +10,7 @@ public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent {
protected McMMOPlayerAbilityEvent(Player player, PrimarySkillType skill) { protected McMMOPlayerAbilityEvent(Player player, PrimarySkillType skill) {
super(player, skill); super(player, skill);
ability = skill.getAbility(); ability = skill.getSuperAbilityType();
} }
public SuperAbilityType getAbility() { public SuperAbilityType getAbility() {

View File

@ -6,9 +6,9 @@ import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.meta.BonusDropMeta; import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
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.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -491,19 +491,19 @@ public class BlockListener implements Listener {
if (BlockUtils.canActivateAbilities(blockState)) { if (BlockUtils.canActivateAbilities(blockState)) {
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
if (mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) { if (mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.GREEN_TERRA_TOOL) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.HERBALISM); mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.HERBALISM);
} }
else if (mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) { else if (mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.SKULL_SPLITTER_TOOL) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.WOODCUTTING); mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.WOODCUTTING);
} }
else if (mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) { else if (mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.SUPER_BREAKER_TOOL) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.MINING); mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.MINING);
} }
else if (mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) { else if (mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.GIGA_DRILL_BREAKER_TOOL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.EXCAVATION); mcMMOPlayer.getSuperAbilityManager().checkAbilityActivation(PrimarySkillType.EXCAVATION);
} }
else if (mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) else if (mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.BERSERK_TOOL) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState)
|| mcMMO.getMaterialMapStore().isGlass(blockState.getType()) || mcMMO.getMaterialMapStore().isGlass(blockState.getType())
|| blockState.getType() == Material.SNOW || blockState.getType() == Material.SNOW
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) { || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {

View File

@ -3,29 +3,29 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
public class ToolLowerTask extends BukkitRunnable { public class ToolLowerTask extends BukkitRunnable {
private final McMMOPlayer mcMMOPlayer; private final McMMOPlayer mcMMOPlayer;
private final ToolType tool; private final AbilityToolType tool;
public ToolLowerTask(McMMOPlayer mcMMOPlayer, ToolType tool) { public ToolLowerTask(McMMOPlayer mcMMOPlayer, AbilityToolType abilityToolType) {
this.mcMMOPlayer = mcMMOPlayer; this.mcMMOPlayer = mcMMOPlayer;
this.tool = tool; this.tool = abilityToolType;
} }
@Override @Override
public void run() { public void run() {
if (!mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(tool)) { if (!mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(tool)) {
return; return;
} }
mcMMOPlayer.getSuperAbilityManager().setToolPreparationMode(tool, false); mcMMOPlayer.getSuperAbilityManager().setAbilityToolPrime(tool, false);
if (Config.getInstance().getAbilityMessagesEnabled()) { if (Config.getInstance().getAbilityMessagesEnabled()) {
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool()); NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerToolLocaleKey());
} }
} }
} }

View File

@ -3,10 +3,10 @@ package com.gmail.nossr50.skills.axes;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 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.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -61,7 +61,7 @@ public class AxesManager extends SkillManager {
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {
return mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer()); return mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.SKULL_SPLITTER_TOOL) && Permissions.skullSplitter(getPlayer());
} }
/** /**

View File

@ -9,10 +9,10 @@ import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.meta.RecentlyReplantedCropMeta; import com.gmail.nossr50.datatypes.meta.RecentlyReplantedCropMeta;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 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.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.DelayedCropReplant; import com.gmail.nossr50.runnables.skills.DelayedCropReplant;
@ -82,7 +82,7 @@ public class HerbalismManager extends SkillManager {
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {
return mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(getPlayer()); return mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.GREEN_TERRA_TOOL) && Permissions.greenTerra(getPlayer());
} }
public boolean isGreenTerraActive() { public boolean isGreenTerraActive() {

View File

@ -81,7 +81,7 @@ public class MiningManager extends SkillManager {
return; return;
} }
if (mcMMOPlayer.getSuperAbilityManager().getAbilityMode(skill.getAbility())) { if (mcMMOPlayer.getSuperAbilityManager().getAbilityMode(skill.getSuperAbilityType())) {
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage()); SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
} }
@ -95,7 +95,7 @@ public class MiningManager extends SkillManager {
//TODO: Make this readable //TODO: Make this readable
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS, true)) { if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS, true)) {
BlockUtils.markDropsAsBonus(blockState, mcMMOPlayer.getSuperAbilityManager().getAbilityMode(skill.getAbility())); BlockUtils.markDropsAsBonus(blockState, mcMMOPlayer.getSuperAbilityManager().getAbilityMode(skill.getSuperAbilityType()));
} }
} }

View File

@ -2,10 +2,10 @@ package com.gmail.nossr50.skills.swords;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 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.runnables.skills.BleedTimerTask; import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
@ -29,7 +29,7 @@ public class SwordsManager extends SkillManager {
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {
return mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.SWORD) && Permissions.serratedStrikes(getPlayer()); return mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.SERRATED_STRIKES_TOOL) && Permissions.serratedStrikes(getPlayer());
} }
public boolean canUseStab() { public boolean canUseStab() {

View File

@ -3,10 +3,10 @@ package com.gmail.nossr50.skills.unarmed;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 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.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
@ -32,7 +32,7 @@ public class UnarmedManager extends SkillManager {
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {
return mcMMOPlayer.getSuperAbilityManager().getToolPreparationMode(ToolType.FISTS) && Permissions.berserk(getPlayer()); return mcMMOPlayer.getSuperAbilityManager().isAbilityToolPrimed(AbilityToolType.BERSERK_TOOL) && Permissions.berserk(getPlayer());
} }
public boolean canUseIronArm() { public boolean canUseIronArm() {

View File

@ -251,7 +251,7 @@ public class MaterialMapStore {
fillIronToolsWhiteList(); fillIronToolsWhiteList();
fillGoldToolsWhiteList(); fillGoldToolsWhiteList();
fillDiamondToolsWhiteList(); fillDiamondToolsWhiteList();
fillnetheriteToolsWhiteList(); fillNetheriteToolsWhiteList();
fillSwords(); fillSwords();
fillAxes(); fillAxes();
@ -476,7 +476,7 @@ public class MaterialMapStore {
diamondTools.add("diamond_shovel"); diamondTools.add("diamond_shovel");
} }
private void fillnetheriteToolsWhiteList() { private void fillNetheriteToolsWhiteList() {
netheriteTools.add("netherite_sword"); netheriteTools.add("netherite_sword");
netheriteTools.add("netherite_axe"); netheriteTools.add("netherite_axe");
netheriteTools.add("netherite_hoe"); netheriteTools.add("netherite_hoe");

View File

@ -29,6 +29,14 @@ public class AbilityActivationProcessor {
this.player = mmoPlayer.getPlayer(); this.player = mmoPlayer.getPlayer();
} }
/**
* Checks to see if the player is holding a tool
*/
public boolean isHoldingTool() {
return mcMMO.getMaterialMapStore().isTool(player.getInventory().getItemInMainHand().getType());
}
public void processAbilityAndToolActivations(PlayerInteractEvent event) { public void processAbilityAndToolActivations(PlayerInteractEvent event) {
switch(event.getAction()) { switch(event.getAction()) {
case LEFT_CLICK_BLOCK: case LEFT_CLICK_BLOCK:

View File

@ -4,9 +4,9 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityToolType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
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.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AbilityDisableTask; import com.gmail.nossr50.runnables.skills.AbilityDisableTask;
import com.gmail.nossr50.runnables.skills.ToolLowerTask; import com.gmail.nossr50.runnables.skills.ToolLowerTask;
@ -29,24 +29,24 @@ public class SuperAbilityManager {
private final McMMOPlayer mmoPlayer; private final McMMOPlayer mmoPlayer;
private final Player player; private final Player player;
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<>(); private final Map<SuperAbilityType, Boolean> superAbilityState = new HashMap<>();
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<>(); private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<>();
private boolean abilityActivationPermission = true; private boolean abilityActivationPermission = true;
private final Map<ToolType, Boolean> toolMode = new HashMap<>(); private final Map<AbilityToolType, Boolean> toolMode = new HashMap<>();
public SuperAbilityManager(McMMOPlayer mmoPlayer) { public SuperAbilityManager(McMMOPlayer mmoPlayer) {
this.mmoPlayer = mmoPlayer; this.mmoPlayer = mmoPlayer;
this.player = mmoPlayer.getPlayer(); this.player = mmoPlayer.getPlayer();
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) { for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
abilityMode.put(superAbilityType, false); superAbilityState.put(superAbilityType, false);
abilityInformed.put(superAbilityType, true); // This is intended abilityInformed.put(superAbilityType, true); // This is intended
} }
for (ToolType toolType : ToolType.values()) { for (AbilityToolType abilityToolType : AbilityToolType.values()) {
toolMode.put(toolType, false); toolMode.put(abilityToolType, false);
} }
} }
@ -78,14 +78,13 @@ public class SuperAbilityManager {
} }
} }
SuperAbilityType ability = skill.getAbility(); SuperAbilityType ability = skill.getSuperAbilityType();
ToolType tool = skill.getTool();
/* /*
* Woodcutting & Axes need to be treated differently. * Woodcutting & Axes need to be treated differently.
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action * Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
*/ */
if (tool.inHand(inHand) && !getToolPreparationMode(tool)) { if (mmoPlayer.getAbilityActivationProcessor().isHoldingTool() && !isAbilityToolPrimed(tool)) {
if (skill != PrimarySkillType.WOODCUTTING && skill != PrimarySkillType.AXES) { if (skill != PrimarySkillType.WOODCUTTING && skill != PrimarySkillType.AXES) {
int timeRemaining = calculateTimeRemaining(ability); int timeRemaining = calculateTimeRemaining(ability);
@ -96,11 +95,11 @@ public class SuperAbilityManager {
} }
if (Config.getInstance().getAbilityMessagesEnabled()) { if (Config.getInstance().getAbilityMessagesEnabled()) {
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool()); NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseToolLocaleKey());
SoundManager.sendSound(player, player.getLocation(), SoundType.TOOL_READY); SoundManager.sendSound(player, player.getLocation(), SoundType.TOOL_READY);
} }
setToolPreparationMode(tool, true); setAbilityToolPrime(tool, true);
new ToolLowerTask(mmoPlayer, tool).runTaskLater(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR); new ToolLowerTask(mmoPlayer, tool).runTaskLater(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
} }
} }
@ -111,8 +110,8 @@ public class SuperAbilityManager {
* @param primarySkillType The primarySkillType the ability is based on * @param primarySkillType The primarySkillType the ability is based on
*/ */
public void checkAbilityActivation(PrimarySkillType primarySkillType) { public void checkAbilityActivation(PrimarySkillType primarySkillType) {
ToolType tool = primarySkillType.getTool(); AbilityToolType tool = primarySkillType.getTool();
SuperAbilityType ability = primarySkillType.getAbility(); SuperAbilityType ability = primarySkillType.getSuperAbilityType();
if (getAbilityMode(ability) || !ability.getPermissions(player)) { if (getAbilityMode(ability) || !ability.getPermissions(player)) {
return; return;
@ -122,7 +121,7 @@ public class SuperAbilityManager {
//Potential problems with this include skills with two super abilities (ie mining) //Potential problems with this include skills with two super abilities (ie mining)
if(!primarySkillType.isSuperAbilityUnlocked(player)) if(!primarySkillType.isSuperAbilityUnlocked(player))
{ {
int diff = RankUtils.getSuperAbilityUnlockRequirement(primarySkillType.getAbility()) - mmoPlayer.getSkillLevel(primarySkillType); int diff = RankUtils.getSuperAbilityUnlockRequirement(primarySkillType.getSuperAbilityType()) - mmoPlayer.getSkillLevel(primarySkillType);
//Inform the player they are not yet skilled enough //Inform the player they are not yet skilled enough
NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), primarySkillType.getName()); NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), primarySkillType.getName());
@ -182,7 +181,7 @@ public class SuperAbilityManager {
SkillUtils.handleAbilitySpeedIncrease(player); SkillUtils.handleAbilitySpeedIncrease(player);
} }
setToolPreparationMode(tool, false); setAbilityToolPrime(tool, false);
new AbilityDisableTask(mmoPlayer, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR); new AbilityDisableTask(mmoPlayer, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR);
} }
@ -207,7 +206,7 @@ public class SuperAbilityManager {
* @return true if the ability is enabled, false otherwise * @return true if the ability is enabled, false otherwise
*/ */
public boolean getAbilityMode(SuperAbilityType ability) { public boolean getAbilityMode(SuperAbilityType ability) {
return abilityMode.get(ability); return superAbilityState.get(ability);
} }
/** /**
@ -217,7 +216,7 @@ public class SuperAbilityManager {
* @param isActive True if the ability is active, false otherwise * @param isActive True if the ability is active, false otherwise
*/ */
public void setAbilityMode(SuperAbilityType ability, boolean isActive) { public void setAbilityMode(SuperAbilityType ability, boolean isActive) {
abilityMode.put(ability, isActive); superAbilityState.put(ability, isActive);
} }
/** /**
@ -241,13 +240,13 @@ public class SuperAbilityManager {
} }
/** /**
* Get the current prep mode of a tool. * Whether or not a tool is primed
* *
* @param tool Tool to get the mode for * @param abilityToolType ability tool to check
* @return true if the tool is prepped, false otherwise * @return true if the abilityToolType is primed, false otherwise
*/ */
public boolean getToolPreparationMode(ToolType tool) { public boolean isAbilityToolPrimed(AbilityToolType abilityToolType) {
return toolMode.get(tool); return toolMode.get(abilityToolType);
} }
public boolean getAbilityActivationPermission() { public boolean getAbilityActivationPermission() {
@ -265,20 +264,20 @@ public class SuperAbilityManager {
/** /**
* Reset the prep modes of all tools. * Reset the prep modes of all tools.
*/ */
public void resetToolPrepMode() { public void unprimeAllAbilityTools() {
for (ToolType tool : ToolType.values()) { for (AbilityToolType abilityToolType : AbilityToolType.values()) {
setToolPreparationMode(tool, false); setAbilityToolPrime(abilityToolType, false);
} }
} }
/** /**
* Set the current prep mode of a tool. * Set the current prep mode of a abilityToolType.
* *
* @param tool Tool to set the mode for * @param abilityToolType Tool to set the mode for
* @param isPrepared true if the tool should be prepped, false otherwise * @param isPrepared true if the abilityToolType should be prepped, false otherwise
*/ */
public void setToolPreparationMode(ToolType tool, boolean isPrepared) { public void setAbilityToolPrime(AbilityToolType abilityToolType, boolean isPrepared) {
toolMode.put(tool, isPrepared); toolMode.put(abilityToolType, isPrepared);
} }
/** /**

View File

@ -89,8 +89,8 @@ public class ScoreboardManager {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false)); skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false));
if (type.getAbility() != null) { if (type.getSuperAbilityType() != null) {
abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getLocalizedName())); abilityLabelBuilder.put(type.getSuperAbilityType(), getShortenedName(colors.get(i) + type.getSuperAbilityType().getLocalizedName()));
if (type == PrimarySkillType.MINING) { if (type == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getLocalizedName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getLocalizedName()));
@ -111,8 +111,8 @@ public class ScoreboardManager {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName())); skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName()));
if (type.getAbility() != null) { if (type.getSuperAbilityType() != null) {
abilityLabelBuilder.put(type.getAbility(), formatAbility(type.getAbility().getLocalizedName())); abilityLabelBuilder.put(type.getSuperAbilityType(), formatAbility(type.getSuperAbilityType().getLocalizedName()));
if (type == PrimarySkillType.MINING) { if (type == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getLocalizedName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getLocalizedName()));

View File

@ -462,7 +462,7 @@ public class ScoreboardWrapper {
sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill)); sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill));
if (targetSkill.getAbility() != null) { if (targetSkill.getSuperAbilityType() != null) {
boolean stopUpdating; boolean stopUpdating;
if (targetSkill == PrimarySkillType.MINING) { if (targetSkill == PrimarySkillType.MINING) {
@ -478,7 +478,7 @@ public class ScoreboardWrapper {
stopUpdating = (secondsSB == 0 && secondsBM == 0); stopUpdating = (secondsSB == 0 && secondsBM == 0);
} }
else { else {
SuperAbilityType ability = targetSkill.getAbility(); SuperAbilityType ability = targetSkill.getSuperAbilityType();
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability)); Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0); int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);

View File

@ -79,7 +79,7 @@ public class SkillUtils {
*/ */
public static String[] calculateLengthDisplayValues(Player player, float skillValue, PrimarySkillType skill) { public static String[] calculateLengthDisplayValues(Player player, float skillValue, PrimarySkillType skill) {
int maxLength = skill.getAbility().getMaxLength(); int maxLength = skill.getSuperAbilityType().getMaxLength();
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
@ -214,10 +214,10 @@ public class SkillUtils {
if(abilityLengthCap > 0) if(abilityLengthCap > 0)
{ {
ticks = PerksUtils.handleActivationPerks(player, Math.min(abilityLengthCap, 2 + (mcMMOPlayer.getSkillLevel(skill) / abilityLengthVar)), ticks = PerksUtils.handleActivationPerks(player, Math.min(abilityLengthCap, 2 + (mcMMOPlayer.getSkillLevel(skill) / abilityLengthVar)),
skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR; skill.getSuperAbilityType().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR;
} else { } else {
ticks = PerksUtils.handleActivationPerks(player, 2 + ((mcMMOPlayer.getSkillLevel(skill)) / abilityLengthVar), ticks = PerksUtils.handleActivationPerks(player, 2 + ((mcMMOPlayer.getSkillLevel(skill)) / abilityLengthVar),
skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR; skill.getSuperAbilityType().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR;
} }
PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10); PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);