Refactoring to make my life easier

This commit is contained in:
nossr50
2018-12-29 05:24:55 -08:00
parent 35368db05d
commit 0d260a74c9
126 changed files with 1471 additions and 1408 deletions

View File

@@ -1,15 +1,15 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.skills.SuperAbility;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
public class AbilityCooldownTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private AbilityType ability;
private SuperAbility ability;
public AbilityCooldownTask(McMMOPlayer mcMMOPlayer, AbilityType ability) {
public AbilityCooldownTask(McMMOPlayer mcMMOPlayer, SuperAbility ability) {
this.mcMMOPlayer = mcMMOPlayer;
this.ability = ability;
}

View File

@@ -1,5 +1,6 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.skills.SuperAbility;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -8,7 +9,6 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@@ -17,9 +17,9 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class AbilityDisableTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private AbilityType ability;
private SuperAbility ability;
public AbilityDisableTask(McMMOPlayer mcMMOPlayer, AbilityType ability) {
public AbilityDisableTask(McMMOPlayer mcMMOPlayer, SuperAbility ability) {
this.mcMMOPlayer = mcMMOPlayer;
this.ability = ability;
}

View File

@@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerBrewEvent;
import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent;
import com.gmail.nossr50.skills.alchemy.Alchemy;
@@ -38,8 +38,8 @@ public class AlchemyBrewTask extends BukkitRunnable {
brewSpeed = DEFAULT_BREW_SPEED;
brewTimer = DEFAULT_BREW_TICKS;
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.ALCHEMY));
if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkill.ALCHEMY_CATALYSIS)) {
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkill.ALCHEMY));
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
mcMMO.p.getServer().getPluginManager().callEvent(event);

View File

@@ -1,23 +1,23 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.XPGainReason;
public class AwardCombatXpTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private double baseXp;
private SkillType skillType;
private PrimarySkill primarySkill;
private LivingEntity target;
private XPGainReason xpGainReason;
private double baseHealth;
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target, XPGainReason xpGainReason) {
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, PrimarySkill primarySkill, double baseXp, LivingEntity target, XPGainReason xpGainReason) {
this.mcMMOPlayer = mcMMOPlayer;
this.skillType = skillType;
this.primarySkill = primarySkill;
this.baseXp = baseXp;
this.target = target;
this.xpGainReason = xpGainReason;
@@ -39,6 +39,6 @@ public class AwardCombatXpTask extends BukkitRunnable {
damage += health;
}
mcMMOPlayer.beginXpGain(skillType, (int) (damage * baseXp), xpGainReason);
mcMMOPlayer.beginXpGain(primarySkill, (int) (damage * baseXp), xpGainReason);
}
}