mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 11:03:43 +01:00 
			
		
		
		
	slow refactoring over skill commands
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
package com.gmail.nossr50.commands.skills;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 | 
			
		||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 | 
			
		||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
			
		||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
 | 
			
		||||
@@ -10,7 +11,7 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import com.gmail.nossr50.util.text.TextComponentFactory;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.jetbrains.annotations.NotNull;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -27,10 +28,10 @@ public class AcrobaticsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
        // ACROBATICS_DODGE
 | 
			
		||||
        if (canDodge) {
 | 
			
		||||
            String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE);
 | 
			
		||||
            String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ACROBATICS_DODGE);
 | 
			
		||||
            dodgeChance = dodgeStrings[0];
 | 
			
		||||
            dodgeChanceLucky = dodgeStrings[1];
 | 
			
		||||
        }
 | 
			
		||||
@@ -38,12 +39,12 @@ public class AcrobaticsCommand extends SkillCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
 | 
			
		||||
        canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
        canDodge = canUseSubskill(mmoPlayer, SubSkillType.ACROBATICS_DODGE);
 | 
			
		||||
        canRoll = canUseSubskill(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        List<String> messages = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        if (canDodge) {
 | 
			
		||||
@@ -60,10 +61,10 @@ public class AcrobaticsCommand extends SkillCommand {
 | 
			
		||||
                double rollChance, graceChance;
 | 
			
		||||
 | 
			
		||||
                //Chance to roll at half
 | 
			
		||||
                RandomChanceSkill roll_rcs  = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
                RandomChanceSkill roll_rcs  = new RandomChanceSkill(mmoPlayer.getPlayer(), SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
 | 
			
		||||
                //Chance to graceful roll
 | 
			
		||||
                RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
                RandomChanceSkill grace_rcs = new RandomChanceSkill(mmoPlayer.getPlayer(), SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
                grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
 | 
			
		||||
 | 
			
		||||
                //Chance Stat Calculations
 | 
			
		||||
@@ -71,7 +72,7 @@ public class AcrobaticsCommand extends SkillCommand {
 | 
			
		||||
                graceChance      = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
 | 
			
		||||
                //damageThreshold  = AdvancedConfig.getInstance().getRollDamageThreshold();
 | 
			
		||||
 | 
			
		||||
                String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
                String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ACROBATICS_ROLL);
 | 
			
		||||
 | 
			
		||||
                //Format
 | 
			
		||||
                double rollChanceLucky  = rollChance * 1.333D;
 | 
			
		||||
@@ -89,10 +90,10 @@ public class AcrobaticsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
    protected @NotNull List<Component> getTextComponents(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ACROBATICS);
 | 
			
		||||
 | 
			
		||||
        return textComponents;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ public class AlchemyCommand extends SkillCommand {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
        // ALCHEMY_CATALYSIS
 | 
			
		||||
        if (canCatalysis) {
 | 
			
		||||
            String[] catalysisStrings = calculateAbilityDisplayValues(mmoPlayer.getPlayer());
 | 
			
		||||
@@ -81,7 +81,7 @@ public class AlchemyCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        List<String> messages = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        if (canCatalysis) {
 | 
			
		||||
@@ -101,7 +101,7 @@ public class AlchemyCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
    protected @NotNull List<Component> getTextComponents(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ public class CrossbowsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -26,7 +26,7 @@ public class CrossbowsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        List<String> messages = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        CrossbowManager crossbowManager = mcMMO.getUserManager().getPlayer(player).getCrossbowManager();
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ public class ExcavationCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
        // GIGA DRILL BREAKER
 | 
			
		||||
        if (canGigaDrill) {
 | 
			
		||||
            String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue);
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ public class SalvageCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
        // TODO Auto-generated method stub
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,7 @@ public class SwordsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
    protected @NotNull List<Component> getTextComponents(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ public class TamingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
        if (canGore) {
 | 
			
		||||
            String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.TAMING_GORE);
 | 
			
		||||
            goreChance = goreStrings[0];
 | 
			
		||||
@@ -55,7 +55,7 @@ public class TamingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        List<String> messages = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        if (canEnvironmentallyAware) {
 | 
			
		||||
@@ -92,7 +92,7 @@ public class TamingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
    protected @NotNull List<Component> getTextComponents(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, this.skill);
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ public class TridentsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -24,7 +24,7 @@ public class TridentsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ public class UnarmedCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        List<String> messages = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        if (canDeflect) {
 | 
			
		||||
@@ -124,7 +124,7 @@ public class UnarmedCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
    protected @NotNull List<Component> getTextComponents(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED);
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ public class WoodcuttingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void dataCalculations(Player player, float skillValue) {
 | 
			
		||||
    protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) {
 | 
			
		||||
        // DOUBLE DROPS
 | 
			
		||||
        if (canDoubleDrop) {
 | 
			
		||||
            setDoubleDropClassicChanceStrings(player);
 | 
			
		||||
@@ -64,7 +64,7 @@ public class WoodcuttingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
    protected @NotNull List<String> statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
 | 
			
		||||
        List<String> messages = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        if (canDoubleDrop) {
 | 
			
		||||
@@ -97,7 +97,7 @@ public class WoodcuttingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
    protected @NotNull List<Component> getTextComponents(@NotNull McMMOPlayer mmoPlayer) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user