mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-12-08 18:28:47 +01:00
Static Abuse Removal - Skill Tasks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user