mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Use proper functions where they exist, and move functions to better locations.
This commit is contained in:
@ -104,7 +104,7 @@ public class AxesManager extends SkillManager {
|
||||
short maxDurability = mcMMO.getRepairableManager().isRepairable(armorType) ? mcMMO.getRepairableManager().getRepairable(armorType).getMaximumDurability() : armorType.getMaxDurability();
|
||||
double maxDurabilityDamage = maxDurability * Axes.impactMaxDurabilityModifier;
|
||||
|
||||
armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability()));
|
||||
SkillUtils.handleDurabilityChange(armor, (int) Math.min(modifiedDurabilityDamage, maxDurabilityDamage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -472,7 +472,6 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
ItemStack treasureDrop = treasure.getDrop();
|
||||
|
||||
short maxDurability = treasureDrop.getType().getMaxDurability();
|
||||
|
||||
if (maxDurability > 0) {
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.metadata.FixedMetadataValue;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@ -286,12 +285,10 @@ public class MiningManager extends SkillManager {
|
||||
}
|
||||
|
||||
private boolean blastMiningCooldownOver() {
|
||||
Player player = getPlayer();
|
||||
PlayerProfile profile = getProfile();
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(AbilityType.BLAST_MINING, profile, player);
|
||||
int timeRemaining = mcMMOPlayer.calculateTimeRemaining(AbilityType.BLAST_MINING);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public final class Woodcutting {
|
||||
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getWoodcuttingDoubleDropMaxLevel();
|
||||
@ -227,12 +228,8 @@ public final class Woodcutting {
|
||||
}
|
||||
}
|
||||
|
||||
short finalDurability = (short) (inHand.getDurability() + durabilityLoss);
|
||||
short maxDurability = inHandMaterial.getMaxDurability();
|
||||
boolean overMax = (finalDurability >= maxDurability);
|
||||
|
||||
inHand.setDurability(overMax ? maxDurability : finalDurability);
|
||||
return !overMax;
|
||||
SkillUtils.handleDurabilityChange(inHand, durabilityLoss);
|
||||
return (inHand.getDurability() < inHandMaterial.getMaxDurability());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user