mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-27 09:35:27 +02:00
Fix double drops for mining
This commit is contained in:
@@ -55,7 +55,7 @@ public class AxesCommand extends SkillCommand {
|
||||
|
||||
// SKULL SPLITTER
|
||||
if (canSkullSplitter) {
|
||||
String[] skullSplitterStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] skullSplitterStrings = formatLengthDisplayValues(player, skillValue);
|
||||
skullSplitterLength = skullSplitterStrings[0];
|
||||
skullSplitterLengthEndurance = skullSplitterStrings[1];
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
protected void dataCalculations(Player player, double skillValue) {
|
||||
// GIGA DRILL BREAKER
|
||||
if (canGigaDrill) {
|
||||
String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] gigaDrillStrings = formatLengthDisplayValues(player, skillValue);
|
||||
gigaDrillBreakerLength = gigaDrillStrings[0];
|
||||
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
// GREEN TERRA
|
||||
if (canGreenTerra) {
|
||||
String[] greenTerraStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] greenTerraStrings = formatLengthDisplayValues(player, skillValue);
|
||||
greenTerraLength = greenTerraStrings[0];
|
||||
greenTerraLengthEndurance = greenTerraStrings[1];
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
// SUPER BREAKER
|
||||
if (canSuperBreaker) {
|
||||
String[] superBreakerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] superBreakerStrings = formatLengthDisplayValues(player, skillValue);
|
||||
superBreakerLength = superBreakerStrings[0];
|
||||
superBreakerLengthEndurance = superBreakerStrings[1];
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
@@ -14,9 +13,9 @@ import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
@@ -74,7 +73,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
boolean isLucky = Permissions.lucky(player, skill);
|
||||
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
|
||||
boolean hasEndurance = SkillUtils.getEnduranceLength(player) > 0;
|
||||
double skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||
|
||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||
@@ -193,24 +192,6 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));
|
||||
|
||||
}
|
||||
/*
|
||||
if (!skill.isChildSkill()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName + " " + LocaleLoader.getString("Skills.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child", skillValue));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (PrimarySkillType parent : parents) {
|
||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -231,24 +212,11 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return RandomChanceUtil.calculateAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, subSkill);
|
||||
}
|
||||
|
||||
protected String[] calculateLengthDisplayValues(Player player, double skillValue) {
|
||||
int maxLength = skill.getAbility().getMaxLength();
|
||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
||||
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
||||
protected String[] formatLengthDisplayValues(Player player, double skillValue) {
|
||||
|
||||
int length;
|
||||
int length = SkillUtils.calculateAbilityLength(UserManager.getPlayer(player), skill, skill.getSuperAbility());
|
||||
|
||||
if (abilityLengthCap <= 0) {
|
||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||
} else {
|
||||
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
||||
}
|
||||
|
||||
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
|
||||
|
||||
if (maxLength != 0) {
|
||||
length = Math.min(length, maxLength);
|
||||
}
|
||||
int enduranceLength = SkillUtils.calculateAbilityLengthPerks(UserManager.getPlayer(player), skill, skill.getSuperAbility());
|
||||
|
||||
return new String[]{String.valueOf(length), String.valueOf(enduranceLength)};
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public class SwordsCommand extends SkillCommand {
|
||||
|
||||
// SERRATED STRIKES
|
||||
if (canSerratedStrike) {
|
||||
String[] serratedStrikesStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] serratedStrikesStrings = formatLengthDisplayValues(player, skillValue);
|
||||
serratedStrikesLength = serratedStrikesStrings[0];
|
||||
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
|
||||
// BERSERK
|
||||
if (canBerserk) {
|
||||
String[] berserkStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] berserkStrings = formatLengthDisplayValues(player, skillValue);
|
||||
berserkLength = berserkStrings[0];
|
||||
berserkLengthEndurance = berserkStrings[1];
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
|
||||
// TREE FELLER
|
||||
if (canTreeFell) {
|
||||
String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
String[] treeFellerStrings = formatLengthDisplayValues(player, skillValue);
|
||||
treeFellerLength = treeFellerStrings[0];
|
||||
treeFellerLengthEndurance = treeFellerStrings[1];
|
||||
}
|
||||
|
Reference in New Issue
Block a user