Updating various classes for the new SkillTools class

This commit is contained in:
nossr50 2019-07-04 05:42:15 -07:00
parent 381eba8ddc
commit e001dea4d7
12 changed files with 71 additions and 65 deletions

View File

@ -44,6 +44,6 @@ public class AddLevelsCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.1", value, skill.getLocalizedSkillName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.1", value, pluginRef.getSkillTools().getLocalizedSkillName(skill)));
} }
} }

View File

@ -46,6 +46,6 @@ public class AddXPCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addxp.AwardSkill", value, skill.getLocalizedSkillName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addxp.AwardSkill", value, pluginRef.getSkillTools().getLocalizedSkillName(skill)));
} }
} }

View File

@ -28,7 +28,7 @@ public abstract class ExperienceCommand implements TabExecutor {
if (skill == null) { if (skill == null) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName));
} else { } else {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedSkillName(), playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", pluginRef.getSkillTools().getLocalizedSkillName(skill), playerName));
} }
} }
@ -51,13 +51,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
skill = PrimarySkillType.matchSkill(args[0]); skill = pluginRef.getSkillTools().matchSkill(args[0]);
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; skill = null;
} }
if (skill != null && skill.isChildSkill()) { if (skill != null && pluginRef.getSkillTools().isChildSkill(skill)) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.ChildSkill")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
@ -82,13 +82,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
skill = PrimarySkillType.matchSkill(args[1]); skill = pluginRef.getSkillTools().matchSkill(args[1]);
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; skill = null;
} }
if (skill != null && skill.isChildSkill()) { if (skill != null && pluginRef.getSkillTools().isChildSkill(skill)) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.ChildSkill")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
@ -131,7 +131,7 @@ public abstract class ExperienceCommand implements TabExecutor {
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender); List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
case 2: case 2:
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], pluginRef.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(pluginRef.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
} }

View File

@ -49,6 +49,6 @@ public class SkillEditCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoedit.Modified.1", skill.getLocalizedSkillName(), value)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoedit.Modified.1", pluginRef.getSkillTools().getLocalizedSkillName(skill), value));
} }
} }

View File

