mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-18 08:25:27 +01:00
Created an Ability class to be consistent with Tool
This commit is contained in:
parent
e80f60ccee
commit
e41adf769b
@ -11,38 +11,38 @@ public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.UNARMED).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.UNARMED).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.EXCAVATION).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.EXCAVATION).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.HERBALISM).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.HERBALISM).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.SWORDS).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.SWORDS).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.AXES).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.AXES).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.MINING).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.MINING).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.WOODCUTTING).getAbilityMode();
|
||||
return UserManager.getPlayer(player).getSkillManager(SkillType.WOODCUTTING).getAbility().getMode();
|
||||
}
|
||||
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
for (SkillManager skillManager : mcMMOPlayer.getSkillManagers().values()) {
|
||||
if (skillManager.getAbilityMode()) {
|
||||
if (skillManager.getAbility().getMode()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public abstract class SkillCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
protected String[] calculateLengthDisplayValues() {
|
||||
int maxLength = skill.getAbility().getMaxTicks();
|
||||
int maxLength = skill.getAbilityType().getMaxTicks();
|
||||
int length = 2 + (int) (skillValue / AdvancedConfig.getInstance().getAbilityLength());
|
||||
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class McMMOPlayer {
|
||||
if (skillManagerClass != null) {
|
||||
SkillManager skillManager = skillManagerClass.getConstructor(McMMOPlayer.class).newInstance(this);
|
||||
|
||||
skillManager.setTool(tools.get(skillType));
|
||||
skillManager.setTool(tools.get(skillType.getToolType()));
|
||||
skillManagers.put(skillType, skillManagerClass.getConstructor(McMMOPlayer.class).newInstance(this));
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ public class McMMOPlayer {
|
||||
*/
|
||||
public void resetAbilityMode() {
|
||||
for (SkillManager skillManager : skillManagers.values()) {
|
||||
skillManager.setAbilityMode(false);
|
||||
skillManager.getAbility().setMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
public class Ability {
|
||||
protected boolean mode;
|
||||
protected boolean informed = true;
|
||||
|
||||
public boolean getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(boolean mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public boolean getInformed() {
|
||||
return informed;
|
||||
}
|
||||
|
||||
public void setInformed(boolean informed) {
|
||||
this.informed = informed;
|
||||
}
|
||||
}
|
@ -33,27 +33,27 @@ public enum SkillType {
|
||||
WOODCUTTING(null, AbilityType.TREE_FELLER, ToolType.AXE); // TODO: Create a proper WoodcuttingManager class
|
||||
|
||||
private Class<? extends SkillManager> managerClass;
|
||||
private AbilityType ability;
|
||||
private AbilityType abilityType;
|
||||
private ToolType toolType;
|
||||
|
||||
private SkillType(Class<? extends SkillManager> managerClass) {
|
||||
this.managerClass = managerClass;
|
||||
ability = null;
|
||||
abilityType = null;
|
||||
toolType = null;
|
||||
}
|
||||
|
||||
private SkillType(Class<? extends SkillManager> managerClass, AbilityType ability, ToolType tool) {
|
||||
private SkillType(Class<? extends SkillManager> managerClass, AbilityType abilityType, ToolType toolType) {
|
||||
this.managerClass = managerClass;
|
||||
this.ability = ability;
|
||||
this.toolType = tool;
|
||||
this.abilityType = abilityType;
|
||||
this.toolType = toolType;
|
||||
}
|
||||
|
||||
public Class<? extends SkillManager> getManagerClass() {
|
||||
return managerClass;
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
return ability;
|
||||
public AbilityType getAbilityType() {
|
||||
return abilityType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,14 +178,14 @@ public class BlockListener implements Listener {
|
||||
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
|
||||
if (miningManager.getAbilityMode()) {
|
||||
if (miningManager.getAbility().getMode()) {
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.placeStore.isTrue(blockState)) {
|
||||
if (mcMMOPlayer.getSkillManager(SkillType.WOODCUTTING).getAbilityMode() && Permissions.treeFeller(player) && ItemUtils.isAxe(heldItem)) {
|
||||
if (mcMMOPlayer.getSkillManager(SkillType.WOODCUTTING).getAbility().getMode() && Permissions.treeFeller(player) && ItemUtils.isAxe(heldItem)) {
|
||||
Woodcutting.beginTreeFeller(blockState, player);
|
||||
}
|
||||
else {
|
||||
@ -206,7 +206,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
excavationManager.excavationBlockCheck(blockState);
|
||||
|
||||
if (excavationManager.getAbilityMode()) {
|
||||
if (excavationManager.getAbility().getMode()) {
|
||||
excavationManager.gigaDrillBreaker(blockState);
|
||||
}
|
||||
}
|
||||
@ -282,12 +282,12 @@ public class BlockListener implements Listener {
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getSkillManager(SkillType.MINING).getAbilityMode()) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbilityMode())) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getSkillManager(SkillType.MINING).getAbility().getMode()) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbility().getMode())) {
|
||||
SkillUtils.removeAbilityBuff(heldItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((mcMMOPlayer.getSkillManager(SkillType.MINING).getAbilityMode() && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbilityMode() && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
if ((mcMMOPlayer.getSkillManager(SkillType.MINING).getAbility().getMode() && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbility().getMode() && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class PlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbilityMode() || mcMMOPlayer.getSkillManager(SkillType.MINING).getAbilityMode()) {
|
||||
if (mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbility().getMode() || mcMMOPlayer.getSkillManager(SkillType.MINING).getAbility().getMode()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class SkillMonitorTask implements Runnable {
|
||||
* MONITOR SKILLS & COOLDOWN
|
||||
*/
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
if (skill.getAbility() == null) {
|
||||
if (skill.getAbilityType() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public class SkillMonitorTask implements Runnable {
|
||||
SkillUtils.monitorSkill(mcMMOPlayer, curTime, skill);
|
||||
}
|
||||
|
||||
if (skill.getAbility().getCooldown() > 0) {
|
||||
if (skill.getAbilityType().getCooldown() > 0) {
|
||||
SkillUtils.watchCooldown(mcMMOPlayer, skill);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.Ability;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.Tool;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
@ -12,9 +13,8 @@ public abstract class SkillManager {
|
||||
protected McMMOPlayer mcMMOPlayer;
|
||||
protected int activationChance;
|
||||
protected SkillType skill;
|
||||
protected boolean abilityMode;
|
||||
protected boolean abilityInformed = true;
|
||||
protected Tool tool;
|
||||
protected Ability ability = new Ability();
|
||||
protected Tool tool; // Because tool can be shared, it's instanced in McMMOPlayer
|
||||
|
||||
public SkillManager(McMMOPlayer mcMMOPlayer, SkillType skill) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
@ -46,20 +46,8 @@ public abstract class SkillManager {
|
||||
mcMMOPlayer.beginXpGain(skill, xp);
|
||||
}
|
||||
|
||||
public boolean getAbilityMode() {
|
||||
return abilityMode;
|
||||
}
|
||||
|
||||
public void setAbilityMode(boolean abilityMode) {
|
||||
this.abilityMode = abilityMode;
|
||||
}
|
||||
|
||||
public boolean getAbilityInformed() {
|
||||
return abilityInformed;
|
||||
}
|
||||
|
||||
public void setAbilityInformed(boolean abilityInformed) {
|
||||
this.abilityInformed = abilityInformed;
|
||||
public Ability getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
public Tool getTool() {
|
||||
|
@ -39,7 +39,7 @@ public class AxesManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||
return target.isValid() && abilityMode && Permissions.skullSplitter(getPlayer());
|
||||
return target.isValid() && getAbility().getMode() && Permissions.skullSplitter(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
|
@ -58,7 +58,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
||||
return abilityMode && BlockUtils.canMakeMossy(blockState);
|
||||
return getAbility().getMode() && BlockUtils.canMakeMossy(blockState);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
@ -66,7 +66,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canGreenTerraPlant() {
|
||||
return abilityMode;
|
||||
return getAbility().getMode();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,7 +284,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (abilityMode) {
|
||||
if (getAbility().getMode()) {
|
||||
playerInventory.removeItem(seed);
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class MiningManager extends SkillManager{
|
||||
targetBlock.setType(Material.AIR);
|
||||
|
||||
getProfile().setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||
abilityInformed = false;
|
||||
getAbility().setInformed(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseSerratedStrike() {
|
||||
return abilityMode && Permissions.serratedStrikes(getPlayer());
|
||||
return getAbility().getMode() && Permissions.serratedStrikes(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ public class UnarmedManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseBerserk() {
|
||||
return abilityMode && Permissions.berserk(getPlayer());
|
||||
return getAbility().getMode() && Permissions.berserk(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canDisarm(LivingEntity target) {
|
||||
|
@ -23,6 +23,7 @@ import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.Ability;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.Tool;
|
||||
@ -99,12 +100,12 @@ public class SkillUtils {
|
||||
}
|
||||
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
SkillManager skillManager = mcMMOPlayer.getSkillManager(skill);
|
||||
AbilityType ability = skill.getAbility();
|
||||
Ability ability = mcMMOPlayer.getSkillManager(skill).getAbility();
|
||||
AbilityType abilityType = skill.getAbilityType();
|
||||
|
||||
if (!skillManager.getAbilityInformed() && cooldownOver(mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
skillManager.setAbilityInformed(true);
|
||||
player.sendMessage(ability.getAbilityRefresh());
|
||||
if (!ability.getInformed() && cooldownOver(mcMMOPlayer.getProfile().getSkillDATS(abilityType) * Misc.TIME_CONVERSION_FACTOR, abilityType.getCooldown(), player)) {
|
||||
ability.setInformed(true);
|
||||
player.sendMessage(abilityType.getAbilityRefresh());
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +133,7 @@ public class SkillUtils {
|
||||
}
|
||||
|
||||
for (SkillManager skillManager : mcMMOPlayer.getSkillManagers().values()) {
|
||||
if (skillManager.getAbilityMode()) {
|
||||
if (skillManager.getAbility().getMode()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -140,17 +141,17 @@ public class SkillUtils {
|
||||
SkillManager skillManager = mcMMOPlayer.getSkillManager(skill);
|
||||
Tool tool = skillManager.getTool();
|
||||
ToolType toolType = skill.getToolType();
|
||||
AbilityType ability = skill.getAbility();
|
||||
AbilityType abilityType = skill.getAbilityType();
|
||||
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
if (ability.getPermissions(player) && toolType.inHand(inHand) && !tool.getPreparationMode()) {
|
||||
if (abilityType.getPermissions(player) && toolType.inHand(inHand) && !tool.getPreparationMode()) {
|
||||
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
|
||||
if (!skillManager.getAbilityMode() && !cooldownOver(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||
if (!skillManager.getAbility().getMode() && !cooldownOver(playerProfile.getSkillDATS(abilityType) * Misc.TIME_CONVERSION_FACTOR, abilityType.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(abilityType) * Misc.TIME_CONVERSION_FACTOR, abilityType.getCooldown(), player)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -185,28 +186,29 @@ public class SkillUtils {
|
||||
}
|
||||
}
|
||||
|
||||
AbilityType ability = skill.getAbility();
|
||||
Ability ability = skillManager.getAbility();
|
||||
AbilityType abilityType = skill.getAbilityType();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (ability.getPermissions(player)) {
|
||||
if (skillManager.getAbilityMode() && (mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
||||
if (ability == AbilityType.BERSERK) {
|
||||
if (abilityType.getPermissions(player)) {
|
||||
if (ability.getMode() && (mcMMOPlayer.getProfile().getSkillDATS(abilityType) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
||||
if (abilityType == AbilityType.BERSERK) {
|
||||
player.setCanPickupItems(true);
|
||||
}
|
||||
else if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) {
|
||||
else if (abilityType == AbilityType.SUPER_BREAKER || abilityType == AbilityType.GIGA_DRILL_BREAKER) {
|
||||
handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
|
||||
skillManager.setAbilityMode(false);
|
||||
skillManager.setAbilityInformed(false);
|
||||
ability.setMode(false);
|
||||
ability.setInformed(false);
|
||||
|
||||
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(ability.getAbilityOff());
|
||||
player.sendMessage(abilityType.getAbilityOff());
|
||||
}
|
||||
|
||||
sendSkillMessage(player, ability.getAbilityPlayerOff(player));
|
||||
sendSkillMessage(player, abilityType.getAbilityPlayerOff(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -377,7 +379,8 @@ public class SkillUtils {
|
||||
*/
|
||||
public static void abilityCheck(McMMOPlayer mcMMOPlayer, SkillType skill) {
|
||||
SkillManager skillManager = mcMMOPlayer.getSkillManager(skill);
|
||||
AbilityType ability = skill.getAbility();
|
||||
Ability ability = skillManager.getAbility();
|
||||
AbilityType abilityType = skill.getAbilityType();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
@ -388,30 +391,30 @@ public class SkillUtils {
|
||||
* We show them the too tired message when they take action.
|
||||
*/
|
||||
if (skill == SkillType.WOODCUTTING || skill == SkillType.AXES) {
|
||||
if (!skillManager.getAbilityMode() && !cooldownOver(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||
if (!ability.getMode() && !cooldownOver(playerProfile.getSkillDATS(abilityType) * Misc.TIME_CONVERSION_FACTOR, abilityType.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(abilityType) * Misc.TIME_CONVERSION_FACTOR, abilityType.getCooldown(), player)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skillManager.getAbilityMode() && cooldownOver(playerProfile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (playerProfile.getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), ability.getMaxTicks());
|
||||
if (!ability.getMode() && cooldownOver(playerProfile.getSkillDATS(abilityType), abilityType.getCooldown(), player)) {
|
||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (playerProfile.getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), abilityType.getMaxTicks());
|
||||
|
||||
ParticleEffectUtils.playAbilityEnabledEffect(player);
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(ability.getAbilityOn());
|
||||
player.sendMessage(abilityType.getAbilityOn());
|
||||
}
|
||||
|
||||
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayer(player));
|
||||
SkillUtils.sendSkillMessage(player, abilityType.getAbilityPlayer(player));
|
||||
|
||||
playerProfile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||
skillManager.setAbilityMode(true);
|
||||
playerProfile.setSkillDATS(abilityType, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||
ability.setMode(true);
|
||||
|
||||
if (ability == AbilityType.BERSERK) {
|
||||
if (abilityType == AbilityType.BERSERK) {
|
||||
player.setCanPickupItems(false);
|
||||
}
|
||||
else if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) {
|
||||
else if (abilityType == AbilityType.SUPER_BREAKER || abilityType == AbilityType.GIGA_DRILL_BREAKER) {
|
||||
handleAbilitySpeedIncrease(player);
|
||||
}
|
||||
}
|
||||
@ -522,10 +525,10 @@ public class SkillUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
int ticks = 0;
|
||||
|
||||
if (mcMMOPlayer.getSkillManager(SkillType.MINING).getAbilityMode()) {
|
||||
if (mcMMOPlayer.getSkillManager(SkillType.MINING).getAbility().getMode()) {
|
||||
ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.SUPER_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||
}
|
||||
else if (mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbilityMode()) {
|
||||
else if (mcMMOPlayer.getSkillManager(SkillType.EXCAVATION).getAbility().getMode()) {
|
||||
ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user