diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 9b6e8ea2f..6129187cd 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -37,7 +37,7 @@ public class AcrobaticsCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE); canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java index 0f062b1ea..3bf4d52cf 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java @@ -75,7 +75,7 @@ public class AlchemyCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS); canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index 59decaf9f..86041f302 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -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.locale.LocaleLoader; @@ -9,6 +10,7 @@ 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; @@ -29,36 +31,36 @@ public class ArcheryCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) { // ARCHERY_ARROW_RETRIEVAL if (canRetrieve) { - String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); + String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL); retrieveChance = retrieveStrings[0]; retrieveChanceLucky = retrieveStrings[1]; } // ARCHERY_DAZE if (canDaze) { - String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE); + String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ARCHERY_DAZE); dazeChance = dazeStrings[0]; dazeChanceLucky = dazeStrings[1]; } // SKILL SHOT if (canSkillShot) { - skillShotBonus = percent.format(Archery.getDamageBonusPercent(player)); + skillShotBonus = percent.format(Archery.getDamageBonusPercent(mmoPlayer)); } } @Override - protected void permissionsCheck(Player player) { - canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT); - canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE); - canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { + canSkillShot = canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_SKILL_SHOT); + canDaze = canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_DAZE); + canRetrieve = canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL); } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected @NotNull List statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canRetrieve) { @@ -75,19 +77,19 @@ public class ArcheryCommand extends SkillCommand { messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus)); } - if(canUseSubskill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) { + if(canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) { messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, - String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000)))); + String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000)))); } return messages; } @Override - protected List getTextComponents(Player player) { + protected @NotNull List getTextComponents(@NotNull McMMOPlayer mmoPlayer) { List textComponents = new ArrayList<>(); - TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY); + TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ARCHERY); return textComponents; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index caf569953..2bd23ba9d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -44,19 +44,19 @@ public class AxesCommand extends SkillCommand { // AXE MASTERY if (canAxeMastery) { - axeMasteryDamage = Axes.getAxeMasteryBonusDamage(player); + axeMasteryDamage = Axes.getAxeMasteryBonusDamage(mmoPlayer.getPlayer()); } // CRITICAL HIT if (canCritical) { - String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.AXES_CRITICAL_STRIKES); + String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES); critChance = criticalHitStrings[0]; critChanceLucky = criticalHitStrings[1]; } // SKULL SPLITTER if (canSkullSplitter) { - String[] skullSplitterStrings = calculateLengthDisplayValues(player, skillValue); + String[] skullSplitterStrings = calculateLengthDisplayValues(mmoPlayer, skillValue); skullSplitterLength = skullSplitterStrings[0]; skullSplitterLengthEndurance = skullSplitterStrings[1]; } @@ -72,7 +72,7 @@ public class AxesCommand extends SkillCommand { } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected @NotNull List statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canImpact) { @@ -97,19 +97,19 @@ public class AxesCommand extends SkillCommand { + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : "")); } - if(canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) { + if(canUseSubskill(mmoPlayer, SubSkillType.AXES_AXES_LIMIT_BREAK)) { messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK, - String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000)))); + String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000)))); } return messages; } @Override - protected List getTextComponents(Player player) { + protected @NotNull List getTextComponents(@NotNull McMMOPlayer mmoPlayer) { List textComponents = new ArrayList<>(); - TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES); + TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.AXES); return textComponents; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/CrossbowsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/CrossbowsCommand.java index 8feb5fdbb..33dc93cb0 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/CrossbowsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/CrossbowsCommand.java @@ -21,7 +21,7 @@ public class CrossbowsCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java index 0b8e3ce82..f4874391e 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java @@ -37,7 +37,7 @@ public class ExcavationCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER); canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index 3d4693b77..097e04de8 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -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.locale.LocaleLoader; @@ -9,7 +10,7 @@ import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.Material; -import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -41,64 +42,74 @@ public class HerbalismCommand extends SkillCommand { } @Override - protected void dataCalculations(Player player, float skillValue) { + protected void dataCalculations(@NotNull McMMOPlayer mmoPlayer, float skillValue) { // DOUBLE DROPS if (canDoubleDrop) { - String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS); + String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_DOUBLE_DROPS); doubleDropChance = doubleDropStrings[0]; doubleDropChanceLucky = doubleDropStrings[1]; } // FARMERS DIET if (canFarmersDiet) { - farmersDietRank = RankUtils.getRank(player, SubSkillType.HERBALISM_FARMERS_DIET); + farmersDietRank = RankUtils.getRank(mmoPlayer, SubSkillType.HERBALISM_FARMERS_DIET); } // GREEN TERRA if (canGreenTerra) { - String[] greenTerraStrings = calculateLengthDisplayValues(player, skillValue); + String[] greenTerraStrings = calculateLengthDisplayValues(mmoPlayer, skillValue); greenTerraLength = greenTerraStrings[0]; greenTerraLengthEndurance = greenTerraStrings[1]; } // GREEN THUMB if (canGreenThumbBlocks || canGreenThumbPlants) { - greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB); + greenThumbStage = RankUtils.getRank(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB); - String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB); + String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB); greenThumbChance = greenThumbStrings[0]; greenThumbChanceLucky = greenThumbStrings[1]; } // HYLIAN LUCK if (hasHylianLuck) { - String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK); + String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_HYLIAN_LUCK); hylianLuckChance = hylianLuckStrings[0]; hylianLuckChanceLucky = hylianLuckStrings[1]; } // SHROOM THUMB if (canShroomThumb) { - String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB); + String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_SHROOM_THUMB); shroomThumbChance = shroomThumbStrings[0]; shroomThumbChanceLucky = shroomThumbStrings[1]; } } @Override - protected void permissionsCheck(Player player) { - hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK); - canGreenTerra = Permissions.greenTerra(player); - canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA)); - canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS)); - canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET); - canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); - canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB); + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { + hasHylianLuck = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_HYLIAN_LUCK); + canGreenTerra = Permissions.greenTerra(mmoPlayer.getPlayer()); + canGreenThumbPlants = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB) + && (Permissions.greenThumbPlant(mmoPlayer.getPlayer(), Material.WHEAT) + || Permissions.greenThumbPlant(mmoPlayer.getPlayer(), Material.CARROT) + || Permissions.greenThumbPlant(mmoPlayer.getPlayer(), Material.POTATO) + || Permissions.greenThumbPlant(mmoPlayer.getPlayer(), Material.BEETROOT) + || Permissions.greenThumbPlant(mmoPlayer.getPlayer(), Material.NETHER_WART) + || Permissions.greenThumbPlant(mmoPlayer.getPlayer(), Material.COCOA)); + canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB) + && (Permissions.greenThumbBlock(mmoPlayer.getPlayer(), Material.DIRT) + || Permissions.greenThumbBlock(mmoPlayer.getPlayer(), Material.COBBLESTONE) + || Permissions.greenThumbBlock(mmoPlayer.getPlayer(), Material.COBBLESTONE_WALL) + || Permissions.greenThumbBlock(mmoPlayer.getPlayer(), Material.STONE_BRICKS)); + canFarmersDiet = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_FARMERS_DIET); + canDoubleDrop = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); + canShroomThumb = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_SHROOM_THUMB); } @Override - protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { + protected @NotNull List statsDisplay(@NotNull McMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList<>(); if (canDoubleDrop) { @@ -141,10 +152,10 @@ public class HerbalismCommand extends SkillCommand { } @Override - protected List getTextComponents(Player player) { + protected @NotNull List getTextComponents(@NotNull McMMOPlayer mmoPlayer) { List textComponents = new ArrayList<>(); - TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM); + TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.HERBALISM); return textComponents; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index a9efd6bb4..9da34028b 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -76,7 +76,7 @@ public class RepairCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR); canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY); canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 0d70e6bcf..10da8420e 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -82,7 +82,7 @@ public abstract class SkillCommand implements TabExecutor { permissionsCheck(mmoPlayer); dataCalculations(mmoPlayer, skillValue); - sendSkillCommandHeader(player, mmoPlayer, (int) skillValue); + sendSkillCommandHeader(mmoPlayer, (int) skillValue); //Make JSON text components List subskillTextComponents = getTextComponents(mmoPlayer); @@ -108,7 +108,7 @@ public abstract class SkillCommand implements TabExecutor { //Link Header if (Config.getInstance().getUrlLinksEnabled()) { player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header")); - TextComponentFactory.sendPlayerUrlHeader(player); + TextComponentFactory.sendPlayerUrlHeader(mmoPlayer); } @@ -135,13 +135,13 @@ public abstract class SkillCommand implements TabExecutor { mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase(Locale.ENGLISH))); } - private void sendSkillCommandHeader(Player player, McMMOPlayer mmoPlayer, int skillValue) { + private void sendSkillCommandHeader(@NotNull McMMOPlayer mmoPlayer, int skillValue) { ChatColor hd1 = ChatColor.DARK_AQUA; ChatColor c1 = ChatColor.GOLD; ChatColor c2 = ChatColor.RED; - player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName)); + mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName)); if(!skill.isChildSkill()) { @@ -150,10 +150,10 @@ public abstract class SkillCommand implements TabExecutor { */ //XP GAIN METHOD - player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString())))); + mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString())))); //LEVEL - player.sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mmoPlayer.getExperienceManager().getSkillXpValue(skill), mmoPlayer.getExperienceManager().getXpToLevel(skill))); + mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mmoPlayer.getExperienceManager().getSkillXpValue(skill), mmoPlayer.getExperienceManager().getXpToLevel(skill))); } else { /* @@ -181,31 +181,11 @@ public abstract class SkillCommand implements TabExecutor { } //XP GAIN METHOD - player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child"))); + mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child"))); - player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage.toString())); - //LEVEL - //player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue)); + mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage.toString())); } - /* - 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, mmoPlayer.getSkillXpLevel(skill), mmoPlayer.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 parents = FamilyTree.getParents(skill); - - for (PrimarySkillType parent : parents) { - player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mmoPlayer.getSkillLevel(parent), mmoPlayer.getSkillXpLevel(parent), mmoPlayer.getXpToLevel(parent))); - } - } - */ } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index 35f04f5bc..76215015f 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -42,7 +42,7 @@ public class TamingCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { canBeastLore = canUseSubskill(player, SubSkillType.TAMING_BEAST_LORE); canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT); canEnvironmentallyAware = canUseSubskill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TridentsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TridentsCommand.java index 5cba8cae4..f85868988 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TridentsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TridentsCommand.java @@ -19,7 +19,7 @@ public class TridentsCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index a817a312d..09d7011c4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -53,7 +53,7 @@ public class WoodcuttingCommand extends SkillCommand { } @Override - protected void permissionsCheck(Player player) { + protected void permissionsCheck(@NotNull McMMOPlayer mmoPlayer) { canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player); canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && !skill.getDoubleDropsDisabled() && RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1; canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER); diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 6649a4278..1fe65046e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -51,7 +51,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -public class McMMOPlayer extends PlayerProfile implements Identified, Permissible { +public class McMMOPlayer extends PlayerProfile implements Identified { private final @NotNull Player player; private final @NotNull Identity identity; private @Nullable Party playerPartyRef; diff --git a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java index a892b0a89..18468c070 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.archery; import com.gmail.nossr50.api.ItemSpawnReason; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.skills.RankUtils; @@ -64,14 +65,13 @@ public class Archery { } } - public static double getSkillShotBonusDamage(Player player, double oldDamage) - { - double damageBonusPercent = getDamageBonusPercent(player); + public static double getSkillShotBonusDamage(@NotNull McMMOPlayer mmoPlayer, double oldDamage) { + double damageBonusPercent = getDamageBonusPercent(mmoPlayer); double newDamage = oldDamage + (oldDamage * damageBonusPercent); return Math.min(newDamage, (oldDamage + Archery.skillShotMaxBonusDamage)); } - public static double getDamageBonusPercent(Player player) { - return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * (AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier()) / 100.0D); + public static double getDamageBonusPercent(@NotNull McMMOPlayer mmoPlayer) { + return ((RankUtils.getRank(mmoPlayer, SubSkillType.ARCHERY_SKILL_SHOT)) * (AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier()) / 100.0D); } } diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index fb90e39ca..bcb5feb73 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -19,6 +19,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.jetbrains.annotations.NotNull; public class ArcheryManager extends SkillManager { public ArcheryManager(McMMOPlayer mmoPlayer) { @@ -26,21 +27,21 @@ public class ArcheryManager extends SkillManager { } public boolean canDaze(LivingEntity target) { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.ARCHERY_DAZE)) return false; return target instanceof Player && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_DAZE); } public boolean canSkillShot() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.ARCHERY_SKILL_SHOT)) return false; return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT); } public boolean canRetrieveArrows() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL)) return false; return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL); @@ -52,7 +53,7 @@ public class ArcheryManager extends SkillManager { * @param target The {@link LivingEntity} damaged by the arrow * @param arrow The {@link Entity} who shot the arrow */ - public double distanceXpBonusMultiplier(LivingEntity target, Entity arrow) { + public double distanceXpBonusMultiplier(@NotNull LivingEntity target, @NotNull Entity arrow) { //Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires if(!arrow.hasMetadata(mcMMO.arrowDistanceKey)) return arrow.getLocation().distance(target.getLocation()); @@ -76,7 +77,7 @@ public class ArcheryManager extends SkillManager { * * @param target The {@link LivingEntity} damaged by the arrow */ - public void retrieveArrows(LivingEntity target, Projectile projectile) { + public void retrieveArrows(@NotNull LivingEntity target, @NotNull Projectile projectile) { if(projectile.hasMetadata(mcMMO.trackedArrow)) { Archery.incrementTrackerValue(target); projectile.removeMetadata(mcMMO.trackedArrow, mcMMO.p); //Only 1 entity per projectile @@ -88,7 +89,7 @@ public class ArcheryManager extends SkillManager { * * @param defender The {@link Player} being affected by the ability */ - public double daze(Player defender) { + public double daze(@NotNull Player defender) { if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ARCHERY_DAZE, getPlayer())) { return 0; } @@ -121,6 +122,6 @@ public class ArcheryManager extends SkillManager { return oldDamage; } - return Archery.getSkillShotBonusDamage(getPlayer(), oldDamage); + return Archery.getSkillShotBonusDamage(mmoPlayer, oldDamage); } } diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 4f127f259..907b76fe0 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -45,7 +45,7 @@ public class TamingManager extends SkillManager { private HashMap> playerSummonedEntities; - public TamingManager(McMMOPlayer mmoPlayer) { + public TamingManager(@NotNull McMMOPlayer mmoPlayer) { super(mmoPlayer, PrimarySkillType.TAMING); init(); } @@ -100,44 +100,44 @@ public class TamingManager extends SkillManager { } public boolean canUseThickFur() { - return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR) + return RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_THICK_FUR) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_THICK_FUR); } public boolean canUseEnvironmentallyAware() { - return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE) + return RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE); } public boolean canUseShockProof() { - return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF) + return RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_SHOCK_PROOF) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF); } public boolean canUseHolyHound() { - return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE) + return RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_HOLY_HOUND); } public boolean canUseFastFoodService() { - return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE) + return RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_FAST_FOOD_SERVICE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE); } public boolean canUseSharpenedClaws() { - return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS) + return RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_SHARPENED_CLAWS) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS); } public boolean canUseGore() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_GORE)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_GORE)) return false; return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_GORE); } public boolean canUseBeastLore() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_BEAST_LORE)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_BEAST_LORE)) return false; return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_BEAST_LORE); @@ -206,7 +206,7 @@ public class TamingManager extends SkillManager { * Summon an ocelot to your side. */ public void summonOcelot() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_CALL_OF_THE_WILD)) return; if (!Permissions.callOfTheWild(getPlayer(), EntityType.OCELOT)) { @@ -220,7 +220,7 @@ public class TamingManager extends SkillManager { * Summon a wolf to your side. */ public void summonWolf() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_CALL_OF_THE_WILD)) return; if (!Permissions.callOfTheWild(getPlayer(), EntityType.WOLF)) { @@ -234,7 +234,7 @@ public class TamingManager extends SkillManager { * Summon a horse to your side. */ public void summonHorse() { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD)) + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_CALL_OF_THE_WILD)) return; if (!Permissions.callOfTheWild(getPlayer(), EntityType.HORSE)) { @@ -249,7 +249,7 @@ public class TamingManager extends SkillManager { * * @param target The entity to examine */ - public void beastLore(LivingEntity target) { + public void beastLore(@NotNull LivingEntity target) { Player player = getPlayer(); Tameable beast = (Tameable) target; @@ -273,7 +273,7 @@ public class TamingManager extends SkillManager { player.sendMessage(message); } - public void processEnvironmentallyAware(Wolf wolf, double damage) { + public void processEnvironmentallyAware(@NotNull Wolf wolf, double damage) { if (damage > wolf.getHealth()) { return; } @@ -284,8 +284,8 @@ public class TamingManager extends SkillManager { NotificationManager.sendPlayerInformation(owner, NotificationType.SUBSKILL_MESSAGE, "Taming.Listener.Wolf"); } - public void pummel(LivingEntity target, Wolf wolf) { - if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL)) + public void pummel(@NotNull LivingEntity target, @NotNull Wolf wolf) { + if(!RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.TAMING_PUMMEL)) return; if(!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(AdvancedConfig.getInstance().getPummelChance(), getPlayer(), SubSkillType.TAMING_PUMMEL))) @@ -414,7 +414,7 @@ public class TamingManager extends SkillManager { } } - private void spawnWolf(Location spawnLocation) { + private void spawnWolf(@NotNull Location spawnLocation) { LivingEntity callOfWildEntity = (LivingEntity) getPlayer().getWorld().spawnEntity(spawnLocation, EntityType.WOLF); //This is used to prevent XP gains for damaging this entity @@ -432,7 +432,7 @@ public class TamingManager extends SkillManager { callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", getPlayer().getName(), StringUtils.getPrettyEntityTypeString(EntityType.WOLF))); } - private void spawnCat(Location spawnLocation, EntityType entityType) { + private void spawnCat(@NotNull Location spawnLocation, @NotNull EntityType entityType) { LivingEntity callOfWildEntity = (LivingEntity) getPlayer().getWorld().spawnEntity(spawnLocation, entityType); //This is used to prevent XP gains for damaging this entity @@ -459,7 +459,7 @@ public class TamingManager extends SkillManager { ParticleEffectUtils.playCallOfTheWildEffect(callOfWildEntity); } - private void spawnHorse(Location spawnLocation) { + private void spawnHorse(@NotNull Location spawnLocation) { LivingEntity callOfWildEntity = (LivingEntity) getPlayer().getWorld().spawnEntity(spawnLocation, EntityType.HORSE); applyMetaDataToCOTWEntity(callOfWildEntity); @@ -485,12 +485,12 @@ public class TamingManager extends SkillManager { ParticleEffectUtils.playCallOfTheWildEffect(callOfWildEntity); } - private void setBaseCOTWEntityProperties(LivingEntity callOfWildEntity) { + private void setBaseCOTWEntityProperties(@NotNull LivingEntity callOfWildEntity) { ((Tameable) callOfWildEntity).setOwner(getPlayer()); callOfWildEntity.setRemoveWhenFarAway(false); } - private void applyMetaDataToCOTWEntity(LivingEntity summonedEntity) { + private void applyMetaDataToCOTWEntity(@NotNull LivingEntity summonedEntity) { //This helps identify the entity as being summoned by COTW mcMMO.getCompatibilityManager().getPersistentDataLayer().flagMetadata(MobMetaFlagType.COTW_SUMMONED_MOB, summonedEntity); } @@ -500,7 +500,7 @@ public class TamingManager extends SkillManager { * @param itemStack target ItemStack * @return true if it is used for any COTW */ - public boolean isCOTWItem(ItemStack itemStack) { + public boolean isCOTWItem(@NotNull ItemStack itemStack) { return summoningItems.containsKey(itemStack.getType()); } @@ -513,7 +513,7 @@ public class TamingManager extends SkillManager { } //TODO: The way this tracker was written is garbo, I should just rewrite it, I'll save that for a future update - private void addToTracker(LivingEntity livingEntity, CallOfTheWildType callOfTheWildType) { + private void addToTracker(@NotNull LivingEntity livingEntity, @NotNull CallOfTheWildType callOfTheWildType) { TrackedTamingEntity trackedEntity = new TrackedTamingEntity(livingEntity, callOfTheWildType, this); playerSummonedEntities.get(callOfTheWildType).add(trackedEntity); @@ -525,7 +525,7 @@ public class TamingManager extends SkillManager { } //TODO: The way this tracker was written is garbo, I should just rewrite it, I'll save that for a future update - public void removeFromTracker(TrackedTamingEntity trackedEntity) { + public void removeFromTracker(@NotNull TrackedTamingEntity trackedEntity) { playerSummonedEntities.get(trackedEntity.getCallOfTheWildType()).remove(trackedEntity); NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Taming.Summon.COTW.TimeExpired", StringUtils.getPrettyEntityTypeString(trackedEntity.getLivingEntity().getType())); @@ -543,7 +543,7 @@ public class TamingManager extends SkillManager { } //TODO: The way this tracker was written is garbo, I should just rewrite it, I'll save that for a future update - private ArrayList getValidTrackedEntities(CallOfTheWildType callOfTheWildType) { + private @NotNull ArrayList getValidTrackedEntities(@NotNull CallOfTheWildType callOfTheWildType) { ArrayList validTrackedEntities = new ArrayList<>(); for(TrackedTamingEntity trackedTamingEntity : getTrackedEntities(callOfTheWildType)) { diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index 866619c5a..8789da6e5 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -138,7 +138,7 @@ public class UnarmedManager extends SkillManager { * @param damage The amount of damage initially dealt by the event */ public double berserkDamage(double damage) { - damage = ((damage * Unarmed.berserkDamageModifier) * mmoPlayer.getAttackStrength()) - damage; + damage = ((damage * Unarmed.berserkDamageModifier)) - damage; return damage; } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index e5b980ade..b42d83d85 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -102,22 +102,22 @@ public final class CombatUtils { //Add Stab Damage if(swordsManager.canUseStab()) { - finalDamage+=(swordsManager.getStabDamage() * mmoPlayer.getAttackStrength()); + finalDamage+=(swordsManager.getStabDamage()); } if (swordsManager.canUseSerratedStrike()) { swordsManager.serratedStrikes(target, initialDamage, modifiers); } - if(canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) + if(canUseLimitBreak(mmoPlayer, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) { - finalDamage+=(getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mmoPlayer.getAttackStrength()); + finalDamage+=(getLimitBreakDamage(mmoPlayer, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)); } applyScaledModifiers(initialDamage, finalDamage, event); processCombatXP(mmoPlayer, target, PrimarySkillType.SWORDS); - printFinalDamageDebug(player, event, mcMMOPlayer); + printFinalDamageDebug(player, event, mmoPlayer); } public static void processTridentCombat(LivingEntity target, Player player, EntityDamageByEntityEvent entityDamageByEntityEvent) { @@ -190,18 +190,18 @@ public final class CombatUtils { } if (axesManager.canCriticalHit(target)) { - finalDamage+=(axesManager.criticalHit(target, finalDamage) * mmoPlayer.getAttackStrength()); + finalDamage+=(axesManager.criticalHit(target, finalDamage)); } - if(canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK)) + if(canUseLimitBreak(mmoPlayer, target, SubSkillType.AXES_AXES_LIMIT_BREAK)) { - finalDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mmoPlayer.getAttackStrength()); + finalDamage+=(getLimitBreakDamage(mmoPlayer, target, SubSkillType.AXES_AXES_LIMIT_BREAK)); } applyScaledModifiers(initialDamage, finalDamage, event); processCombatXP(mmoPlayer, target, PrimarySkillType.AXES); - printFinalDamageDebug(player, event, mcMMOPlayer); + printFinalDamageDebug(player, event, mmoPlayer); } private static void processUnarmedCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event) { @@ -226,20 +226,20 @@ public final class CombatUtils { } if (unarmedManager.canUseSteelArm()) { - finalDamage+=(unarmedManager.calculateSteelArmStyleDamage() * mmoPlayer.getAttackStrength()); + finalDamage+=(unarmedManager.calculateSteelArmStyleDamage()); } if (unarmedManager.canUseBerserk()) { - finalDamage+=(unarmedManager.berserkDamage(finalDamage) * mmoPlayer.getAttackStrength()); + finalDamage+=(unarmedManager.berserkDamage(finalDamage)); } if (unarmedManager.canDisarm(target)) { unarmedManager.disarmCheck((Player) target); } - if(canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) + if(canUseLimitBreak(mmoPlayer, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) { - finalDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mmoPlayer.getAttackStrength()); + finalDamage+=(getLimitBreakDamage(mmoPlayer, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)); } applyScaledModifiers(initialDamage, finalDamage, event); @@ -309,16 +309,16 @@ public final class CombatUtils { archeryManager.retrieveArrows(target, arrow); } - if(canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) + if(canUseLimitBreak(mmoPlayer, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) { - finalDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK); + finalDamage+=getLimitBreakDamage(mmoPlayer, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK); } double distanceMultiplier = archeryManager.distanceXpBonusMultiplier(target, arrow); -// double forceMultiplier = 1.0; //Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires + double forceMultiplier = 1.0; //Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires -// if(arrow.hasMetadata(mcMMO.bowForceKey)) -// forceMultiplier = arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble(); + if(arrow.hasMetadata(mcMMO.bowForceKey)) + forceMultiplier = arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble(); applyScaledModifiers(initialDamage, finalDamage, event); @@ -357,9 +357,9 @@ public final class CombatUtils { } } - if(canUseLimitBreak(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) + if(canUseLimitBreak(mmoPlayer, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) { - finalDamage+=getLimitBreakDamage(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK); + finalDamage+=getLimitBreakDamage(mmoPlayer, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK); } double distanceMultiplier = crossbowManager.distanceXpBonusMultiplier(target, arrow); @@ -558,7 +558,7 @@ public final class CombatUtils { * @param subSkillType the specific limit break skill for calculations * @return the RAW damage bonus from Limit Break which is applied before reductions */ - public static int getLimitBreakDamage(@NotNull Player attacker, @NotNull LivingEntity defender, @NotNull SubSkillType subSkillType) { + public static int getLimitBreakDamage(@NotNull McMMOPlayer attacker, @NotNull LivingEntity defender, @NotNull SubSkillType subSkillType) { if(defender instanceof Player) { Player playerDefender = (Player) defender; return getLimitBreakDamageAgainstQuality(attacker, subSkillType, getArmorQualityLevel(playerDefender)); @@ -575,7 +575,7 @@ public final class CombatUtils { * @param armorQualityLevel Armor quality level * @return the RAW damage boost after its been mutated by armor quality */ - public static int getLimitBreakDamageAgainstQuality(@NotNull Player attacker, @NotNull SubSkillType subSkillType, int armorQualityLevel) { + public static int getLimitBreakDamageAgainstQuality(@NotNull McMMOPlayer attacker, @NotNull SubSkillType subSkillType, int armorQualityLevel) { int rawDamageBoost = RankUtils.getRank(attacker, subSkillType); if(armorQualityLevel <= 4) { @@ -616,14 +616,14 @@ public final class CombatUtils { } /** - * Checks if player has access to their weapons limit break - * @param player target entity - * @return true if the player has access to the limit break + * Checks if mmoPlayer has access to their weapons limit break + * @param mmoPlayer target entity + * @return true if the mmoPlayer has access to the limit break */ - public static boolean canUseLimitBreak(@NotNull Player player, LivingEntity target, @NotNull SubSkillType subSkillType) { + public static boolean canUseLimitBreak(@NotNull McMMOPlayer mmoPlayer, LivingEntity target, @NotNull SubSkillType subSkillType) { if(target instanceof Player || AdvancedConfig.getInstance().canApplyLimitBreakPVE()) { - return RankUtils.hasUnlockedSubskill(player, subSkillType) - && Permissions.isSubSkillEnabled(player, subSkillType); + return RankUtils.hasUnlockedSubskill(mmoPlayer, subSkillType) + && Permissions.isSubSkillEnabled(mmoPlayer.getPlayer(), subSkillType); } else { return false; }