Refactoring McMMOPlayer

This commit is contained in:
nossr50 2019-09-23 16:26:34 -07:00
parent b0803df7c5
commit 3aead73d07
12 changed files with 106 additions and 106 deletions

View File

@ -22,7 +22,7 @@ public class AbilityToggleCommand extends ToggleCommand {
@Override @Override
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) { protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On"))); mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAllowAbilityUse() ? "Off" : "On")));
mcMMOPlayer.toggleAbilityUse(); mcMMOPlayer.toggleAbilityUse();
} }

View File

@ -25,7 +25,7 @@ public class RefreshCooldownsCommand extends ToggleCommand {
mcMMOPlayer.setRecentlyHurt(0); mcMMOPlayer.setRecentlyHurt(0);
mcMMOPlayer.resetCooldowns(); mcMMOPlayer.resetCooldowns();
mcMMOPlayer.resetToolPrepMode(); mcMMOPlayer.resetToolPrepMode();
mcMMOPlayer.resetAbilityMode(); mcMMOPlayer.resetSuperAbilityMode();
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh")); mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh"));
} }

View File

@ -50,10 +50,10 @@ import java.util.UUID;
public class McMMOPlayer { public class McMMOPlayer {
private final mcMMO pluginRef; private final mcMMO pluginRef;
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>(); private final Map<PrimarySkillType, SkillManager> skillManagerMap = new HashMap<>();
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<>(); private final Map<SuperAbilityType, Boolean> superAbilityModeMap = new HashMap<>();
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<>(); private final Map<SuperAbilityType, Boolean> superAbilityInformedMap = new HashMap<>();
private final Map<ToolType, Boolean> toolMode = new HashMap<>(); private final Map<ToolType, Boolean> toolModeMap = new HashMap<>();
private final FixedMetadataValue playerMetadata; private final FixedMetadataValue playerMetadata;
private Player player; private Player player;
private PlayerProfile profile; private PlayerProfile profile;
@ -68,7 +68,7 @@ public class McMMOPlayer {
private boolean displaySkillNotifications = true; private boolean displaySkillNotifications = true;
private boolean debugMode; private boolean debugMode;
private boolean abilityUse = true; private boolean allowAbilityUse = true;
private boolean godMode; private boolean godMode;
private boolean chatSpy = false; //Off by default private boolean chatSpy = false; //Off by default
private int recentlyHurt; private int recentlyHurt;
@ -98,12 +98,12 @@ public class McMMOPlayer {
initSkillManagers(); initSkillManagers();
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) { for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
abilityMode.put(superAbilityType, false); superAbilityModeMap.put(superAbilityType, false);
abilityInformed.put(superAbilityType, true); // This is intended superAbilityInformedMap.put(superAbilityType, true); // This is intended
} }
for (ToolType toolType : ToolType.values()) { for (ToolType toolType : ToolType.values()) {
toolMode.put(toolType, false); toolModeMap.put(toolType, false);
} }
experienceBarManager = new ExperienceBarManager(pluginRef,this); experienceBarManager = new ExperienceBarManager(pluginRef,this);
@ -124,49 +124,49 @@ public class McMMOPlayer {
private void initManager(PrimarySkillType primarySkillType) throws InvalidSkillException { private void initManager(PrimarySkillType primarySkillType) throws InvalidSkillException {
switch(primarySkillType) { switch(primarySkillType) {
case ACROBATICS: case ACROBATICS:
skillManagers.put(primarySkillType, new AcrobaticsManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new AcrobaticsManager(pluginRef, this));
break; break;
case ALCHEMY: case ALCHEMY:
skillManagers.put(primarySkillType, new AlchemyManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new AlchemyManager(pluginRef, this));
break; break;
case ARCHERY: case ARCHERY:
skillManagers.put(primarySkillType, new ArcheryManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new ArcheryManager(pluginRef, this));
break; break;
case AXES: case AXES:
skillManagers.put(primarySkillType, new AxesManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new AxesManager(pluginRef, this));
break; break;
case EXCAVATION: case EXCAVATION:
skillManagers.put(primarySkillType, new ExcavationManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new ExcavationManager(pluginRef, this));
break; break;
case FISHING: case FISHING:
skillManagers.put(primarySkillType, new FishingManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new FishingManager(pluginRef, this));
break; break;
case HERBALISM: case HERBALISM:
skillManagers.put(primarySkillType, new HerbalismManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new HerbalismManager(pluginRef, this));
break; break;
case MINING: case MINING:
skillManagers.put(primarySkillType, new MiningManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new MiningManager(pluginRef, this));
break; break;
case REPAIR: case REPAIR:
skillManagers.put(primarySkillType, new RepairManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new RepairManager(pluginRef, this));
break; break;
case SALVAGE: case SALVAGE:
skillManagers.put(primarySkillType, new SalvageManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new SalvageManager(pluginRef, this));
break; break;
case SMELTING: case SMELTING:
skillManagers.put(primarySkillType, new SmeltingManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new SmeltingManager(pluginRef, this));
break; break;
case SWORDS: case SWORDS:
skillManagers.put(primarySkillType, new SwordsManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new SwordsManager(pluginRef, this));
break; break;
case TAMING: case TAMING:
skillManagers.put(primarySkillType, new TamingManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new TamingManager(pluginRef, this));
break; break;
case UNARMED: case UNARMED:
skillManagers.put(primarySkillType, new UnarmedManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new UnarmedManager(pluginRef, this));
break; break;
case WOODCUTTING: case WOODCUTTING:
skillManagers.put(primarySkillType, new WoodcuttingManager(pluginRef, this)); skillManagerMap.put(primarySkillType, new WoodcuttingManager(pluginRef, this));
break; break;
default: default:
throw new InvalidSkillException("The skill named has no manager! Contact the devs!"); throw new InvalidSkillException("The skill named has no manager! Contact the devs!");
@ -255,63 +255,63 @@ public class McMMOPlayer {
} }
public AcrobaticsManager getAcrobaticsManager() { public AcrobaticsManager getAcrobaticsManager() {
return (AcrobaticsManager) skillManagers.get(PrimarySkillType.ACROBATICS); return (AcrobaticsManager) skillManagerMap.get(PrimarySkillType.ACROBATICS);
} }
public AlchemyManager getAlchemyManager() { public AlchemyManager getAlchemyManager() {
return (AlchemyManager) skillManagers.get(PrimarySkillType.ALCHEMY); return (AlchemyManager) skillManagerMap.get(PrimarySkillType.ALCHEMY);
} }
public ArcheryManager getArcheryManager() { public ArcheryManager getArcheryManager() {
return (ArcheryManager) skillManagers.get(PrimarySkillType.ARCHERY); return (ArcheryManager) skillManagerMap.get(PrimarySkillType.ARCHERY);
} }
public AxesManager getAxesManager() { public AxesManager getAxesManager() {
return (AxesManager) skillManagers.get(PrimarySkillType.AXES); return (AxesManager) skillManagerMap.get(PrimarySkillType.AXES);
} }
public ExcavationManager getExcavationManager() { public ExcavationManager getExcavationManager() {
return (ExcavationManager) skillManagers.get(PrimarySkillType.EXCAVATION); return (ExcavationManager) skillManagerMap.get(PrimarySkillType.EXCAVATION);
} }
public FishingManager getFishingManager() { public FishingManager getFishingManager() {
return (FishingManager) skillManagers.get(PrimarySkillType.FISHING); return (FishingManager) skillManagerMap.get(PrimarySkillType.FISHING);
} }
public HerbalismManager getHerbalismManager() { public HerbalismManager getHerbalismManager() {
return (HerbalismManager) skillManagers.get(PrimarySkillType.HERBALISM); return (HerbalismManager) skillManagerMap.get(PrimarySkillType.HERBALISM);
} }
public MiningManager getMiningManager() { public MiningManager getMiningManager() {
return (MiningManager) skillManagers.get(PrimarySkillType.MINING); return (MiningManager) skillManagerMap.get(PrimarySkillType.MINING);
} }
public RepairManager getRepairManager() { public RepairManager getRepairManager() {
return (RepairManager) skillManagers.get(PrimarySkillType.REPAIR); return (RepairManager) skillManagerMap.get(PrimarySkillType.REPAIR);
} }
public SalvageManager getSalvageManager() { public SalvageManager getSalvageManager() {
return (SalvageManager) skillManagers.get(PrimarySkillType.SALVAGE); return (SalvageManager) skillManagerMap.get(PrimarySkillType.SALVAGE);
} }
public SmeltingManager getSmeltingManager() { public SmeltingManager getSmeltingManager() {
return (SmeltingManager) skillManagers.get(PrimarySkillType.SMELTING); return (SmeltingManager) skillManagerMap.get(PrimarySkillType.SMELTING);
} }
public SwordsManager getSwordsManager() { public SwordsManager getSwordsManager() {
return (SwordsManager) skillManagers.get(PrimarySkillType.SWORDS); return (SwordsManager) skillManagerMap.get(PrimarySkillType.SWORDS);
} }
public TamingManager getTamingManager() { public TamingManager getTamingManager() {
return (TamingManager) skillManagers.get(PrimarySkillType.TAMING); return (TamingManager) skillManagerMap.get(PrimarySkillType.TAMING);
} }
public UnarmedManager getUnarmedManager() { public UnarmedManager getUnarmedManager() {
return (UnarmedManager) skillManagers.get(PrimarySkillType.UNARMED); return (UnarmedManager) skillManagerMap.get(PrimarySkillType.UNARMED);
} }
public WoodcuttingManager getWoodcuttingManager() { public WoodcuttingManager getWoodcuttingManager() {
return (WoodcuttingManager) skillManagers.get(PrimarySkillType.WOODCUTTING); return (WoodcuttingManager) skillManagerMap.get(PrimarySkillType.WOODCUTTING);
} }
/* /*
@ -321,69 +321,69 @@ public class McMMOPlayer {
/** /**
* Reset the mode of all abilities. * Reset the mode of all abilities.
*/ */
public void resetAbilityMode() { public void resetSuperAbilityMode() {
for (SuperAbilityType ability : SuperAbilityType.values()) { for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
// Correctly disable and handle any special deactivate code // Correctly disable and handle any special deactivate code
new AbilityDisableTask(pluginRef,this, ability).run(); new AbilityDisableTask(pluginRef,this, superAbilityType).run();
} }
} }
/** /**
* Get the mode of an ability. * Get the mode of an ability.
* *
* @param ability The ability to check * @param superAbilityType The ability to check
* @return true if the ability is enabled, false otherwise * @return true if the ability is enabled, false otherwise
*/ */
public boolean getAbilityMode(SuperAbilityType ability) { public boolean getSuperAbilityMode(SuperAbilityType superAbilityType) {
return abilityMode.get(ability); return superAbilityModeMap.get(superAbilityType);
} }
/** /**
* Set the mode of an ability. * Set the mode of an ability.
* *
* @param ability The ability to check * @param superAbilityType The ability to check
* @param isActive True if the ability is active, false otherwise * @param isActive True if the ability is active, false otherwise
*/ */
public void setAbilityMode(SuperAbilityType ability, boolean isActive) { public void setSuperAbilityMode(SuperAbilityType superAbilityType, boolean isActive) {
abilityMode.put(ability, isActive); superAbilityModeMap.put(superAbilityType, isActive);
} }
/** /**
* Get the informed state of an ability * Get the informed state of an ability
* *
* @param ability The ability to check * @param superAbilityType The ability to check
* @return true if the ability is informed, false otherwise * @return true if the ability is informed, false otherwise
*/ */
public boolean getAbilityInformed(SuperAbilityType ability) { public boolean getSuperAbilityInformed(SuperAbilityType superAbilityType) {
return abilityInformed.get(ability); return superAbilityInformedMap.get(superAbilityType);
} }
/** /**
* Set the informed state of an ability. * Set the informed state of an ability.
* *
* @param ability The ability to check * @param superAbilityType The ability to check
* @param isInformed True if the ability is informed, false otherwise * @param isInformed True if the ability is informed, false otherwise
*/ */
public void setAbilityInformed(SuperAbilityType ability, boolean isInformed) { public void setAbilityInformed(SuperAbilityType superAbilityType, boolean isInformed) {
abilityInformed.put(ability, isInformed); superAbilityInformedMap.put(superAbilityType, isInformed);
} }
/** /**
* Get the current prep mode of a tool. * Get the current prep mode of a tool.
* *
* @param tool Tool to get the mode for * @param toolType Tool to get the mode for
* @return true if the tool is prepped, false otherwise * @return true if the tool is prepped, false otherwise
*/ */
public boolean getToolPreparationMode(ToolType tool) { public boolean getToolPreparationMode(ToolType toolType) {
return toolMode.get(tool); return toolModeMap.get(toolType);
} }
public boolean getAbilityUse() { public boolean getAllowAbilityUse() {
return abilityUse; return allowAbilityUse;
} }
public void toggleAbilityUse() { public void toggleAbilityUse() {
abilityUse = !abilityUse; allowAbilityUse = !allowAbilityUse;
} }
/* /*
@ -402,11 +402,11 @@ public class McMMOPlayer {
/** /**
* Set the current prep mode of a tool. * Set the current prep mode of a tool.
* *
* @param tool Tool to set the mode for * @param toolType Tool to set the mode for
* @param isPrepared true if the tool should be prepped, false otherwise * @param isPrepared true if the tool should be prepped, false otherwise
*/ */
public void setToolPreparationMode(ToolType tool, boolean isPrepared) { public void setToolPreparationMode(ToolType toolType, boolean isPrepared) {
toolMode.put(tool, isPrepared); toolModeMap.put(toolType, isPrepared);
} }
/* /*
@ -901,7 +901,7 @@ public class McMMOPlayer {
ToolType tool = pluginRef.getSkillTools().getPrimarySkillToolType(primarySkillType); ToolType tool = pluginRef.getSkillTools().getPrimarySkillToolType(primarySkillType);
SuperAbilityType superAbility = pluginRef.getSkillTools().getSuperAbility(primarySkillType); SuperAbilityType superAbility = pluginRef.getSkillTools().getSuperAbility(primarySkillType);
if (getAbilityMode(superAbility) || !pluginRef.getSkillTools().superAbilityPermissionCheck(superAbility, player)) { if (getSuperAbilityMode(superAbility) || !pluginRef.getSkillTools().superAbilityPermissionCheck(superAbility, player)) {
return; return;
} }
@ -948,7 +948,7 @@ public class McMMOPlayer {
// Enable the ability // Enable the ability
profile.setAbilityDATS(superAbility, System.currentTimeMillis() + (abilityLength * Misc.TIME_CONVERSION_FACTOR)); profile.setAbilityDATS(superAbility, System.currentTimeMillis() + (abilityLength * Misc.TIME_CONVERSION_FACTOR));
setAbilityMode(superAbility, true); setSuperAbilityMode(superAbility, true);
if (superAbility == SuperAbilityType.SUPER_BREAKER || superAbility == SuperAbilityType.GIGA_DRILL_BREAKER) { if (superAbility == SuperAbilityType.SUPER_BREAKER || superAbility == SuperAbilityType.GIGA_DRILL_BREAKER) {
pluginRef.getSkillTools().handleAbilitySpeedIncrease(player); pluginRef.getSkillTools().handleAbilitySpeedIncrease(player);
@ -969,12 +969,12 @@ public class McMMOPlayer {
return; return;
}*/ }*/
if (!getAbilityUse()) { if (!getAllowAbilityUse()) {
return; return;
} }
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) { for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
if (getAbilityMode(superAbilityType)) { if (getSuperAbilityMode(superAbilityType)) {
return; return;
} }
} }
@ -990,7 +990,7 @@ public class McMMOPlayer {
if (primarySkillType != PrimarySkillType.WOODCUTTING && primarySkillType != PrimarySkillType.AXES) { if (primarySkillType != PrimarySkillType.WOODCUTTING && primarySkillType != PrimarySkillType.AXES) {
int timeRemaining = calculateTimeRemaining(ability); int timeRemaining = calculateTimeRemaining(ability);
if (!getAbilityMode(ability) && timeRemaining > 0) { if (!getSuperAbilityMode(ability) && timeRemaining > 0) {
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining)); pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
return; return;
} }
@ -1021,44 +1021,44 @@ public class McMMOPlayer {
/* /*
* These functions are wrapped from PlayerProfile so that we don't always have to store it alongside the McMMOPlayer object. * These functions are wrapped from PlayerProfile so that we don't always have to store it alongside the McMMOPlayer object.
*/ */
public int getSkillLevel(PrimarySkillType skill) { public int getSkillLevel(PrimarySkillType primarySkillType) {
return profile.getSkillLevel(skill); return profile.getSkillLevel(primarySkillType);
} }
public double getSkillXpLevelRaw(PrimarySkillType skill) { public double getSkillXpLevelRaw(PrimarySkillType primarySkillType) {
return profile.getSkillXpLevelRaw(skill); return profile.getSkillXpLevelRaw(primarySkillType);
} }
public int getSkillXpLevel(PrimarySkillType skill) { public int getSkillXpLevel(PrimarySkillType primarySkillType) {
return profile.getSkillXpLevel(skill); return profile.getSkillXpLevel(primarySkillType);
} }
public void setSkillXpLevel(PrimarySkillType skill, double xpLevel) { public void setSkillXpLevel(PrimarySkillType primarySkillType, double xpLevel) {
profile.setSkillXpLevel(skill, xpLevel); profile.setSkillXpLevel(primarySkillType, xpLevel);
} }
public int getXpToLevel(PrimarySkillType skill) { public int getXpToLevel(PrimarySkillType primarySkillType) {
return profile.getXpToLevel(skill); return profile.getXpToLevel(primarySkillType);
} }
public void removeXp(PrimarySkillType skill, int xp) { public void removeXp(PrimarySkillType primarySkillType, int xp) {
profile.removeXp(skill, xp); profile.removeXp(primarySkillType, xp);
} }
public void modifySkill(PrimarySkillType skill, int level) { public void modifySkill(PrimarySkillType primarySkillType, int level) {
profile.modifySkill(skill, level); profile.modifySkill(primarySkillType, level);
} }
public void addLevels(PrimarySkillType skill, int levels) { public void addLevels(PrimarySkillType primarySkillType, int levels) {
profile.addLevels(skill, levels); profile.addLevels(primarySkillType, levels);
} }
public void addXp(PrimarySkillType skill, double xp) { public void addXp(PrimarySkillType primarySkillType, double xp) {
profile.addXp(skill, xp); profile.addXp(primarySkillType, xp);
} }
public void setAbilityDATS(SuperAbilityType ability, long DATS) { public void setAbilityDATS(SuperAbilityType superAbilityType, long DATS) {
profile.setAbilityDATS(ability, DATS); profile.setAbilityDATS(superAbilityType, DATS);
} }
public void resetCooldowns() { public void resetCooldowns() {
@ -1076,7 +1076,7 @@ public class McMMOPlayer {
*/ */
public void logout(boolean syncSave) { public void logout(boolean syncSave) {
Player thisPlayer = getPlayer(); Player thisPlayer = getPlayer();
resetAbilityMode(); resetSuperAbilityMode();
pluginRef.getBleedTimerTask().bleedOut(thisPlayer); pluginRef.getBleedTimerTask().bleedOut(thisPlayer);
cleanup(); cleanup();
@ -1106,7 +1106,7 @@ public class McMMOPlayer {
* Etc... * Etc...
*/ */
public void cleanup() { public void cleanup() {
resetAbilityMode(); resetSuperAbilityMode();
getTamingManager().cleanupAllSummons(); getTamingManager().cleanupAllSummons();
} }
} }

View File

@ -321,7 +321,7 @@ public class BlockListener implements Listener {
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager(); ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
excavationManager.excavationBlockCheck(blockState); excavationManager.excavationBlockCheck(blockState);
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER)) { if (mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER)) {
excavationManager.gigaDrillBreaker(blockState); excavationManager.gigaDrillBreaker(blockState);
} }
} }
@ -512,11 +512,11 @@ public class BlockListener implements Listener {
* *
* We don't need to check permissions here because they've already been checked for the ability to even activate. * We don't need to check permissions here because they've already been checked for the ability to even activate.
*/ */
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && pluginRef.getBlockTools().canMakeMossy(blockState)) { if (mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.GREEN_TERRA) && pluginRef.getBlockTools().canMakeMossy(blockState)) {
if (mcMMOPlayer.getHerbalismManager().processGreenTerraBlockConversion(blockState)) { if (mcMMOPlayer.getHerbalismManager().processGreenTerraBlockConversion(blockState)) {
blockState.update(true); blockState.update(true);
} }
} else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && heldItem.getType() == Material.AIR) { } else if (mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
if (pluginRef.getSkillTools().superAbilityBlockCheck(SuperAbilityType.BERSERK, block.getState()) if (pluginRef.getSkillTools().superAbilityBlockCheck(SuperAbilityType.BERSERK, block.getState())
&& pluginRef.getEventManager().simulateBlockBreak(block, player, true)) { && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
event.setInstaBreak(true); event.setInstaBreak(true);

View File

@ -19,7 +19,7 @@ public class AbilityCooldownTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if (!mcMMOPlayer.getPlayer().isOnline() || mcMMOPlayer.getAbilityInformed(ability)) { if (!mcMMOPlayer.getPlayer().isOnline() || mcMMOPlayer.getSuperAbilityInformed(ability)) {
return; return;
} }

View File

@ -24,7 +24,7 @@ public class AbilityDisableTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if (!mcMMOPlayer.getAbilityMode(superAbilityType)) { if (!mcMMOPlayer.getSuperAbilityMode(superAbilityType)) {
return; return;
} }
@ -46,7 +46,7 @@ public class AbilityDisableTask extends BukkitRunnable {
pluginRef.getEventManager().callAbilityDeactivateEvent(player, superAbilityType); pluginRef.getEventManager().callAbilityDeactivateEvent(player, superAbilityType);
mcMMOPlayer.setAbilityMode(superAbilityType, false); mcMMOPlayer.setSuperAbilityMode(superAbilityType, false);
mcMMOPlayer.setAbilityInformed(superAbilityType, false); mcMMOPlayer.setAbilityInformed(superAbilityType, false);
if (mcMMOPlayer.useChatNotifications()) { if (mcMMOPlayer.useChatNotifications()) {

View File

@ -59,7 +59,7 @@ public class AxesManager extends SkillManager {
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_SKULL_SPLITTER)) if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_SKULL_SPLITTER))
return false; return false;
return target.isValid() && mcMMOPlayer.getAbilityMode(SuperAbilityType.SKULL_SPLITTER) && pluginRef.getPermissionTools().skullSplitter(getPlayer()); return target.isValid() && mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.SKULL_SPLITTER) && pluginRef.getPermissionTools().skullSplitter(getPlayer());
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {

View File

@ -80,7 +80,7 @@ public class HerbalismManager extends SkillManager {
} }
public boolean canGreenTerraBlock(BlockState blockState) { public boolean canGreenTerraBlock(BlockState blockState) {
return mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && pluginRef.getBlockTools().canMakeMossy(blockState); return mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.GREEN_TERRA) && pluginRef.getBlockTools().canMakeMossy(blockState);
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {
@ -88,7 +88,7 @@ public class HerbalismManager extends SkillManager {
} }
public boolean isGreenTerraActive() { public boolean isGreenTerraActive() {
return mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA); return mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.GREEN_TERRA);
} }
/** /**
@ -283,7 +283,7 @@ public class HerbalismManager extends SkillManager {
public void markForBonusDrops(BlockState brokenPlantState) { public void markForBonusDrops(BlockState brokenPlantState) {
//Add metadata to mark this block for double or triple drops //Add metadata to mark this block for double or triple drops
boolean awardTriple = mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA); boolean awardTriple = mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.GREEN_TERRA);
pluginRef.getBlockTools().markDropsAsBonus(brokenPlantState, awardTriple); pluginRef.getBlockTools().markDropsAsBonus(brokenPlantState, awardTriple);
} }

View File

@ -87,7 +87,7 @@ public class MiningManager extends SkillManager {
applyXpGain(miningBehaviour.getBlockXp(blockState), XPGainReason.PVE); applyXpGain(miningBehaviour.getBlockXp(blockState), XPGainReason.PVE);
if (mcMMOPlayer.getAbilityMode(skill.getSuperAbility())) { if (mcMMOPlayer.getSuperAbilityMode(skill.getSuperAbility())) {
pluginRef.getSkillTools().handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage()); pluginRef.getSkillTools().handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage());
} }
@ -101,7 +101,7 @@ public class MiningManager extends SkillManager {
//TODO: Make this readable //TODO: Make this readable
if (pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS)) { if (pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS)) {
pluginRef.getBlockTools().markDropsAsBonus(blockState, mcMMOPlayer.getAbilityMode(skill.getSuperAbility())); pluginRef.getBlockTools().markDropsAsBonus(blockState, mcMMOPlayer.getSuperAbilityMode(skill.getSuperAbility()));
} }
} }

View File

@ -45,7 +45,7 @@ public class SwordsManager extends SkillManager {
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_SERRATED_STRIKES)) if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_SERRATED_STRIKES))
return false; return false;
return mcMMOPlayer.getAbilityMode(SuperAbilityType.SERRATED_STRIKES); return mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.SERRATED_STRIKES);
} }
/** /**

View File

@ -47,7 +47,7 @@ public class UnarmedManager extends SkillManager {
} }
public boolean canUseBerserk() { public boolean canUseBerserk() {
return mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK); return mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.BERSERK);
} }
public boolean canDisarm(LivingEntity target) { public boolean canDisarm(LivingEntity target) {

View File

@ -41,7 +41,7 @@ public class WoodcuttingManager extends SkillManager {
} }
public boolean canUseTreeFeller(ItemStack heldItem) { public boolean canUseTreeFeller(ItemStack heldItem) {
return mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER) return mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.TREE_FELLER)
&& pluginRef.getItemTools().isAxe(heldItem); && pluginRef.getItemTools().isAxe(heldItem);
} }