Static Abuse Removal - Skill Tasks

This commit is contained in:
nossr50 2019-07-03 01:33:53 -07:00
parent 997fac0d17
commit 3ea739d111
29 changed files with 112 additions and 72 deletions

View File

@ -84,6 +84,6 @@
// }
//
// public static boolean isBleeding(LivingEntity entity) {
// return BleedTimerTask.isBleeding(entity);
// return pluginRef.getBleedTimerTask().isBleeding(entity);
// }
//}

View File

@ -12,7 +12,6 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AbilityDisableTask;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.runnables.skills.ToolLowerTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
@ -1011,7 +1010,7 @@ public class McMMOPlayer {
public void logout(boolean syncSave) {
Player thisPlayer = getPlayer();
resetAbilityMode();
BleedTimerTask.bleedOut(thisPlayer);
pluginRef.getBleedTimerTask().bleedOut(thisPlayer);
if (syncSave) {
getProfile().save(true);

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.runnables.skills;
package com.gmail.nossr50.datatypes.skills;
import org.bukkit.entity.LivingEntity;

View File

@ -89,6 +89,9 @@ public class mcMMO extends JavaPlugin {
private CommandTools commandTools;
private TextComponentFactory textComponentFactory;
/* Never-Ending tasks */
private BleedTimerTask bleedTimerTask;
/* File Paths */
private String mainDirectory;
private String localesDirectory;
@ -164,7 +167,7 @@ public class mcMMO extends JavaPlugin {
formulaManager = new FormulaManager();
for (Player player : getServer().getOnlinePlayers()) {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(this, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(this, player).runTaskLaterAsynchronously(this, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
debug("Version " + getDescription().getVersion() + " is enabled!");
@ -597,7 +600,8 @@ public class mcMMO extends JavaPlugin {
new CleanBackupFilesTask(this).runTaskAsynchronously(this);
// Bleed timer (Runs every 0.5 seconds)
new BleedTimerTask().runTaskTimer(this, Misc.TICK_CONVERSION_FACTOR, (Misc.TICK_CONVERSION_FACTOR / 2));
bleedTimerTask = new BleedTimerTask(this);
pluginRef.getBleedTimerTask().runTaskTimer(this, Misc.TICK_CONVERSION_FACTOR, (Misc.TICK_CONVERSION_FACTOR / 2));
// Old & Powerless User remover
long purgeIntervalTicks = getConfigManager().getConfigDatabase().getConfigSectionCleaning().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
@ -614,18 +618,18 @@ public class mcMMO extends JavaPlugin {
long kickIntervalTicks = getConfigManager().getConfigParty().getPartyCleanup().getPartyAutoKickHoursInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
if (kickIntervalTicks == 0) {
new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
new PartyAutoKickTask(this).runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
} else if (kickIntervalTicks > 0) {
new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
new PartyAutoKickTask(this).runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
}
}
// Update power level tag scoreboards
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
new PowerLevelUpdatingTask(this).runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
// Clear the registered XP data so players can earn XP again
if (getConfigManager().getConfigLeveling().getConfigLevelingDiminishedReturns().isDiminishedReturnsEnabled()) {
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
new ClearRegisteredXPGainTask(this).runTaskTimer(this, 60, 60);
}
if (configManager.getConfigNotifications().getConfigNotificationGeneral().isPlayerTips()) {
@ -726,4 +730,8 @@ public class mcMMO extends JavaPlugin {
public TextComponentFactory getTextComponentFactory() {
return textComponentFactory;
}
public BleedTimerTask getBleedTimerTask() {
return bleedTimerTask;
}
}

View File

@ -3,13 +3,16 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitRunnable;
public class AbilityCooldownTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private SuperAbilityType ability;
private final mcMMO pluginRef;
private final McMMOPlayer mcMMOPlayer;
private final SuperAbilityType ability;
public AbilityCooldownTask(McMMOPlayer mcMMOPlayer, SuperAbilityType ability) {
public AbilityCooldownTask(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, SuperAbilityType ability) {
this.pluginRef = pluginRef;
this.mcMMOPlayer = mcMMOPlayer;
this.ability = ability;
}

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@ -12,10 +13,12 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class AbilityDisableTask extends BukkitRunnable {
private final mcMMO pluginRef;
private McMMOPlayer mcMMOPlayer;
private SuperAbilityType ability;
public AbilityDisableTask(McMMOPlayer mcMMOPlayer, SuperAbilityType ability) {
public AbilityDisableTask(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, SuperAbilityType ability) {
this.pluginRef = pluginRef;
this.mcMMOPlayer = mcMMOPlayer;
this.ability = ability;
}
@ -54,7 +57,7 @@ public class AbilityDisableTask extends BukkitRunnable {
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(pluginRef, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
new AbilityCooldownTask(pluginRef, mcMMOPlayer, ability).runTaskLater(pluginRef, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
}
private void resendChunkRadiusAt(Player player) {

View File

@ -7,6 +7,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
//TODO: Why is this a task? Investigate later.
public class AwardCombatXpTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private double baseXp;

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.skills.BleedContainer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.sounds.SoundManager;
@ -16,17 +18,22 @@ import java.util.Map;
import java.util.Map.Entry;
public class BleedTimerTask extends BukkitRunnable {
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<>();
private final mcMMO pluginRef;
private Map<LivingEntity, BleedContainer> bleedList;
public static BleedContainer copyContainer(BleedContainer container) {
public BleedTimerTask(mcMMO pluginRef) {
this.pluginRef = pluginRef;
bleedList = new HashMap<>();
}
private BleedContainer copyContainer(BleedContainer container) {
LivingEntity target = container.target;
LivingEntity source = container.damageSource;
int bleedTicks = container.bleedTicks;
int bleedRank = container.bleedRank;
int toolTier = container.toolTier;
BleedContainer newContainer = new BleedContainer(target, bleedTicks, bleedRank, toolTier, source);
return newContainer;
return new BleedContainer(target, bleedTicks, bleedRank, toolTier, source);
}
/**
@ -34,7 +41,7 @@ public class BleedTimerTask extends BukkitRunnable {
*
* @param entity LivingEntity to bleed out
*/
public static void bleedOut(LivingEntity entity) {
public void bleedOut(LivingEntity entity) {
/*
* Don't remove anything from the list outside of run()
*/
@ -50,7 +57,7 @@ public class BleedTimerTask extends BukkitRunnable {
* @param entity LivingEntity to add
* @param ticks Number of bleeding ticks
*/
public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank, int toolTier) {
public void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank, int toolTier) {
if (toolTier < 4)
ticks = Math.max(1, (ticks / 3));
@ -58,7 +65,7 @@ public class BleedTimerTask extends BukkitRunnable {
bleedList.put(entity, newBleedContainer);
}
public static boolean isBleeding(LivingEntity entity) {
public boolean isBleeding(LivingEntity entity) {
return bleedList.containsKey(entity);
}

View File

@ -6,9 +6,9 @@ import com.gmail.nossr50.util.experience.ExperienceBarManager;
import org.bukkit.scheduler.BukkitRunnable;
public class ExperienceBarHideTask extends BukkitRunnable {
public final McMMOPlayer mcMMOPlayer;
public final PrimarySkillType primarySkillType;
public final ExperienceBarManager experienceBarManagerRef;
private final McMMOPlayer mcMMOPlayer;
private final PrimarySkillType primarySkillType;
private final ExperienceBarManager experienceBarManagerRef;
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
this.experienceBarManagerRef = experienceBarManagerRef;

View File

@ -4,7 +4,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.scheduler.BukkitRunnable;
public class HerbalismBlockUpdaterTask extends BukkitRunnable {
private BlockState blockState;
private final BlockState blockState;
public HerbalismBlockUpdaterTask(BlockState blockState) {
this.blockState = blockState;

View File

@ -2,25 +2,25 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitRunnable;
public class SkillUnlockNotificationTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private SubSkillType subSkillType;
private int rank;
private final mcMMO pluginRef;
private final McMMOPlayer mcMMOPlayer;
private final SubSkillType subSkillType;
/**
* Notify a player about a newly unlocked subskill
*
* @param mcMMOPlayer target player
* @param subSkillType the subskill that they just unlocked
* @param rank the rank of the subskill
*/
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank) {
public SkillUnlockNotificationTask(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) {
this.pluginRef = pluginRef;
this.mcMMOPlayer = mcMMOPlayer;
this.subSkillType = subSkillType;
this.rank = rank;
}
/**

View File

@ -3,13 +3,16 @@ package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitRunnable;
public class ToolLowerTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private ToolType tool;
private final mcMMO pluginRef;
private final McMMOPlayer mcMMOPlayer;
private final ToolType tool;
public ToolLowerTask(McMMOPlayer mcMMOPlayer, ToolType tool) {
public ToolLowerTask(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, ToolType tool) {
this.pluginRef = pluginRef;
this.mcMMOPlayer = mcMMOPlayer;
this.tool = tool;
}

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -11,8 +12,10 @@ import org.bukkit.entity.Player;
public abstract class SkillManager {
protected McMMOPlayer mcMMOPlayer;
protected PrimarySkillType skill;
protected final mcMMO pluginRef;
public SkillManager(McMMOPlayer mcMMOPlayer, PrimarySkillType skill) {
public SkillManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, PrimarySkillType skill) {
this.pluginRef = pluginRef;
this.mcMMOPlayer = mcMMOPlayer;
this.skill = skill;
}

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@ -25,8 +26,8 @@ public class AcrobaticsManager extends SkillManager {
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
private LimitedSizeList fallLocationMap;
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.ACROBATICS);
public AcrobaticsManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.ACROBATICS);
rollXPInterval = (1000 * pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getRollXPGainCooldownSeconds());
//Save some memory if exploit prevention is off

View File

@ -2,12 +2,13 @@ package com.gmail.nossr50.skills.alchemy;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
public class AlchemyManager extends SkillManager {
public AlchemyManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.ALCHEMY);
public AlchemyManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.ALCHEMY);
}
//

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@ -20,8 +21,8 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class ArcheryManager extends SkillManager {
public ArcheryManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.ARCHERY);
public ArcheryManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.ARCHERY);
}
public boolean canDaze(LivingEntity target) {

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Permissions;
@ -19,8 +20,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.Map;
public class AxesManager extends SkillManager {
public AxesManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.AXES);
public AxesManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.AXES);
}
public boolean canUseAxeMastery() {

View File

@ -5,6 +5,7 @@ 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.treasure.ExcavationTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@ -20,8 +21,8 @@ import org.bukkit.entity.Player;
import java.util.List;
public class ExcavationManager extends SkillManager {
public ExcavationManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.EXCAVATION);
public ExcavationManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.EXCAVATION);
}
/**

View File

@ -14,6 +14,7 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.ItemUtils;
@ -57,8 +58,8 @@ public class FishingManager extends SkillManager {
private int fishCaughtCounter;
private int overFishCount;
public FishingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.FISHING);
public FishingManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.FISHING);
fishCaughtCounter = 1;
}

View File

@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.*;
@ -31,8 +32,8 @@ import java.util.List;
public class HerbalismManager extends SkillManager {
public HerbalismManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.HERBALISM);
public HerbalismManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.HERBALISM);
}
public boolean canBlockCheck() {

View File

@ -7,6 +7,7 @@ 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.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.BlockUtils;
@ -27,8 +28,8 @@ import java.util.ArrayList;
import java.util.List;
public class MiningManager extends SkillManager {
public MiningManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.MINING);
public MiningManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.MINING);
}
public static double getOreBonus(int rank) {

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@ -25,8 +26,8 @@ public class RepairManager extends SkillManager {
private boolean placedAnvil;
private int lastClick;
public RepairManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.REPAIR);
public RepairManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.REPAIR);
}
/**

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.util.Misc;
@ -29,8 +30,8 @@ public class SalvageManager extends SkillManager {
private boolean placedAnvil;
private int lastClick;
public SalvageManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.SALVAGE);
public SalvageManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.SALVAGE);
}
/**

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainSource;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.RandomChanceUtil;
@ -15,8 +16,8 @@ import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.inventory.ItemStack;
public class SmeltingManager extends SkillManager {
public SmeltingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.SMELTING);
public SmeltingManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.SMELTING);
}
/*public boolean canUseFluxMining(BlockState blockState) {

View File

@ -6,7 +6,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Permissions;
@ -23,8 +23,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.Map;
public class SwordsManager extends SkillManager {
public SwordsManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.SWORDS);
public SwordsManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.SWORDS);
}
public boolean canActivateAbility() {
@ -69,12 +69,12 @@ public class SwordsManager extends SkillManager {
return;
if (pluginRef.getNotificationManager().doesPlayerUseNotifications(defender)) {
if (!BleedTimerTask.isBleeding(defender))
if (!pluginRef.getBleedTimerTask().isBleeding(defender))
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started");
}
}
BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand()));
pluginRef.getBleedTimerTask().add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand()));
if (mcMMOPlayer.useChatNotifications()) {
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding");

View File

@ -9,7 +9,7 @@ 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.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@ -31,8 +31,8 @@ import java.util.List;
public class TamingManager extends SkillManager {
private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<>();
public TamingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.TAMING);
public TamingManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.TAMING);
}
protected static void addToTracker(LivingEntity livingEntity) {
@ -138,7 +138,7 @@ public class TamingManager extends SkillManager {
return 0;
}
BleedTimerTask.add(target, getPlayer(), Taming.getInstance().getGoreBleedTicks(), 1, 2);
pluginRef.getBleedTimerTask().add(target, getPlayer(), Taming.getInstance().getGoreBleedTicks(), 1, 2);
if (target instanceof Player) {
pluginRef.getNotificationManager().sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore");

View File

@ -7,6 +7,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
@ -23,8 +24,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class UnarmedManager extends SkillManager {
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.UNARMED);
public UnarmedManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.UNARMED);
}
public boolean canActivateAbility() {

View File

@ -6,6 +6,7 @@ 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.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.ItemUtils;
@ -26,8 +27,8 @@ import java.util.Set;
public class WoodcuttingManager extends SkillManager {
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.WOODCUTTING);
public WoodcuttingManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
super(pluginRef, mcMMOPlayer, PrimarySkillType.WOODCUTTING);
}
public boolean canUseLeafBlower(ItemStack heldItem) {

View File

@ -44,7 +44,7 @@ public class RankUtils {
//The players level is the exact level requirement for this skill
if (newLevel == innerMap.get(playerRankInSkill)) {
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType);
skillUnlockNotificationTask.runTaskLater(plugin, (count * 100));