From 297ce64a241ad931952c19a862ad60f6ddcd4c37 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 25 Sep 2019 14:08:49 -0700 Subject: [PATCH] Fixing some more classes broken in the static abuse removal edits --- .../datatypes/party/PartyTeleportRecord.java | 2 ++ .../skills/subskills/acrobatics/Roll.java | 2 +- .../nossr50/skills/mining/MiningManager.java | 8 ++++--- .../util/scoreboards/ScoreboardWrapper.java | 22 +++++++++---------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/PartyTeleportRecord.java b/src/main/java/com/gmail/nossr50/datatypes/party/PartyTeleportRecord.java index 00cbcf567..92c60ba70 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/PartyTeleportRecord.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/PartyTeleportRecord.java @@ -7,8 +7,10 @@ public class PartyTeleportRecord { private Player requestor; private boolean enabled, confirmRequired; private int timeout, lastUse; + private final mcMMO pluginRef; public PartyTeleportRecord(mcMMO pluginRef) { + this.pluginRef = pluginRef; requestor = null; enabled = true; confirmRequired = pluginRef.getConfigManager().getConfigParty().getPTP().isPtpAcceptRequired(); diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index 3fc623144..b7144cb86 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -25,7 +25,7 @@ public class Roll extends AcrobaticsSubSkill { private final mcMMO pluginRef; public Roll(mcMMO pluginRef) { - super("Roll", EventPriority.HIGHEST, SubSkillType.ACROBATICS_ROLL); + super(pluginRef, "Roll", EventPriority.HIGHEST, SubSkillType.ACROBATICS_ROLL); this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index a4a3a9ab9..2743d0216 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -86,7 +86,7 @@ public class MiningManager extends SkillManager { applyXpGain(miningBehaviour.getBlockXp(blockState), XPGainReason.PVE); - if (mcMMOPlayer.getSuperAbilityMode(skill.getSuperAbility())) { + if (mcMMOPlayer.getSuperAbilityMode(pluginRef.getSkillTools().getSuperAbility(skill))) { pluginRef.getSkillTools().handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage()); } @@ -100,7 +100,7 @@ public class MiningManager extends SkillManager { //TODO: Make this readable if (pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS)) { - pluginRef.getBlockTools().markDropsAsBonus(blockState, mcMMOPlayer.getSuperAbilityMode(skill.getSuperAbility())); + pluginRef.getBlockTools().markDropsAsBonus(blockState, mcMMOPlayer.getSuperAbilityMode(pluginRef.getSkillTools().getSuperAbility(skill))); } } @@ -128,7 +128,9 @@ public class MiningManager extends SkillManager { mcMMOPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis()); mcMMOPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false); - new AbilityCooldownTask(pluginRef, mcMMOPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(pluginRef, SuperAbilityType.BLAST_MINING.getCooldown() * pluginRef.getMiscTools().TICK_CONVERSION_FACTOR); + new AbilityCooldownTask(pluginRef, mcMMOPlayer, SuperAbilityType.BLAST_MINING) + .runTaskLater(pluginRef, pluginRef.getSkillTools().getSuperAbilityCooldown(SuperAbilityType.BLAST_MINING) + * pluginRef.getMiscTools().TICK_CONVERSION_FACTOR); } /** diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index 6e6138701..175277487 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -403,7 +403,7 @@ public class ScoreboardWrapper { case SKILL_BOARD: Validate.notNull(targetSkill); - if (!targetSkill.isChildSkill()) { + if (!pluginRef.getSkillTools().isChildSkill(targetSkill)) { int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill); sidebarObjective.getScore(scoreboardStrings.LABEL_CURRENT_XP).setScore(currentXP); @@ -416,7 +416,7 @@ public class ScoreboardWrapper { sidebarObjective.getScore(scoreboardStrings.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill)); - if (targetSkill.getSuperAbility() != null) { + if (pluginRef.getSkillTools().getSuperAbility(targetSkill) != null) { boolean stopUpdating; if (targetSkill == PrimarySkillType.MINING) { @@ -431,7 +431,7 @@ public class ScoreboardWrapper { stopUpdating = (secondsSB == 0 && secondsBM == 0); } else { - SuperAbilityType ability = targetSkill.getSuperAbility(); + SuperAbilityType ability = pluginRef.getSkillTools().getSuperAbility(targetSkill); Score cooldown = sidebarObjective.getScore(scoreboardStrings.abilityLabelsSkill.get(ability)); int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0); @@ -482,17 +482,17 @@ public class ScoreboardWrapper { // Calculate power level here int powerLevel = 0; - for (PrimarySkillType skill : pluginRef.getSkillTools().NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long - int level = newProfile.getSkillLevel(skill); + for (PrimarySkillType primarySkillType : pluginRef.getSkillTools().NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long + int level = newProfile.getSkillLevel(primarySkillType); powerLevel += level; // TODO: Verify that this is what we want - calculated in power level but not displayed - if (!skill.doesPlayerHaveSkillPermission(player)) { + if (!pluginRef.getPermissionTools().skillEnabled(player, primarySkillType)) { continue; } - sidebarObjective.getScore(scoreboardStrings.skillLabels.get(skill)).setScore(level); + sidebarObjective.getScore(scoreboardStrings.skillLabels.get(primarySkillType)).setScore(level); } sidebarObjective.getScore(scoreboardStrings.LABEL_POWER_LEVEL).setScore(powerLevel); @@ -515,15 +515,15 @@ public class ScoreboardWrapper { Integer rank; Player player = pluginRef.getServer().getPlayerExact(playerName); - for (PrimarySkillType skill : pluginRef.getSkillTools().NON_CHILD_SKILLS) { - if (!skill.doesPlayerHaveSkillPermission(player)) { + for (PrimarySkillType primarySkillType : pluginRef.getSkillTools().NON_CHILD_SKILLS) { + if (!pluginRef.getPermissionTools().skillEnabled(player, primarySkillType)) { continue; } - rank = rankData.get(skill); + rank = rankData.get(primarySkillType); if (rank != null) { - sidebarObjective.getScore(scoreboardStrings.skillLabels.get(skill)).setScore(rank); + sidebarObjective.getScore(scoreboardStrings.skillLabels.get(primarySkillType)).setScore(rank); } }