@ -34,7 +34,7 @@ public class SkillResetCommand implements TabExecutor {
if (skill == null) { if (skill == null) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName));
} else { } else {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedSkillName(), playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", pluginRef.getSkillTools().getLocalizedSkillName(skill), playerName));
} }
} }
@ -59,7 +59,7 @@ public class SkillResetCommand implements TabExecutor {
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
skill = null; skill = null;
} else { } else {
skill = PrimarySkillType.matchSkill(args[1]); skill = pluginRef.getSkillTools().matchSkill(args[1]);
} }
editValues((Player) sender, pluginRef.getUserManager().getPlayer(sender.getName()).getProfile(), skill); editValues((Player) sender, pluginRef.getUserManager().getPlayer(sender.getName()).getProfile(), skill);
@ -78,7 +78,7 @@ public class SkillResetCommand implements TabExecutor {
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; skill = null;
} else { } else {
skill = PrimarySkillType.matchSkill(args[1]); skill = pluginRef.getSkillTools().matchSkill(args[1]);
} }
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]); String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
@ -117,7 +117,7 @@ public class SkillResetCommand implements TabExecutor {
List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender); List<String> playerNames = pluginRef.getCommandTools().getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
case 2: case 2:
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], pluginRef.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(pluginRef.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
} }
@ -150,7 +150,7 @@ public class SkillResetCommand implements TabExecutor {
} }
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) {
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Reset.Single", skill.getLocalizedSkillName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Reset.Single", pluginRef.getSkillTools().getLocalizedSkillName(skill)));
} }
private boolean validateArguments(CommandSender sender, String skillName) { private boolean validateArguments(CommandSender sender, String skillName) {

View File

@ -73,7 +73,7 @@ public class LeaderboardCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[0], pluginRef.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(pluginRef.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
} }

View File

@ -182,7 +182,7 @@ public class McMMOPlayer {
//Check each skill for custom XP perks //Check each skill for custom XP perks
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
//Skip over child skills //Skip over child skills
if (primarySkillType.isChildSkill()) if (pluginRef.getSkillTools().isChildSkill(primarySkillType))
continue; continue;
//Set the players custom XP modifier, defaults to 1.0D on missing entries //Set the players custom XP modifier, defaults to 1.0D on missing entries
@ -216,7 +216,9 @@ public class McMMOPlayer {
if(hasReachedPowerLevelCap()) { if(hasReachedPowerLevelCap()) {
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(pluginRef.getConfigManager().getConfigLeveling().getPowerLevelCap())); pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(pluginRef.getConfigManager().getConfigLeveling().getPowerLevelCap()));
} else if(hasReachedLevelCap(primarySkillType)) { } else if(hasReachedLevelCap(primarySkillType)) {
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "LevelCap.Skill", String.valueOf(pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(primarySkillType)), primarySkillType.getLocalizedSkillName()); pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "LevelCap.Skill",
String.valueOf(pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(primarySkillType)),
pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType));
} }
//Updates from Party sources //Updates from Party sources
@ -237,7 +239,7 @@ public class McMMOPlayer {
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) { public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
//Skill Unlock Notifications //Skill Unlock Notifications
if (primarySkillType.isChildSkill()) if (pluginRef.getSkillTools().isChildSkill(primarySkillType))
return; return;
//XP BAR UPDATES //XP BAR UPDATES
@ -518,9 +520,9 @@ public class McMMOPlayer {
public int getPowerLevel() { public int getPowerLevel() {
int powerLevel = 0; int powerLevel = 0;
for (PrimarySkillType type : pluginRef.getSkillTools().NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : pluginRef.getSkillTools().NON_CHILD_SKILLS) {
if (type.doesPlayerHaveSkillPermission(player)) { if (pluginRef.getSkillTools().doesPlayerHaveSkillPermission(primarySkillType, player)) {
powerLevel += getSkillLevel(type); powerLevel += getSkillLevel(primarySkillType);
} }
} }
@ -555,22 +557,22 @@ public class McMMOPlayer {
/** /**
* Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party * Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party
* *
* @param skill Skill being used * @param primarySkillType Skill being used
* @param xp Experience amount to process * @param xp Experience amount to process
*/ */
public void beginXpGain(PrimarySkillType skill, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) { public void beginXpGain(PrimarySkillType primarySkillType, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero."); Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
if (xp <= 0.0) { if (xp <= 0.0) {
return; return;
} }
if (skill.isChildSkill()) { if (pluginRef.getSkillTools().isChildSkill(primarySkillType)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill); Set<PrimarySkillType> parentSkills = FamilyTree.getParents(primarySkillType);
double splitXp = xp / parentSkills.size(); double splitXp = xp / parentSkills.size();
for (PrimarySkillType parentSkill : parentSkills) { for (PrimarySkillType parentSkill : parentSkills) {
if (parentSkill.doesPlayerHaveSkillPermission(player)) { if (pluginRef.getSkillTools().doesPlayerHaveSkillPermission(parentSkill, player)) {
beginXpGain(parentSkill, splitXp, xpGainReason, xpGainSource); beginXpGain(parentSkill, splitXp, xpGainReason, xpGainSource);
} }
} }
@ -579,11 +581,11 @@ public class McMMOPlayer {
} }
// Return if the experience has been shared // Return if the experience has been shared
if (party != null && party.getShareHandler().handleXpShare(xp, this, skill, party.getShareHandler().getSharedXpGainReason(xpGainReason))) { if (party != null && party.getShareHandler().handleXpShare(xp, this, primarySkillType, party.getShareHandler().getSharedXpGainReason(xpGainReason))) {
return; return;
} }
beginUnsharedXpGain(skill, xp, xpGainReason, xpGainSource); beginUnsharedXpGain(primarySkillType, xp, xpGainReason, xpGainSource);
} }
/** /**
@ -614,11 +616,11 @@ public class McMMOPlayer {
* @param xp Experience amount to add * @param xp Experience amount to add
*/ */
public void applyXpGain(PrimarySkillType primarySkillType, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) { public void applyXpGain(PrimarySkillType primarySkillType, double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if (!primarySkillType.doesPlayerHaveSkillPermission(player)) { if (!pluginRef.getSkillTools().doesPlayerHaveSkillPermission(primarySkillType, player)) {
return; return;
} }
if (primarySkillType.isChildSkill()) { if (pluginRef.getSkillTools().isChildSkill(primarySkillType)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(primarySkillType); Set<PrimarySkillType> parentSkills = FamilyTree.getParents(primarySkillType);
for (PrimarySkillType parentSkill : parentSkills) { for (PrimarySkillType parentSkill : parentSkills) {
@ -849,13 +851,13 @@ public class McMMOPlayer {
* @return Modified experience * @return Modified experience
*/ */
private double modifyXpGain(PrimarySkillType primarySkillType, double xp) { private double modifyXpGain(PrimarySkillType primarySkillType, double xp) {
if (((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) if (((pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(primarySkillType) <= getSkillLevel(primarySkillType))
&& pluginRef.getPlayerLevelingSettings().isSkillLevelCapEnabled(primarySkillType)) && pluginRef.getPlayerLevelingSettings().isSkillLevelCapEnabled(primarySkillType))
|| (pluginRef.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap() <= getPowerLevel())) { || (pluginRef.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap() <= getPowerLevel())) {
return 0; return 0;
} }
xp = (double) (xp / primarySkillType.getXpModifier() * pluginRef.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult()); xp = (double) (xp / pluginRef.getSkillTools().getXpModifier(primarySkillType) * pluginRef.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult());
//Multiply by the players personal XP rate //Multiply by the players personal XP rate
return xp * personalXPModifiers.get(primarySkillType); return xp * personalXPModifiers.get(primarySkillType);
@ -879,23 +881,24 @@ public class McMMOPlayer {
/** /**
* Check to see if an ability can be activated. * Check to see if an ability can be activated.
* *
* @param skill The skill the ability is based on * @param primarySkillType The skill the ability is based on
*/ */
public void checkAbilityActivation(PrimarySkillType skill) { public void checkAbilityActivation(PrimarySkillType primarySkillType) {
ToolType tool = skill.getPrimarySkillToolType(); //TODO: Disgusting..
SuperAbilityType ability = skill.getSuperAbility(); ToolType tool = pluginRef.getSkillTools().getPrimarySkillToolType(primarySkillType);
SuperAbilityType ability = pluginRef.getSkillTools().getSuperAbility(primarySkillType);
if (getAbilityMode(ability) || !ability.getPermissions(player)) { if (getAbilityMode(ability) || !ability.getPermissions(player)) {
return; return;
} }
//TODO: This is hacky and temporary solution until skills are move to the new system //TODO: This is hacky and temporary solution until skills are moved to the new system
//Potential problems with this include skills with two super abilities (ie mining) //Potential problems with this include skills with two super abilities (ie mining)
if (!skill.isSuperAbilityUnlocked(getPlayer())) { if (!pluginRef.getSkillTools().isSuperAbilityUnlocked(primarySkillType, getPlayer())) {
int diff = RankUtils.getSuperAbilityUnlockRequirement(skill.getSuperAbility()) - getSkillLevel(skill); int diff = RankUtils.getSuperAbilityUnlockRequirement(pluginRef.getSkillTools().getSuperAbility(primarySkillType)) - getSkillLevel(primarySkillType);
//Inform the player they are not yet skilled enough //Inform the player they are not yet skilled enough
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), skill.getLocalizedSkillName()); pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType));
return; return;
} }
@ -906,7 +909,7 @@ public class McMMOPlayer {
* Axes and Woodcutting are odd because they share the same tool. * Axes and Woodcutting are odd because they share the same tool.
* We show them the too tired message when they take action. * We show them the too tired message when they take action.
*/ */
if (skill == PrimarySkillType.WOODCUTTING || skill == PrimarySkillType.AXES) { if (primarySkillType == PrimarySkillType.WOODCUTTING || primarySkillType == PrimarySkillType.AXES) {
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining)); pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
//SoundManager.sendSound(player, player.getLocation(), SoundType.TIRED); //SoundManager.sendSound(player, player.getLocation(), SoundType.TIRED);
} }
@ -914,7 +917,7 @@ public class McMMOPlayer {
return; return;
} }
if (pluginRef.getEventManager().callPlayerAbilityActivateEvent(player, skill).isCancelled()) { if (pluginRef.getEventManager().callPlayerAbilityActivateEvent(player, primarySkillType).isCancelled()) {
return; return;
} }
@ -928,7 +931,7 @@ public class McMMOPlayer {
//Sounds //Sounds
SoundManager.worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC); SoundManager.worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
int abilityLength = pluginRef.getSkillTools().calculateAbilityLengthPerks(this, skill, ability); int abilityLength = pluginRef.getSkillTools().calculateAbilityLengthPerks(this, primarySkillType, ability);
// Enable the ability // Enable the ability
profile.setAbilityDATS(ability, System.currentTimeMillis() + (abilityLength * Misc.TIME_CONVERSION_FACTOR)); profile.setAbilityDATS(ability, System.currentTimeMillis() + (abilityLength * Misc.TIME_CONVERSION_FACTOR));
@ -942,7 +945,7 @@ public class McMMOPlayer {
new AbilityDisableTask(pluginRef, this, ability).runTaskLater(pluginRef, abilityLength * Misc.TICK_CONVERSION_FACTOR); new AbilityDisableTask(pluginRef, this, ability).runTaskLater(pluginRef, abilityLength * Misc.TICK_CONVERSION_FACTOR);
} }
public void processAbilityActivation(PrimarySkillType skill) { public void processAbilityActivation(PrimarySkillType primarySkillType) {
if (pluginRef.getConfigManager().getConfigSuperAbilities().isMustSneakToActivate() && !player.isSneaking()) { if (pluginRef.getConfigManager().getConfigSuperAbilities().isMustSneakToActivate() && !player.isSneaking()) {
return; return;
} }
@ -963,15 +966,15 @@ public class McMMOPlayer {
} }
} }
SuperAbilityType ability = skill.getSuperAbility(); SuperAbilityType ability = pluginRef.getSkillTools().getSuperAbility(primarySkillType);
ToolType tool = skill.getPrimarySkillToolType(); ToolType tool = pluginRef.getSkillTools().getPrimarySkillToolType(primarySkillType);
/* /*
* Woodcutting & Axes need to be treated differently. * Woodcutting & Axes need to be treated differently.
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action * Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
*/ */
if (tool.inHand(inHand) && !getToolPreparationMode(tool)) { if (tool.inHand(inHand) && !getToolPreparationMode(tool)) {
if (skill != PrimarySkillType.WOODCUTTING && skill != PrimarySkillType.AXES) { if (primarySkillType != PrimarySkillType.WOODCUTTING && primarySkillType != PrimarySkillType.AXES) {
int timeRemaining = calculateTimeRemaining(ability); int timeRemaining = calculateTimeRemaining(ability);
if (!getAbilityMode(ability) && timeRemaining > 0) { if (!getAbilityMode(ability) && timeRemaining > 0) {

View File

@ -59,9 +59,9 @@ public class LeaderboardsCommandDisplayTask extends BukkitRunnable {
} }
} else { } else {
if (sender instanceof Player) { if (sender instanceof Player) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.Leaderboard", skill.getLocalizedSkillName())); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.Leaderboard", pluginRef.getSkillTools().getLocalizedSkillName(skill)));
} else { } else {
sender.sendMessage(ChatColor.stripColor(pluginRef.getLocaleManager().getString("Commands.Skill.Leaderboard", skill.getLocalizedSkillName()))); sender.sendMessage(ChatColor.stripColor(pluginRef.getLocaleManager().getString("Commands.Skill.Leaderboard", pluginRef.getSkillTools().getLocalizedSkillName(skill))));
} }
} }

View File

@ -53,7 +53,7 @@ public class RankCommandDisplayTask extends BukkitRunnable {
// } // }
rank = skills.get(skill); rank = skills.get(skill);
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcrank.Skill", skill.getLocalizedSkillName(), (rank == null ? pluginRef.getLocaleManager().getString("Commands.mcrank.Unranked") : rank))); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcrank.Skill", pluginRef.getSkillTools().getLocalizedSkillName(skill), (rank == null ? pluginRef.getLocaleManager().getString("Commands.mcrank.Unranked") : rank)));
} }
rank = skills.get(null); rank = skills.get(null);

View File

@ -35,9 +35,9 @@ public final class CommandRegistrationManager {
} }
private void registerSkillCommands() { private void registerSkillCommands() {
for (PrimarySkillType skill : PrimarySkillType.values()) { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
String commandName = skill.toString().toLowerCase(); String commandName = primarySkillType.toString().toLowerCase();
String localizedName = skill.getLocalizedSkillName().toLowerCase(); String localizedName = pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType).toLowerCase();
PluginCommand command; PluginCommand command;
@ -48,7 +48,7 @@ public final class CommandRegistrationManager {
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", localizedName)); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", localizedName));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", localizedName, "?", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Page") + "]")); command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", localizedName, "?", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Page") + "]"));
switch (skill) { switch (primarySkillType) {
case ACROBATICS: case ACROBATICS:
command.setExecutor(new AcrobaticsCommand(pluginRef)); command.setExecutor(new AcrobaticsCommand(pluginRef));
break; break;

View File

@ -97,14 +97,14 @@ public class ScoreboardStrings {
Collections.shuffle(colors, Misc.getRandom()); Collections.shuffle(colors, Misc.getRandom());
int i = 0; int i = 0;
for (PrimarySkillType type : PrimarySkillType.values()) { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getLocalizedSkillName(), false)); skillLabelBuilder.put(primarySkillType, getShortenedName(colors.get(i) + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType), false));
if (type.getSuperAbility() != null) { if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) {
abilityLabelBuilder.put(type.getSuperAbility(), getShortenedName(colors.get(i) + type.getSuperAbility().getName())); abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), getShortenedName(colors.get(i) + pluginRef.getSkillTools().getSuperAbility(primarySkillType).getName()));
if (type == PrimarySkillType.MINING) { if (primarySkillType == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getName()));
} }
} }
@ -119,14 +119,14 @@ public class ScoreboardStrings {
* Stylizes the targetBoard using our normal color scheme * Stylizes the targetBoard using our normal color scheme
*/ */
else { else {
for (PrimarySkillType type : PrimarySkillType.values()) { for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getLocalizedSkillName())); skillLabelBuilder.put(primarySkillType, getShortenedName(ChatColor.GREEN + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType)));
if (type.getSuperAbility() != null) { if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) {
abilityLabelBuilder.put(type.getSuperAbility(), formatAbility(type.getSuperAbility().getName())); abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), formatAbility(pluginRef.getSkillTools().getSuperAbility(primarySkillType).getName()));
if (type == PrimarySkillType.MINING) { if (primarySkillType == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getName()));
} }
} }

View File

@ -636,10 +636,13 @@ public class SkillTools {
} }
public SuperAbilityType getSuperAbility(PrimarySkillType primarySkillType) { public SuperAbilityType getSuperAbility(PrimarySkillType primarySkillType) {
if(mainActivatedAbilityChildMap.get(primarySkillType) == null)
return null;
return mainActivatedAbilityChildMap.get(primarySkillType); return mainActivatedAbilityChildMap.get(primarySkillType);
} }
public boolean isSuperAbilityUnlocked(Player player, PrimarySkillType primarySkillType) { public boolean isSuperAbilityUnlocked(PrimarySkillType primarySkillType, Player player) {
return RankUtils.getRank(player, getSuperAbility(primarySkillType).getSubSkillTypeDefinition()) >= 1; return RankUtils.getRank(player, getSuperAbility(primarySkillType).getSubSkillTypeDefinition()) >= 1;
} }