Turned skilltypes into constants instead of enum

This commit is contained in:
ile123ile 2014-08-23 14:14:36 -07:00
parent be690962ee
commit ebd02dc30e
77 changed files with 492 additions and 497 deletions

View File

@ -32,7 +32,7 @@ public final class ExperienceAPI {
* @return true if this is a valid mcMMO skill * @return true if this is a valid mcMMO skill
*/ */
public static boolean isValidSkillType(String skillType) { public static boolean isValidSkillType(String skillType) {
return SkillType.getSkill(skillType) != null; return SkillType.getSkillFromLocalized(skillType) != null;
} }
/** /**
@ -46,7 +46,7 @@ public final class ExperienceAPI {
* @return true if this is a valid, non-child mcMMO skill * @return true if this is a valid, non-child mcMMO skill
*/ */
public static boolean isNonChildSkill(String skillType) { public static boolean isNonChildSkill(String skillType) {
SkillType skill = SkillType.getSkill(skillType); SkillType skill = SkillType.getSkillFromLocalized(skillType);
return skill != null && !skill.isChildSkill(); return skill != null && !skill.isChildSkill();
} }
@ -644,7 +644,7 @@ public final class ExperienceAPI {
int powerLevel = 0; int powerLevel = 0;
PlayerProfile profile = getOfflineProfile(playerName); PlayerProfile profile = getOfflineProfile(playerName);
for (SkillType type : SkillType.NON_CHILD_SKILLS) { for (SkillType type : SkillType.nonChildSkills) {
powerLevel += profile.getSkillLevel(type); powerLevel += profile.getSkillLevel(type);
} }
@ -665,7 +665,7 @@ public final class ExperienceAPI {
int powerLevel = 0; int powerLevel = 0;
PlayerProfile profile = getOfflineProfile(uuid); PlayerProfile profile = getOfflineProfile(uuid);
for (SkillType type : SkillType.NON_CHILD_SKILLS) { for (SkillType type : SkillType.nonChildSkills) {
powerLevel += profile.getSkillLevel(type); powerLevel += profile.getSkillLevel(type);
} }
@ -981,7 +981,7 @@ public final class ExperienceAPI {
} }
private static SkillType getSkillType(String skillType) throws InvalidSkillException { private static SkillType getSkillType(String skillType) throws InvalidSkillException {
SkillType skill = SkillType.getSkill(skillType); SkillType skill = SkillType.getSkillFromLocalized(skillType);
if (skill == null) { if (skill == null) {
throw new InvalidSkillException(); throw new InvalidSkillException();

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.api; package com.gmail.nossr50.api;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
@ -18,7 +17,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names * @return a list of strings with valid skill names
*/ */
public static List<String> getSkills() { public static List<String> getSkills() {
return getListFromEnum(Arrays.asList(SkillType.values())); return SkillType.skillNames;
} }
/** /**
@ -30,7 +29,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names * @return a list of strings with valid skill names
*/ */
public static List<String> getNonChildSkills() { public static List<String> getNonChildSkills() {
return getListFromEnum(SkillType.NON_CHILD_SKILLS); return getStringListFromSkillList(SkillType.nonChildSkills);
} }
/** /**
@ -42,7 +41,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names * @return a list of strings with valid skill names
*/ */
public static List<String> getChildSkills() { public static List<String> getChildSkills() {
return getListFromEnum(SkillType.CHILD_SKILLS); return getStringListFromSkillList(SkillType.childSkills);
} }
/** /**
@ -54,7 +53,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names * @return a list of strings with valid skill names
*/ */
public static List<String> getCombatSkills() { public static List<String> getCombatSkills() {
return getListFromEnum(SkillType.COMBAT_SKILLS); return getStringListFromSkillList(SkillType.combatSkills);
} }
/** /**
@ -66,7 +65,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names * @return a list of strings with valid skill names
*/ */
public static List<String> getGatheringSkills() { public static List<String> getGatheringSkills() {
return getListFromEnum(SkillType.GATHERING_SKILLS); return getStringListFromSkillList(SkillType.gatheringSkills);
} }
/** /**
@ -78,14 +77,14 @@ public final class SkillAPI {
* @return a list of strings with valid skill names * @return a list of strings with valid skill names
*/ */
public static List<String> getMiscSkills() { public static List<String> getMiscSkills() {
return getListFromEnum(SkillType.MISC_SKILLS); return getStringListFromSkillList(SkillType.miscSkills);
} }
private static List<String> getListFromEnum(List<SkillType> skillsTypes) { private static List<String> getStringListFromSkillList(List<SkillType> skillsTypes) {
List<String> skills = new ArrayList<String>(); List<String> skills = new ArrayList<String>();
for (SkillType skillType : skillsTypes) { for (SkillType skillType : skillsTypes) {
skills.add(skillType.name()); skills.add(skillType.getName());
} }
return skills; return skills;

View File

@ -41,6 +41,6 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getLocalizedName()));
} }
} }

View File

@ -39,6 +39,6 @@ public class AddxpCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getLocalizedName()));
} }
} }

View File

@ -39,7 +39,7 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
skill = SkillType.getSkill(args[0]); skill = SkillType.getSkillFromLocalized(args[0]);
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; skill = null;
@ -58,7 +58,7 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
skill = SkillType.getSkill(args[1]); skill = SkillType.getSkillFromLocalized(args[1]);
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; skill = null;
@ -98,7 +98,7 @@ public abstract class ExperienceCommand implements TabExecutor {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
case 2: case 2:
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], SkillType.skillNames, new ArrayList<String>(SkillType.skillNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
} }
@ -119,13 +119,13 @@ public abstract class ExperienceCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} }
else { else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedName(), playerName));
} }
} }
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) { protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
if (skill == null) { if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
handleCommand(player, profile, skillType, value); handleCommand(player, profile, skillType, value);
} }

View File

@ -47,6 +47,6 @@ public class MmoeditCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value)); player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getLocalizedName(), value));
} }
} }

View File

@ -44,7 +44,7 @@ public class SkillresetCommand implements TabExecutor {
return true; return true;
} }
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0])); editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkillFromLocalized(args[0]));
return true; return true;
case 2: case 2:
@ -62,7 +62,7 @@ public class SkillresetCommand implements TabExecutor {
skill = null; skill = null;
} }
else { else {
skill = SkillType.getSkill(args[1]); skill = SkillType.getSkillFromLocalized(args[1]);
} }
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
@ -97,7 +97,7 @@ public class SkillresetCommand implements TabExecutor {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
case 2: case 2:
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], SkillType.skillNames, new ArrayList<String>(SkillType.skillNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
} }
@ -130,7 +130,7 @@ public class SkillresetCommand implements TabExecutor {
} }
protected void handlePlayerMessageSkill(Player player, SkillType skill) { protected void handlePlayerMessageSkill(Player player, SkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getLocalizedName()));
} }
private boolean validateArguments(CommandSender sender, String skillName) { private boolean validateArguments(CommandSender sender, String skillName) {
@ -142,13 +142,13 @@ public class SkillresetCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} }
else { else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedName(), playerName));
} }
} }
protected void editValues(Player player, PlayerProfile profile, SkillType skill) { protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
if (skill == null) { if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
handleCommand(player, profile, skillType); handleCommand(player, profile, skillType);
} }

View File

@ -22,7 +22,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
@Override @Override
protected boolean checkEnabled(SkillType skill) { protected boolean checkEnabled(SkillType skill) {
if (skill == null) { if (skill == null) {
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.skillList) {
if (!skillType.getHardcoreStatLossEnabled()) { if (!skillType.getHardcoreStatLossEnabled()) {
return false; return false;
} }
@ -52,7 +52,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
private void toggle(boolean enable, SkillType skill) { private void toggle(boolean enable, SkillType skill) {
if (skill == null) { if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
skillType.setHardcoreStatLossEnabled(enable); skillType.setHardcoreStatLossEnabled(enable);
} }
} }
@ -60,6 +60,6 @@ public class HardcoreCommand extends HardcoreModeCommand {
skill.setHardcoreStatLossEnabled(enable); skill.setHardcoreStatLossEnabled(enable);
} }
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getName()))); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getLocalizedName())));
} }
} }

View File

@ -76,7 +76,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true; return true;
} }
SkillType skill = SkillType.getSkill(args[0]); SkillType skill = SkillType.getSkillFromLocalized(args[0]);
if (!CommandUtils.isChildSkill(sender, skill)) { if (!CommandUtils.isChildSkill(sender, skill)) {
return true; return true;

View File

@ -22,7 +22,7 @@ public class VampirismCommand extends HardcoreModeCommand {
@Override @Override
protected boolean checkEnabled(SkillType skill) { protected boolean checkEnabled(SkillType skill) {
if (skill == null) { if (skill == null) {
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.skillList) {
if (!skillType.getHardcoreVampirismEnabled()) { if (!skillType.getHardcoreVampirismEnabled()) {
return false; return false;
} }
@ -52,7 +52,7 @@ public class VampirismCommand extends HardcoreModeCommand {
private void toggle(boolean enable, SkillType skill) { private void toggle(boolean enable, SkillType skill) {
if (skill == null) { if (skill == null) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
skillType.setHardcoreVampirismEnabled(enable); skillType.setHardcoreVampirismEnabled(enable);
} }
} }

View File

@ -53,17 +53,17 @@ public class InspectCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName)); sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
for (SkillType skill : SkillType.GATHERING_SKILLS) { for (SkillType skill : SkillType.gatheringSkills) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
for (SkillType skill : SkillType.COMBAT_SKILLS) { for (SkillType skill : SkillType.combatSkills) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
for (SkillType skill : SkillType.MISC_SKILLS) { for (SkillType skill : SkillType.miscSkills) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }

View File

@ -70,7 +70,7 @@ public class MctopCommand 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], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[0], SkillType.skillNames, new ArrayList<String>(SkillType.skillNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
} }
@ -120,7 +120,7 @@ public class MctopCommand implements TabExecutor {
return null; return null;
} }
SkillType skill = SkillType.getSkill(skillName); SkillType skill = SkillType.getSkillFromLocalized(skillName);
if (CommandUtils.isChildSkill(sender, skill)) { if (CommandUtils.isChildSkill(sender, skill)) {
return null; return null;

View File

@ -23,7 +23,7 @@ public class AcrobaticsCommand extends SkillCommand {
private boolean canGracefulRoll; private boolean canGracefulRoll;
public AcrobaticsCommand() { public AcrobaticsCommand() {
super(SkillType.ACROBATICS); super(SkillType.acrobatics);
} }
@Override @Override

View File

@ -26,7 +26,7 @@ public class AlchemyCommand extends SkillCommand {
private boolean canConcoctions; private boolean canConcoctions;
public AlchemyCommand() { public AlchemyCommand() {
super(SkillType.ALCHEMY); super(SkillType.alchemy);
} }
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) { protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {

View File

@ -23,7 +23,7 @@ public class ArcheryCommand extends SkillCommand {
private boolean canRetrieve; private boolean canRetrieve;
public ArcheryCommand() { public ArcheryCommand() {
super(SkillType.ARCHERY); super(SkillType.archery);
} }
@Override @Override

View File

@ -26,7 +26,7 @@ public class AxesCommand extends SkillCommand {
private boolean canGreaterImpact; private boolean canGreaterImpact;
public AxesCommand() { public AxesCommand() {
super(SkillType.AXES); super(SkillType.axes);
} }
@Override @Override

View File

@ -18,7 +18,7 @@ public class ExcavationCommand extends SkillCommand {
private boolean canTreasureHunt; private boolean canTreasureHunt;
public ExcavationCommand() { public ExcavationCommand() {
super(SkillType.EXCAVATION); super(SkillType.excavation);
} }
@Override @Override

View File

@ -44,7 +44,7 @@ public class FishingCommand extends SkillCommand {
private boolean canIceFish; private boolean canIceFish;
public FishingCommand() { public FishingCommand() {
super(SkillType.FISHING); super(SkillType.fishing);
} }
@Override @Override

View File

@ -35,7 +35,7 @@ public class HerbalismCommand extends SkillCommand {
private boolean canShroomThumb; private boolean canShroomThumb;
public HerbalismCommand() { public HerbalismCommand() {
super(SkillType.HERBALISM); super(SkillType.herbalism);
} }
@Override @Override

View File

@ -35,7 +35,7 @@ public class MiningCommand extends SkillCommand {
private boolean canDemoExpert; private boolean canDemoExpert;
public MiningCommand() { public MiningCommand() {
super(SkillType.MINING); super(SkillType.mining);
} }
@Override @Override

View File

@ -42,7 +42,7 @@ public class RepairCommand extends SkillCommand {
private int stoneLevel; private int stoneLevel;
public RepairCommand() { public RepairCommand() {
super(SkillType.REPAIR); super(SkillType.repair);
} }
@Override @Override

View File

@ -18,7 +18,7 @@ public class SalvageCommand extends SkillCommand {
private boolean canArcaneSalvage; private boolean canArcaneSalvage;
public SalvageCommand() { public SalvageCommand() {
super(SkillType.SALVAGE); super(SkillType.salvage);
} }
@Override @Override

View File

@ -38,7 +38,7 @@ public abstract class SkillCommand implements TabExecutor {
public SkillCommand(SkillType skill) { public SkillCommand(SkillType skill) {
this.skill = skill; this.skill = skill;
skillName = skill.getName(); skillName = skill.getLocalizedName();
skillGuideCommand = new SkillGuideCommand(skill); skillGuideCommand = new SkillGuideCommand(skill);
} }
@ -82,7 +82,7 @@ public abstract class SkillCommand implements TabExecutor {
Set<SkillType> parents = FamilyTree.getParents(skill); Set<SkillType> parents = FamilyTree.getParents(skill);
for (SkillType parent : parents) { for (SkillType parent : parents) {
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent))); player.sendMessage(parent.getLocalizedName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
} }
} }

View File

@ -18,7 +18,7 @@ public class SkillGuideCommand implements CommandExecutor {
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid"); private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
public SkillGuideCommand(SkillType skill) { public SkillGuideCommand(SkillType skill) {
header = LocaleLoader.getString("Guides.Header", skill.getName()); header = LocaleLoader.getString("Guides.Header", skill.getLocalizedName());
guide = getGuide(skill); guide = getGuide(skill);
} }

View File

@ -27,7 +27,7 @@ public class SmeltingCommand extends SkillCommand {
private boolean canVanillaXPBoost; private boolean canVanillaXPBoost;
public SmeltingCommand() { public SmeltingCommand() {
super(SkillType.SMELTING); super(SkillType.smelting);
} }
@Override @Override

View File

@ -26,7 +26,7 @@ public class SwordsCommand extends SkillCommand {
private boolean canBleed; private boolean canBleed;
public SwordsCommand() { public SwordsCommand() {
super(SkillType.SWORDS); super(SkillType.swords);
} }
@Override @Override

View File

@ -28,7 +28,7 @@ public class TamingCommand extends SkillCommand {
private boolean canHolyHound; private boolean canHolyHound;
public TamingCommand() { public TamingCommand() {
super(SkillType.TAMING); super(SkillType.taming);
} }
@Override @Override

View File

@ -29,7 +29,7 @@ public class UnarmedCommand extends SkillCommand {
private boolean canIronGrip; private boolean canIronGrip;
public UnarmedCommand() { public UnarmedCommand() {
super(SkillType.UNARMED); super(SkillType.unarmed);
} }
@Override @Override

View File

@ -22,7 +22,7 @@ public class WoodcuttingCommand extends SkillCommand {
private boolean canDoubleDrop; private boolean canDoubleDrop;
public WoodcuttingCommand() { public WoodcuttingCommand() {
super(SkillType.WOODCUTTING); super(SkillType.woodcutting);
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.alchemy.Alchemy;
@ -689,8 +690,13 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); } public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); } public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
public int getMaxBonusLevel(SecondaryAbility skillAbility) { return config.getInt("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".MaxBonusLevel"); } public int getMaxBonusLevel(SecondaryAbility skillAbility) {
public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".ChanceMax", 100.0D); } String skillAbilityString = "Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".MaxBonusLevel";
return config.getInt(skillAbilityString);
}
public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(
SkillType.bySecondaryAbility(skillAbility).toString()
) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".ChanceMax", 100.0D); }
/* ACROBATICS */ /* ACROBATICS */
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); } public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }

View File

@ -278,31 +278,31 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
else { else {
// Otherwise write the new player information // Otherwise write the new player information
writer.append(playerName).append(":"); writer.append(playerName).append(":");
writer.append(profile.getSkillLevel(SkillType.MINING)).append(":"); writer.append(profile.getSkillLevel(SkillType.mining)).append(":");
writer.append(":"); writer.append(":");
writer.append(":"); writer.append(":");
writer.append(profile.getSkillXpLevel(SkillType.MINING)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.mining)).append(":");
writer.append(profile.getSkillLevel(SkillType.WOODCUTTING)).append(":"); writer.append(profile.getSkillLevel(SkillType.woodcutting)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.WOODCUTTING)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.woodcutting)).append(":");
writer.append(profile.getSkillLevel(SkillType.REPAIR)).append(":"); writer.append(profile.getSkillLevel(SkillType.repair)).append(":");
writer.append(profile.getSkillLevel(SkillType.UNARMED)).append(":"); writer.append(profile.getSkillLevel(SkillType.unarmed)).append(":");
writer.append(profile.getSkillLevel(SkillType.HERBALISM)).append(":"); writer.append(profile.getSkillLevel(SkillType.herbalism)).append(":");
writer.append(profile.getSkillLevel(SkillType.EXCAVATION)).append(":"); writer.append(profile.getSkillLevel(SkillType.excavation)).append(":");
writer.append(profile.getSkillLevel(SkillType.ARCHERY)).append(":"); writer.append(profile.getSkillLevel(SkillType.archery)).append(":");
writer.append(profile.getSkillLevel(SkillType.SWORDS)).append(":"); writer.append(profile.getSkillLevel(SkillType.swords)).append(":");
writer.append(profile.getSkillLevel(SkillType.AXES)).append(":"); writer.append(profile.getSkillLevel(SkillType.axes)).append(":");
writer.append(profile.getSkillLevel(SkillType.ACROBATICS)).append(":"); writer.append(profile.getSkillLevel(SkillType.acrobatics)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.REPAIR)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.repair)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.UNARMED)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.unarmed)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.HERBALISM)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.herbalism)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.EXCAVATION)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.excavation)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.ARCHERY)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.archery)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.SWORDS)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.swords)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.AXES)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.axes)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.ACROBATICS)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.acrobatics)).append(":");
writer.append(":"); writer.append(":");
writer.append(profile.getSkillLevel(SkillType.TAMING)).append(":"); writer.append(profile.getSkillLevel(SkillType.taming)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.TAMING)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.taming)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.BERSERK)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.BERSERK)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.GIGA_DRILL_BREAKER)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.GIGA_DRILL_BREAKER)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.TREE_FELLER)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.TREE_FELLER)).append(":");
@ -311,14 +311,14 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
writer.append(":"); writer.append(":");
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":"); writer.append(profile.getSkillLevel(SkillType.fishing)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.fishing)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":"); writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType(); MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":"); writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":");
writer.append(profile.getSkillLevel(SkillType.ALCHEMY)).append(":"); writer.append(profile.getSkillLevel(SkillType.alchemy)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.ALCHEMY)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.alchemy)).append(":");
writer.append(uuid.toString()).append(":"); writer.append(uuid.toString()).append(":");
writer.append("\r\n"); writer.append("\r\n");
} }
@ -367,7 +367,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { for (SkillType skill : SkillType.nonChildSkills) {
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill))); skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
} }
@ -750,19 +750,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
Map<SkillType, Integer> skills = getSkillMapFromLine(data); Map<SkillType, Integer> skills = getSkillMapFromLine(data);
powerLevel += putStat(acrobatics, playerName, skills.get(SkillType.ACROBATICS)); powerLevel += putStat(acrobatics, playerName, skills.get(SkillType.acrobatics));
powerLevel += putStat(alchemy, playerName, skills.get(SkillType.ALCHEMY)); powerLevel += putStat(alchemy, playerName, skills.get(SkillType.alchemy));
powerLevel += putStat(archery, playerName, skills.get(SkillType.ARCHERY)); powerLevel += putStat(archery, playerName, skills.get(SkillType.archery));
powerLevel += putStat(axes, playerName, skills.get(SkillType.AXES)); powerLevel += putStat(axes, playerName, skills.get(SkillType.axes));
powerLevel += putStat(excavation, playerName, skills.get(SkillType.EXCAVATION)); powerLevel += putStat(excavation, playerName, skills.get(SkillType.excavation));
powerLevel += putStat(fishing, playerName, skills.get(SkillType.FISHING)); powerLevel += putStat(fishing, playerName, skills.get(SkillType.fishing));
powerLevel += putStat(herbalism, playerName, skills.get(SkillType.HERBALISM)); powerLevel += putStat(herbalism, playerName, skills.get(SkillType.herbalism));
powerLevel += putStat(mining, playerName, skills.get(SkillType.MINING)); powerLevel += putStat(mining, playerName, skills.get(SkillType.mining));
powerLevel += putStat(repair, playerName, skills.get(SkillType.REPAIR)); powerLevel += putStat(repair, playerName, skills.get(SkillType.repair));
powerLevel += putStat(swords, playerName, skills.get(SkillType.SWORDS)); powerLevel += putStat(swords, playerName, skills.get(SkillType.swords));
powerLevel += putStat(taming, playerName, skills.get(SkillType.TAMING)); powerLevel += putStat(taming, playerName, skills.get(SkillType.taming));
powerLevel += putStat(unarmed, playerName, skills.get(SkillType.UNARMED)); powerLevel += putStat(unarmed, playerName, skills.get(SkillType.unarmed));
powerLevel += putStat(woodcutting, playerName, skills.get(SkillType.WOODCUTTING)); powerLevel += putStat(woodcutting, playerName, skills.get(SkillType.woodcutting));
putStat(powerLevels, playerName, powerLevel); putStat(powerLevels, playerName, powerLevel);
} }
@ -799,19 +799,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
Collections.sort(alchemy, c); Collections.sort(alchemy, c);
Collections.sort(powerLevels, c); Collections.sort(powerLevels, c);
playerStatHash.put(SkillType.MINING, mining); playerStatHash.put(SkillType.mining, mining);
playerStatHash.put(SkillType.WOODCUTTING, woodcutting); playerStatHash.put(SkillType.woodcutting, woodcutting);
playerStatHash.put(SkillType.REPAIR, repair); playerStatHash.put(SkillType.repair, repair);
playerStatHash.put(SkillType.UNARMED, unarmed); playerStatHash.put(SkillType.unarmed, unarmed);
playerStatHash.put(SkillType.HERBALISM, herbalism); playerStatHash.put(SkillType.herbalism, herbalism);
playerStatHash.put(SkillType.EXCAVATION, excavation); playerStatHash.put(SkillType.excavation, excavation);
playerStatHash.put(SkillType.ARCHERY, archery); playerStatHash.put(SkillType.archery, archery);
playerStatHash.put(SkillType.SWORDS, swords); playerStatHash.put(SkillType.swords, swords);
playerStatHash.put(SkillType.AXES, axes); playerStatHash.put(SkillType.axes, axes);
playerStatHash.put(SkillType.ACROBATICS, acrobatics); playerStatHash.put(SkillType.acrobatics, acrobatics);
playerStatHash.put(SkillType.TAMING, taming); playerStatHash.put(SkillType.taming, taming);
playerStatHash.put(SkillType.FISHING, fishing); playerStatHash.put(SkillType.fishing, fishing);
playerStatHash.put(SkillType.ALCHEMY, alchemy); playerStatHash.put(SkillType.alchemy, alchemy);
} }
/** /**
@ -1076,25 +1076,25 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
private PlayerProfile loadFromLine(String[] character) { private PlayerProfile loadFromLine(String[] character) {
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
MobHealthbarType mobHealthbarType; MobHealthbarType mobHealthbarType;
// TODO on updates, put new values in a try{} ? // TODO on updates, put new values in a try{} ?
skillsXp.put(SkillType.TAMING, (float) Integer.valueOf(character[25])); skillsXp.put(SkillType.taming, (float) Integer.valueOf(character[25]));
skillsXp.put(SkillType.MINING, (float) Integer.valueOf(character[4])); skillsXp.put(SkillType.mining, (float) Integer.valueOf(character[4]));
skillsXp.put(SkillType.REPAIR, (float) Integer.valueOf(character[15])); skillsXp.put(SkillType.repair, (float) Integer.valueOf(character[15]));
skillsXp.put(SkillType.WOODCUTTING, (float) Integer.valueOf(character[6])); skillsXp.put(SkillType.woodcutting, (float) Integer.valueOf(character[6]));
skillsXp.put(SkillType.UNARMED, (float) Integer.valueOf(character[16])); skillsXp.put(SkillType.unarmed, (float) Integer.valueOf(character[16]));
skillsXp.put(SkillType.HERBALISM, (float) Integer.valueOf(character[17])); skillsXp.put(SkillType.herbalism, (float) Integer.valueOf(character[17]));
skillsXp.put(SkillType.EXCAVATION, (float) Integer.valueOf(character[18])); skillsXp.put(SkillType.excavation, (float) Integer.valueOf(character[18]));
skillsXp.put(SkillType.ARCHERY, (float) Integer.valueOf(character[19])); skillsXp.put(SkillType.archery, (float) Integer.valueOf(character[19]));
skillsXp.put(SkillType.SWORDS, (float) Integer.valueOf(character[20])); skillsXp.put(SkillType.swords, (float) Integer.valueOf(character[20]));
skillsXp.put(SkillType.AXES, (float) Integer.valueOf(character[21])); skillsXp.put(SkillType.axes, (float) Integer.valueOf(character[21]));
skillsXp.put(SkillType.ACROBATICS, (float) Integer.valueOf(character[22])); skillsXp.put(SkillType.acrobatics, (float) Integer.valueOf(character[22]));
skillsXp.put(SkillType.FISHING, (float) Integer.valueOf(character[35])); skillsXp.put(SkillType.fishing, (float) Integer.valueOf(character[35]));
skillsXp.put(SkillType.ALCHEMY, (float) Integer.valueOf(character[40])); skillsXp.put(SkillType.alchemy, (float) Integer.valueOf(character[40]));
// Taming - Unused // Taming - Unused
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32])); skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32]));
@ -1128,21 +1128,21 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
} }
private Map<SkillType, Integer> getSkillMapFromLine(String[] character) { private Map<SkillType, Integer> getSkillMapFromLine(String[] character) {
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
skills.put(SkillType.TAMING, Integer.valueOf(character[24])); skills.put(SkillType.taming, Integer.valueOf(character[24]));
skills.put(SkillType.MINING, Integer.valueOf(character[1])); skills.put(SkillType.mining, Integer.valueOf(character[1]));
skills.put(SkillType.REPAIR, Integer.valueOf(character[7])); skills.put(SkillType.repair, Integer.valueOf(character[7]));
skills.put(SkillType.WOODCUTTING, Integer.valueOf(character[5])); skills.put(SkillType.woodcutting, Integer.valueOf(character[5]));
skills.put(SkillType.UNARMED, Integer.valueOf(character[8])); skills.put(SkillType.unarmed, Integer.valueOf(character[8]));
skills.put(SkillType.HERBALISM, Integer.valueOf(character[9])); skills.put(SkillType.herbalism, Integer.valueOf(character[9]));
skills.put(SkillType.EXCAVATION, Integer.valueOf(character[10])); skills.put(SkillType.excavation, Integer.valueOf(character[10]));
skills.put(SkillType.ARCHERY, Integer.valueOf(character[11])); skills.put(SkillType.archery, Integer.valueOf(character[11]));
skills.put(SkillType.SWORDS, Integer.valueOf(character[12])); skills.put(SkillType.swords, Integer.valueOf(character[12]));
skills.put(SkillType.AXES, Integer.valueOf(character[13])); skills.put(SkillType.axes, Integer.valueOf(character[13]));
skills.put(SkillType.ACROBATICS, Integer.valueOf(character[14])); skills.put(SkillType.acrobatics, Integer.valueOf(character[14]));
skills.put(SkillType.FISHING, Integer.valueOf(character[34])); skills.put(SkillType.fishing, Integer.valueOf(character[34]));
skills.put(SkillType.ALCHEMY, Integer.valueOf(character[39])); skills.put(SkillType.alchemy, Integer.valueOf(character[39]));
return skills; return skills;
} }

View File

@ -272,19 +272,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
+ ", unarmed = ?, herbalism = ?, excavation = ?" + ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?" + ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?"); + ", fishing = ?, alchemy = ? WHERE user_id = ?");
statement.setInt(1, profile.getSkillLevel(SkillType.TAMING)); statement.setInt(1, profile.getSkillLevel(SkillType.taming));
statement.setInt(2, profile.getSkillLevel(SkillType.MINING)); statement.setInt(2, profile.getSkillLevel(SkillType.mining));
statement.setInt(3, profile.getSkillLevel(SkillType.REPAIR)); statement.setInt(3, profile.getSkillLevel(SkillType.repair));
statement.setInt(4, profile.getSkillLevel(SkillType.WOODCUTTING)); statement.setInt(4, profile.getSkillLevel(SkillType.woodcutting));
statement.setInt(5, profile.getSkillLevel(SkillType.UNARMED)); statement.setInt(5, profile.getSkillLevel(SkillType.unarmed));
statement.setInt(6, profile.getSkillLevel(SkillType.HERBALISM)); statement.setInt(6, profile.getSkillLevel(SkillType.herbalism));
statement.setInt(7, profile.getSkillLevel(SkillType.EXCAVATION)); statement.setInt(7, profile.getSkillLevel(SkillType.excavation));
statement.setInt(8, profile.getSkillLevel(SkillType.ARCHERY)); statement.setInt(8, profile.getSkillLevel(SkillType.archery));
statement.setInt(9, profile.getSkillLevel(SkillType.SWORDS)); statement.setInt(9, profile.getSkillLevel(SkillType.swords));
statement.setInt(10, profile.getSkillLevel(SkillType.AXES)); statement.setInt(10, profile.getSkillLevel(SkillType.axes));
statement.setInt(11, profile.getSkillLevel(SkillType.ACROBATICS)); statement.setInt(11, profile.getSkillLevel(SkillType.acrobatics));
statement.setInt(12, profile.getSkillLevel(SkillType.FISHING)); statement.setInt(12, profile.getSkillLevel(SkillType.fishing));
statement.setInt(13, profile.getSkillLevel(SkillType.ALCHEMY)); statement.setInt(13, profile.getSkillLevel(SkillType.alchemy));
statement.setInt(14, id); statement.setInt(14, id);
success &= (statement.executeUpdate() != 0); success &= (statement.executeUpdate() != 0);
statement.close(); statement.close();
@ -294,19 +294,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
+ ", unarmed = ?, herbalism = ?, excavation = ?" + ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?" + ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?"); + ", fishing = ?, alchemy = ? WHERE user_id = ?");
statement.setInt(1, profile.getSkillXpLevel(SkillType.TAMING)); statement.setInt(1, profile.getSkillXpLevel(SkillType.taming));
statement.setInt(2, profile.getSkillXpLevel(SkillType.MINING)); statement.setInt(2, profile.getSkillXpLevel(SkillType.mining));
statement.setInt(3, profile.getSkillXpLevel(SkillType.REPAIR)); statement.setInt(3, profile.getSkillXpLevel(SkillType.repair));
statement.setInt(4, profile.getSkillXpLevel(SkillType.WOODCUTTING)); statement.setInt(4, profile.getSkillXpLevel(SkillType.woodcutting));
statement.setInt(5, profile.getSkillXpLevel(SkillType.UNARMED)); statement.setInt(5, profile.getSkillXpLevel(SkillType.unarmed));
statement.setInt(6, profile.getSkillXpLevel(SkillType.HERBALISM)); statement.setInt(6, profile.getSkillXpLevel(SkillType.herbalism));
statement.setInt(7, profile.getSkillXpLevel(SkillType.EXCAVATION)); statement.setInt(7, profile.getSkillXpLevel(SkillType.excavation));
statement.setInt(8, profile.getSkillXpLevel(SkillType.ARCHERY)); statement.setInt(8, profile.getSkillXpLevel(SkillType.archery));
statement.setInt(9, profile.getSkillXpLevel(SkillType.SWORDS)); statement.setInt(9, profile.getSkillXpLevel(SkillType.swords));
statement.setInt(10, profile.getSkillXpLevel(SkillType.AXES)); statement.setInt(10, profile.getSkillXpLevel(SkillType.axes));
statement.setInt(11, profile.getSkillXpLevel(SkillType.ACROBATICS)); statement.setInt(11, profile.getSkillXpLevel(SkillType.acrobatics));
statement.setInt(12, profile.getSkillXpLevel(SkillType.FISHING)); statement.setInt(12, profile.getSkillXpLevel(SkillType.fishing));
statement.setInt(13, profile.getSkillXpLevel(SkillType.ALCHEMY)); statement.setInt(13, profile.getSkillXpLevel(SkillType.alchemy));
statement.setInt(14, id); statement.setInt(14, id);
success &= (statement.executeUpdate() != 0); success &= (statement.executeUpdate() != 0);
statement.close(); statement.close();
@ -361,7 +361,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage) { public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage) {
List<PlayerStat> stats = new ArrayList<PlayerStat>(); List<PlayerStat> stats = new ArrayList<PlayerStat>();
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase(); String query = skill == null ? ALL_QUERY_VERSION : skill.getName().toLowerCase();
ResultSet resultSet = null; ResultSet resultSet = null;
PreparedStatement statement = null; PreparedStatement statement = null;
Connection connection = null; Connection connection = null;
@ -425,8 +425,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
try { try {
connection = getConnection(PoolIdentifier.MISC); connection = getConnection(PoolIdentifier.MISC);
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
String skillName = skillType.name().toLowerCase(); String skillName = skillType.getName().toLowerCase();
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " + String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " + "AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = ?)"; "WHERE user = ?)";
@ -1226,8 +1226,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException { private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
MobHealthbarType mobHealthbarType; MobHealthbarType mobHealthbarType;
UUID uuid; UUID uuid;
@ -1238,33 +1238,33 @@ public final class SQLDatabaseManager implements DatabaseManager {
final int OFFSET_DATS = 26; final int OFFSET_DATS = 26;
final int OFFSET_OTHER = 38; final int OFFSET_OTHER = 38;
skills.put(SkillType.TAMING, result.getInt(OFFSET_SKILLS + 1)); skills.put(SkillType.taming, result.getInt(OFFSET_SKILLS + 1));
skills.put(SkillType.MINING, result.getInt(OFFSET_SKILLS + 2)); skills.put(SkillType.mining, result.getInt(OFFSET_SKILLS + 2));
skills.put(SkillType.REPAIR, result.getInt(OFFSET_SKILLS + 3)); skills.put(SkillType.repair, result.getInt(OFFSET_SKILLS + 3));
skills.put(SkillType.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4)); skills.put(SkillType.woodcutting, result.getInt(OFFSET_SKILLS + 4));
skills.put(SkillType.UNARMED, result.getInt(OFFSET_SKILLS + 5)); skills.put(SkillType.unarmed, result.getInt(OFFSET_SKILLS + 5));
skills.put(SkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6)); skills.put(SkillType.herbalism, result.getInt(OFFSET_SKILLS + 6));
skills.put(SkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7)); skills.put(SkillType.excavation, result.getInt(OFFSET_SKILLS + 7));
skills.put(SkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8)); skills.put(SkillType.archery, result.getInt(OFFSET_SKILLS + 8));
skills.put(SkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9)); skills.put(SkillType.swords, result.getInt(OFFSET_SKILLS + 9));
skills.put(SkillType.AXES, result.getInt(OFFSET_SKILLS + 10)); skills.put(SkillType.axes, result.getInt(OFFSET_SKILLS + 10));
skills.put(SkillType.ACROBATICS, result.getInt(OFFSET_SKILLS + 11)); skills.put(SkillType.acrobatics, result.getInt(OFFSET_SKILLS + 11));
skills.put(SkillType.FISHING, result.getInt(OFFSET_SKILLS + 12)); skills.put(SkillType.fishing, result.getInt(OFFSET_SKILLS + 12));
skills.put(SkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13)); skills.put(SkillType.alchemy, result.getInt(OFFSET_SKILLS + 13));
skillsXp.put(SkillType.TAMING, result.getFloat(OFFSET_XP + 1)); skillsXp.put(SkillType.taming, result.getFloat(OFFSET_XP + 1));
skillsXp.put(SkillType.MINING, result.getFloat(OFFSET_XP + 2)); skillsXp.put(SkillType.mining, result.getFloat(OFFSET_XP + 2));
skillsXp.put(SkillType.REPAIR, result.getFloat(OFFSET_XP + 3)); skillsXp.put(SkillType.repair, result.getFloat(OFFSET_XP + 3));
skillsXp.put(SkillType.WOODCUTTING, result.getFloat(OFFSET_XP + 4)); skillsXp.put(SkillType.woodcutting, result.getFloat(OFFSET_XP + 4));
skillsXp.put(SkillType.UNARMED, result.getFloat(OFFSET_XP + 5)); skillsXp.put(SkillType.unarmed, result.getFloat(OFFSET_XP + 5));
skillsXp.put(SkillType.HERBALISM, result.getFloat(OFFSET_XP + 6)); skillsXp.put(SkillType.herbalism, result.getFloat(OFFSET_XP + 6));
skillsXp.put(SkillType.EXCAVATION, result.getFloat(OFFSET_XP + 7)); skillsXp.put(SkillType.excavation, result.getFloat(OFFSET_XP + 7));
skillsXp.put(SkillType.ARCHERY, result.getFloat(OFFSET_XP + 8)); skillsXp.put(SkillType.archery, result.getFloat(OFFSET_XP + 8));
skillsXp.put(SkillType.SWORDS, result.getFloat(OFFSET_XP + 9)); skillsXp.put(SkillType.swords, result.getFloat(OFFSET_XP + 9));
skillsXp.put(SkillType.AXES, result.getFloat(OFFSET_XP + 10)); skillsXp.put(SkillType.axes, result.getFloat(OFFSET_XP + 10));
skillsXp.put(SkillType.ACROBATICS, result.getFloat(OFFSET_XP + 11)); skillsXp.put(SkillType.acrobatics, result.getFloat(OFFSET_XP + 11));
skillsXp.put(SkillType.FISHING, result.getFloat(OFFSET_XP + 12)); skillsXp.put(SkillType.fishing, result.getFloat(OFFSET_XP + 12));
skillsXp.put(SkillType.ALCHEMY, result.getFloat(OFFSET_XP + 13)); skillsXp.put(SkillType.alchemy, result.getFloat(OFFSET_XP + 13));
// Taming - Unused - result.getInt(OFFSET_DATS + 1) // Taming - Unused - result.getInt(OFFSET_DATS + 1)
skillsDATS.put(AbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2)); skillsDATS.put(AbilityType.SUPER_BREAKER, result.getInt(OFFSET_DATS + 2));
@ -1357,11 +1357,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'"); resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
resultSet.last(); resultSet.last();
if (resultSet.getRow() != SkillType.NON_CHILD_SKILLS.size()) { if (resultSet.getRow() != SkillType.nonChildSkills.size()) {
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases"); mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { for (SkillType skill : SkillType.nonChildSkills) {
String skill_name = skill.name().toLowerCase(); String skill_name = skill.getName().toLowerCase();
try { try {
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_" + skill_name + "` (`" + skill_name + "`) USING BTREE"); statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_" + skill_name + "` (`" + skill_name + "`) USING BTREE");

View File

@ -111,7 +111,7 @@ public class McMMOPlayer {
* If in the future someone wants to remove this, don't forget to also remove what is in the SkillType enum. - bm01 * If in the future someone wants to remove this, don't forget to also remove what is in the SkillType enum. - bm01
*/ */
try { try {
for (SkillType skillType : SkillType.values()) { for (SkillType skillType : SkillType.skillList) {
skillManagers.put(skillType, skillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this)); skillManagers.put(skillType, skillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
} }
} }
@ -131,63 +131,63 @@ public class McMMOPlayer {
} }
public AcrobaticsManager getAcrobaticsManager() { public AcrobaticsManager getAcrobaticsManager() {
return (AcrobaticsManager) skillManagers.get(SkillType.ACROBATICS); return (AcrobaticsManager) skillManagers.get(SkillType.acrobatics);
} }
public AlchemyManager getAlchemyManager() { public AlchemyManager getAlchemyManager() {
return (AlchemyManager) skillManagers.get(SkillType.ALCHEMY); return (AlchemyManager) skillManagers.get(SkillType.alchemy);
} }
public ArcheryManager getArcheryManager() { public ArcheryManager getArcheryManager() {
return (ArcheryManager) skillManagers.get(SkillType.ARCHERY); return (ArcheryManager) skillManagers.get(SkillType.archery);
} }
public AxesManager getAxesManager() { public AxesManager getAxesManager() {
return (AxesManager) skillManagers.get(SkillType.AXES); return (AxesManager) skillManagers.get(SkillType.axes);
} }
public ExcavationManager getExcavationManager() { public ExcavationManager getExcavationManager() {
return (ExcavationManager) skillManagers.get(SkillType.EXCAVATION); return (ExcavationManager) skillManagers.get(SkillType.excavation);
} }
public FishingManager getFishingManager() { public FishingManager getFishingManager() {
return (FishingManager) skillManagers.get(SkillType.FISHING); return (FishingManager) skillManagers.get(SkillType.fishing);
} }
public HerbalismManager getHerbalismManager() { public HerbalismManager getHerbalismManager() {
return (HerbalismManager) skillManagers.get(SkillType.HERBALISM); return (HerbalismManager) skillManagers.get(SkillType.herbalism);
} }
public MiningManager getMiningManager() { public MiningManager getMiningManager() {
return (MiningManager) skillManagers.get(SkillType.MINING); return (MiningManager) skillManagers.get(SkillType.mining);
} }
public RepairManager getRepairManager() { public RepairManager getRepairManager() {
return (RepairManager) skillManagers.get(SkillType.REPAIR); return (RepairManager) skillManagers.get(SkillType.repair);
} }
public SalvageManager getSalvageManager() { public SalvageManager getSalvageManager() {
return (SalvageManager) skillManagers.get(SkillType.SALVAGE); return (SalvageManager) skillManagers.get(SkillType.salvage);
} }
public SmeltingManager getSmeltingManager() { public SmeltingManager getSmeltingManager() {
return (SmeltingManager) skillManagers.get(SkillType.SMELTING); return (SmeltingManager) skillManagers.get(SkillType.smelting);
} }
public SwordsManager getSwordsManager() { public SwordsManager getSwordsManager() {
return (SwordsManager) skillManagers.get(SkillType.SWORDS); return (SwordsManager) skillManagers.get(SkillType.swords);
} }
public TamingManager getTamingManager() { public TamingManager getTamingManager() {
return (TamingManager) skillManagers.get(SkillType.TAMING); return (TamingManager) skillManagers.get(SkillType.taming);
} }
public UnarmedManager getUnarmedManager() { public UnarmedManager getUnarmedManager() {
return (UnarmedManager) skillManagers.get(SkillType.UNARMED); return (UnarmedManager) skillManagers.get(SkillType.unarmed);
} }
public WoodcuttingManager getWoodcuttingManager() { public WoodcuttingManager getWoodcuttingManager() {
return (WoodcuttingManager) skillManagers.get(SkillType.WOODCUTTING); return (WoodcuttingManager) skillManagers.get(SkillType.woodcutting);
} }
public SkillManager getSkillManager(SkillType skillType) { public SkillManager getSkillManager(SkillType skillType) {
@ -389,7 +389,7 @@ public class McMMOPlayer {
public int getPowerLevel() { public int getPowerLevel() {
int powerLevel = 0; int powerLevel = 0;
for (SkillType type : SkillType.NON_CHILD_SKILLS) { for (SkillType type : SkillType.nonChildSkills) {
if (type.getPermissions(player)) { if (type.getPermissions(player)) {
powerLevel += getSkillLevel(type); powerLevel += getSkillLevel(type);
} }
@ -475,7 +475,7 @@ public class McMMOPlayer {
return; return;
} }
isUsingUnarmed = (skillType == SkillType.UNARMED); isUsingUnarmed = (skillType == SkillType.unarmed);
checkXp(skillType, xpGainReason); checkXp(skillType, xpGainReason);
} }
@ -725,7 +725,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 == SkillType.WOODCUTTING || skill == SkillType.AXES) { if (skill == SkillType.woodcutting || skill == SkillType.axes) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining)); player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
} }
@ -787,7 +787,7 @@ public class McMMOPlayer {
* 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 (ability.getPermissions(player) && tool.inHand(inHand) && !getToolPreparationMode(tool)) { if (ability.getPermissions(player) && tool.inHand(inHand) && !getToolPreparationMode(tool)) {
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) { if (skill != SkillType.woodcutting && skill != SkillType.axes) {
int timeRemaining = calculateTimeRemaining(ability); int timeRemaining = calculateTimeRemaining(ability);
if (!getAbilityMode(ability) && timeRemaining > 0) { if (!getAbilityMode(ability) && timeRemaining > 0) {

View File

@ -47,7 +47,7 @@ public class PlayerProfile {
abilityDATS.put(abilityType, 0); abilityDATS.put(abilityType, 0);
} }
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
skills.put(skillType, 0); skills.put(skillType, 0);
skillsXp.put(skillType, 0F); skillsXp.put(skillType, 0F);
} }

View File

@ -10,6 +10,22 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.skills.AcrobaticsCommand;
import com.gmail.nossr50.commands.skills.AlchemyCommand;
import com.gmail.nossr50.commands.skills.ArcheryCommand;
import com.gmail.nossr50.commands.skills.AxesCommand;
import com.gmail.nossr50.commands.skills.ExcavationCommand;
import com.gmail.nossr50.commands.skills.FishingCommand;
import com.gmail.nossr50.commands.skills.HerbalismCommand;
import com.gmail.nossr50.commands.skills.MiningCommand;
import com.gmail.nossr50.commands.skills.RepairCommand;
import com.gmail.nossr50.commands.skills.SalvageCommand;
import com.gmail.nossr50.commands.skills.SkillCommand;
import com.gmail.nossr50.commands.skills.SmeltingCommand;
import com.gmail.nossr50.commands.skills.SwordsCommand;
import com.gmail.nossr50.commands.skills.TamingCommand;
import com.gmail.nossr50.commands.skills.UnarmedCommand;
import com.gmail.nossr50.commands.skills.WoodcuttingCommand;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -32,71 +48,92 @@ import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
public enum SkillType { public class SkillType {
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SecondaryAbility.DODGE, SecondaryAbility.GRACEFUL_ROLL, SecondaryAbility.ROLL)), public enum SkillUseType {
ALCHEMY(AlchemyManager.class, Color.FUCHSIA, ImmutableList.of(SecondaryAbility.CATALYSIS, SecondaryAbility.CONCOCTIONS)), COMBAT,
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SecondaryAbility.DAZE, SecondaryAbility.RETRIEVE, SecondaryAbility.SKILL_SHOT)), GATHERING,
AXES(AxesManager.class, Color.AQUA, AbilityType.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SecondaryAbility.ARMOR_IMPACT, SecondaryAbility.AXE_MASTERY, SecondaryAbility.CRITICAL_HIT, SecondaryAbility.GREATER_IMPACT)), MISC
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbility.EXCAVATION_TREASURE_HUNTER)), }
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SUPER_REPAIR)),
SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SecondaryAbility.ADVANCED_SALVAGE, SecondaryAbility.ARCANE_SALVAGE)),
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR)),
UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP)),
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.LEAF_BLOWER, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS));
public static List<String> skillNames = new ArrayList<String>();
public static List<SkillType> skillList = new ArrayList<SkillType>();
public static List<SkillType> childSkills = new ArrayList<SkillType>();
public static List<SkillType> nonChildSkills = new ArrayList<SkillType>();
public static List<SkillType> combatSkills = new ArrayList<SkillType>();
public static List<SkillType> gatheringSkills = new ArrayList<SkillType>();
public static List<SkillType> miscSkills = new ArrayList<SkillType>();
public static final SkillType acrobatics = createSkill("ACROBATICS" , AcrobaticsManager.class , AcrobaticsCommand.class , false, Color.WHITE, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.DODGE, SecondaryAbility.GRACEFUL_ROLL, SecondaryAbility.ROLL));
public static final SkillType alchemy = createSkill("ALCHEMY" , AlchemyManager.class , AlchemyCommand.class , false, Color.FUCHSIA, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.CATALYSIS, SecondaryAbility.CONCOCTIONS));
public static final SkillType archery = createSkill("ARCHERY" , ArcheryManager.class , ArcheryCommand.class , false, Color.MAROON, SkillUseType.COMBAT, ImmutableList.of(SecondaryAbility.DAZE, SecondaryAbility.RETRIEVE, SecondaryAbility.SKILL_SHOT));
public static final SkillType axes = createSkill("AXES" , AxesManager.class , AxesCommand.class , false, Color.AQUA, SkillUseType.COMBAT, AbilityType.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SecondaryAbility.ARMOR_IMPACT, SecondaryAbility.AXE_MASTERY, SecondaryAbility.CRITICAL_HIT, SecondaryAbility.GREATER_IMPACT));
public static final SkillType excavation = createSkill("EXCAVATION" , ExcavationManager.class , ExcavationCommand.class , false, Color.fromRGB(139, 69, 19), SkillUseType.GATHERING, AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbility.EXCAVATION_TREASURE_HUNTER));
public static final SkillType fishing = createSkill("FISHING" , FishingManager.class , FishingCommand.class , false, Color.NAVY, SkillUseType.GATHERING, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE));
public static final SkillType herbalism = createSkill("HERBALISM" , HerbalismManager.class , HerbalismCommand.class , false, Color.GREEN, SkillUseType.GATHERING, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB));
public static final SkillType mining = createSkill("MINING" , MiningManager.class , MiningCommand.class , false, Color.GRAY, SkillUseType.GATHERING, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS));
public static final SkillType repair = createSkill("REPAIR" , RepairManager.class , RepairCommand.class , false, Color.SILVER, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SUPER_REPAIR));
public static final SkillType salvage = createSkill("SALVAGE" , SalvageManager.class , SalvageCommand.class , true, Color.ORANGE, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.ADVANCED_SALVAGE, SecondaryAbility.ARCANE_SALVAGE));
public static final SkillType smelting = createSkill("SMELTING" , SmeltingManager.class , SmeltingCommand.class , true, Color.YELLOW, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT));
public static final SkillType swords = createSkill("SWORDS" , SwordsManager.class , SwordsCommand.class , false, Color.fromRGB(178, 34, 34), SkillUseType.COMBAT, AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER));
public static final SkillType taming = createSkill("TAMING" , TamingManager.class , TamingCommand.class , false, Color.PURPLE, SkillUseType.COMBAT, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR));
public static final SkillType unarmed = createSkill("UNARMED" , UnarmedManager.class , UnarmedCommand.class , false, Color.BLACK, SkillUseType.COMBAT, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP));
public static final SkillType woodcutting = createSkill("WOODCUTTING", WoodcuttingManager.class , WoodcuttingCommand.class , false, Color.OLIVE, SkillUseType.GATHERING, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.LEAF_BLOWER, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS));
private String name;
private Class<? extends SkillManager> managerClass; private Class<? extends SkillManager> managerClass;
private Class<? extends SkillCommand> commandClass;
private boolean isChild;
private Color runescapeColor; private Color runescapeColor;
private SkillUseType skillUseType;
private AbilityType ability; private AbilityType ability;
private ToolType tool; private ToolType tool;
private List<SecondaryAbility> secondaryAbilities; private List<SecondaryAbility> secondaryAbilities;
public static final List<String> SKILL_NAMES; public static SkillType createSkill(String name, Class<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, List<SecondaryAbility> secondaryAbilities) {
return createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, null, null, secondaryAbilities);
}
public static final List<SkillType> CHILD_SKILLS; public static SkillType createSkill(String name, Class<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, ToolType tool, List<SecondaryAbility> secondaryAbilities) {
public static final List<SkillType> NON_CHILD_SKILLS; SkillType skill = new SkillType(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, tool, secondaryAbilities);
skillList.add(skill);
public static final List<SkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED); if(skill.isChild) {
public static final List<SkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
public static final List<SkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
static {
List<SkillType> childSkills = new ArrayList<SkillType>();
List<SkillType> nonChildSkills = new ArrayList<SkillType>();
ArrayList<String> names = new ArrayList<String>();
for (SkillType skill : values()) {
if (skill.isChildSkill()) {
childSkills.add(skill); childSkills.add(skill);
} }
else { else {
nonChildSkills.add(skill); nonChildSkills.add(skill);
} }
switch(skill.skillUseType) {
names.add(skill.getName()); case COMBAT:
combatSkills.add(skill);
break;
case GATHERING:
gatheringSkills.add(skill);
break;
default:
miscSkills.add(skill);
break;
}
skillNames.add(skill.name);
return skill;
} }
Collections.sort(names); private SkillType(String name, Class<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, List<SecondaryAbility> secondaryAbilities) {
SKILL_NAMES = ImmutableList.copyOf(names); this(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, null, null, secondaryAbilities);
CHILD_SKILLS = ImmutableList.copyOf(childSkills);
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
} }
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SecondaryAbility> secondaryAbilities) { private SkillType(String name, Class<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, ToolType tool, List<SecondaryAbility> secondaryAbilities) {
this(managerClass, runescapeColor, null, null, secondaryAbilities); this.name = name;
}
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, AbilityType ability, ToolType tool, List<SecondaryAbility> secondaryAbilities) {
this.managerClass = managerClass; this.managerClass = managerClass;
this.commandClass = commandClass;
this.isChild = isChild;
this.runescapeColor = runescapeColor; this.runescapeColor = runescapeColor;
this.skillUseType = skillUseType;
this.ability = ability; this.ability = ability;
this.tool = tool; this.tool = tool;
this.secondaryAbilities = secondaryAbilities; this.secondaryAbilities = secondaryAbilities;
@ -106,6 +143,10 @@ public enum SkillType {
return managerClass; return managerClass;
} }
public Class<? extends SkillCommand> getCommandClass() {
return commandClass;
}
public AbilityType getAbility() { public AbilityType getAbility() {
return ability; return ability;
} }
@ -159,17 +200,21 @@ public enum SkillType {
return ExperienceConfig.getInstance().getFormulaSkillModifier(this); return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
} }
public static SkillType getSkill(String skillName) { public static SkillType getSkillFromLocalized(String skillName) {
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) { if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
for (SkillType type : values()) { for (SkillType type : skillList) {
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) { if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name) + ".SkillName"))) {
return type; return type;
} }
} }
} }
for (SkillType type : values()) { return getSkill(skillName);
if (type.name().equalsIgnoreCase(skillName)) { }
public static SkillType getSkill(String skillName) {
for (SkillType type : skillList) {
if (type.name.equalsIgnoreCase(skillName)) {
return type; return type;
} }
} }
@ -181,20 +226,12 @@ public enum SkillType {
return null; return null;
} }
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
public boolean isChildSkill() { public boolean isChildSkill() {
switch (this) { return isChild;
case SALVAGE:
case SMELTING:
return true;
default:
return false;
}
} }
public static SkillType bySecondaryAbility(SecondaryAbility skillAbility) { public static SkillType bySecondaryAbility(SecondaryAbility skillAbility) {
for (SkillType type : values()) { for (SkillType type : skillList) {
if (type.getSkillAbilities().contains(skillAbility)) { if (type.getSkillAbilities().contains(skillAbility)) {
return type; return type;
} }
@ -203,7 +240,7 @@ public enum SkillType {
} }
public static SkillType byAbility(AbilityType ability) { public static SkillType byAbility(AbilityType ability) {
for (SkillType type : values()) { for (SkillType type : skillList) {
if (type.getAbility() == ability) { if (type.getAbility() == ability) {
return type; return type;
} }
@ -212,7 +249,18 @@ public enum SkillType {
return null; return null;
} }
public String getName() { public String getName()
{
return this.name;
}
@Override
public String toString()
{
return getName();
}
public String getLocalizedName() {
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? StringUtils.getCapitalized(this.toString()) : StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName")); return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? StringUtils.getCapitalized(this.toString()) : StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
} }
@ -227,4 +275,9 @@ public enum SkillType {
public boolean shouldProcess(Entity target) { public boolean shouldProcess(Entity target) {
return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled(); return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled();
} }
public static void setUpSkillTypes()
{
Collections.sort(skillNames);
}
} }

View File

@ -15,7 +15,7 @@ public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cance
private boolean cancelled; private boolean cancelled;
public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) { public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) {
super(player, SkillType.ALCHEMY); super(player, SkillType.alchemy);
this.brewingStand = brewingStand; this.brewingStand = brewingStand;
cancelled = false; cancelled = false;
} }

View File

@ -12,7 +12,7 @@ public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements
private boolean cancelled; private boolean cancelled;
public McMMOPlayerCatalysisEvent(Player player, double speed) { public McMMOPlayerCatalysisEvent(Player player, double speed) {
super(player, SkillType.ALCHEMY); super(player, SkillType.alchemy);
this.speed = speed; this.speed = speed;
cancelled = false; cancelled = false;
} }

View File

@ -10,7 +10,7 @@ public class McMMOPlayerFishingEvent extends McMMOPlayerSkillEvent implements Ca
private boolean cancelled; private boolean cancelled;
protected McMMOPlayerFishingEvent(Player player) { protected McMMOPlayerFishingEvent(Player player) {
super(player, SkillType.FISHING); super(player, SkillType.fishing);
cancelled = false; cancelled = false;
} }

View File

@ -17,7 +17,7 @@ public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implement
private boolean cancelled; private boolean cancelled;
public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) { public McMMOPlayerRepairCheckEvent(Player player, short repairAmount, ItemStack repairMaterial, ItemStack repairedObject) {
super(player, SkillType.REPAIR); super(player, SkillType.repair);
this.repairAmount = repairAmount; this.repairAmount = repairAmount;
this.repairMaterial = repairMaterial; this.repairMaterial = repairMaterial;
this.repairedObject = repairedObject; this.repairedObject = repairedObject;

View File

@ -11,7 +11,7 @@ public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Can
private Player defender; private Player defender;
public McMMOPlayerDisarmEvent(Player defender) { public McMMOPlayerDisarmEvent(Player defender) {
super(defender, SkillType.UNARMED); super(defender, SkillType.unarmed);
this.defender = defender; this.defender = defender;
} }

View File

@ -130,10 +130,10 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) { if (blockState.getType() == Repair.anvilMaterial && SkillType.repair.getPermissions(player)) {
mcMMOPlayer.getRepairManager().placedAnvilCheck(); mcMMOPlayer.getRepairManager().placedAnvilCheck();
} }
else if (blockState.getType() == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player)) { else if (blockState.getType() == Salvage.anvilMaterial && SkillType.salvage.getPermissions(player)) {
mcMMOPlayer.getSalvageManager().placedAnvilCheck(); mcMMOPlayer.getSalvageManager().placedAnvilCheck();
} }
} }
@ -176,26 +176,26 @@ public class BlockListener implements Listener {
/* Green Terra */ /* Green Terra */
if (herbalismManager.canActivateAbility()) { if (herbalismManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM); mcMMOPlayer.checkAbilityActivation(SkillType.herbalism);
} }
/* /*
* We don't check the block store here because herbalism has too many unusual edge cases. * We don't check the block store here because herbalism has too many unusual edge cases.
* Instead, we check it inside the drops handler. * Instead, we check it inside the drops handler.
*/ */
if (SkillType.HERBALISM.getPermissions(player)) { if (SkillType.herbalism.getPermissions(player)) {
herbalismManager.herbalismBlockCheck(blockState); herbalismManager.herbalismBlockCheck(blockState);
} }
} }
/* MINING */ /* MINING */
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && SkillType.MINING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && SkillType.mining.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
MiningManager miningManager = mcMMOPlayer.getMiningManager(); MiningManager miningManager = mcMMOPlayer.getMiningManager();
miningManager.miningBlockCheck(blockState); miningManager.miningBlockCheck(blockState);
} }
/* WOOD CUTTING */ /* WOOD CUTTING */
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.woodcutting.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager(); WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
if (woodcuttingManager.canUseTreeFeller(heldItem)) { if (woodcuttingManager.canUseTreeFeller(heldItem)) {
@ -207,7 +207,7 @@ public class BlockListener implements Listener {
} }
/* EXCAVATION */ /* EXCAVATION */
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && SkillType.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && SkillType.excavation.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager(); ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
excavationManager.excavationBlockCheck(blockState); excavationManager.excavationBlockCheck(blockState);
@ -312,19 +312,19 @@ public class BlockListener implements Listener {
} }
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) { if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM); mcMMOPlayer.checkAbilityActivation(SkillType.herbalism);
} }
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) { else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
mcMMOPlayer.checkAbilityActivation(SkillType.WOODCUTTING); mcMMOPlayer.checkAbilityActivation(SkillType.woodcutting);
} }
else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) { else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
mcMMOPlayer.checkAbilityActivation(SkillType.MINING); mcMMOPlayer.checkAbilityActivation(SkillType.mining);
} }
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) { else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
mcMMOPlayer.checkAbilityActivation(SkillType.EXCAVATION); mcMMOPlayer.checkAbilityActivation(SkillType.excavation);
} }
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) { else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED); mcMMOPlayer.checkAbilityActivation(SkillType.unarmed);
} }
} }

View File

@ -113,7 +113,7 @@ public class InventoryListener implements Listener {
Player player = getPlayerFromFurnace(furnaceBlock); Player player = getPlayerFromFurnace(furnaceBlock);
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) { if (!UserManager.hasPlayerDataKey(player) || !SkillType.smelting.getPermissions(player)) {
return; return;
} }
@ -132,7 +132,7 @@ public class InventoryListener implements Listener {
Player player = getPlayerFromFurnace(furnaceBlock); Player player = getPlayerFromFurnace(furnaceBlock);
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) { if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.smelting)) {
return; return;
} }

View File

@ -211,7 +211,7 @@ public class PlayerListener implements Listener {
public void onPlayerFishHighest(PlayerFishEvent event) { public void onPlayerFishHighest(PlayerFishEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) { if (!UserManager.hasPlayerDataKey(player) || !SkillType.fishing.getPermissions(player)) {
return; return;
} }
@ -232,7 +232,7 @@ public class PlayerListener implements Listener {
fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
} }
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) { if (Permissions.vanillaXpBoost(player, SkillType.fishing)) {
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop())); event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
} }
return; return;
@ -263,7 +263,7 @@ public class PlayerListener implements Listener {
public void onPlayerFishMonitor(PlayerFishEvent event) { public void onPlayerFishMonitor(PlayerFishEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) { if (!UserManager.hasPlayerDataKey(player) || !SkillType.fishing.getPermissions(player)) {
return; return;
} }
@ -446,7 +446,7 @@ public class PlayerListener implements Listener {
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) { if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
/* REPAIR CHECKS */ /* REPAIR CHECKS */
if (type == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) { if (type == Repair.anvilMaterial && SkillType.repair.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager(); RepairManager repairManager = mcMMOPlayer.getRepairManager();
event.setCancelled(true); event.setCancelled(true);
@ -457,7 +457,7 @@ public class PlayerListener implements Listener {
} }
} }
/* SALVAGE CHECKS */ /* SALVAGE CHECKS */
else if (type == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) { else if (type == Salvage.anvilMaterial && SkillType.salvage.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager(); SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
event.setCancelled(true); event.setCancelled(true);
@ -485,7 +485,7 @@ public class PlayerListener implements Listener {
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) { if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
/* REPAIR CHECKS */ /* REPAIR CHECKS */
if (type == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) { if (type == Repair.anvilMaterial && SkillType.repair.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager(); RepairManager repairManager = mcMMOPlayer.getRepairManager();
// Cancel repairing an enchanted item // Cancel repairing an enchanted item
@ -495,7 +495,7 @@ public class PlayerListener implements Listener {
} }
} }
/* SALVAGE CHECKS */ /* SALVAGE CHECKS */
else if (type == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) { else if (type == Salvage.anvilMaterial && SkillType.salvage.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
SalvageManager salvageManager = mcMMOPlayer.getSalvageManager(); SalvageManager salvageManager = mcMMOPlayer.getSalvageManager();
// Cancel salvaging an enchanted item // Cancel salvaging an enchanted item
@ -538,15 +538,15 @@ public class PlayerListener implements Listener {
if (BlockUtils.canActivateAbilities(blockState)) { if (BlockUtils.canActivateAbilities(blockState)) {
if (Config.getInstance().getAbilitiesEnabled()) { if (Config.getInstance().getAbilitiesEnabled()) {
if (BlockUtils.canActivateHerbalism(blockState)) { if (BlockUtils.canActivateHerbalism(blockState)) {
mcMMOPlayer.processAbilityActivation(SkillType.HERBALISM); mcMMOPlayer.processAbilityActivation(SkillType.herbalism);
} }
mcMMOPlayer.processAbilityActivation(SkillType.AXES); mcMMOPlayer.processAbilityActivation(SkillType.axes);
mcMMOPlayer.processAbilityActivation(SkillType.EXCAVATION); mcMMOPlayer.processAbilityActivation(SkillType.excavation);
mcMMOPlayer.processAbilityActivation(SkillType.MINING); mcMMOPlayer.processAbilityActivation(SkillType.mining);
mcMMOPlayer.processAbilityActivation(SkillType.SWORDS); mcMMOPlayer.processAbilityActivation(SkillType.swords);
mcMMOPlayer.processAbilityActivation(SkillType.UNARMED); mcMMOPlayer.processAbilityActivation(SkillType.unarmed);
mcMMOPlayer.processAbilityActivation(SkillType.WOODCUTTING); mcMMOPlayer.processAbilityActivation(SkillType.woodcutting);
} }
ChimaeraWing.activationCheck(player); ChimaeraWing.activationCheck(player);
@ -575,13 +575,13 @@ public class PlayerListener implements Listener {
/* ACTIVATION CHECKS */ /* ACTIVATION CHECKS */
if (Config.getInstance().getAbilitiesEnabled()) { if (Config.getInstance().getAbilitiesEnabled()) {
mcMMOPlayer.processAbilityActivation(SkillType.AXES); mcMMOPlayer.processAbilityActivation(SkillType.axes);
mcMMOPlayer.processAbilityActivation(SkillType.EXCAVATION); mcMMOPlayer.processAbilityActivation(SkillType.excavation);
mcMMOPlayer.processAbilityActivation(SkillType.HERBALISM); mcMMOPlayer.processAbilityActivation(SkillType.herbalism);
mcMMOPlayer.processAbilityActivation(SkillType.MINING); mcMMOPlayer.processAbilityActivation(SkillType.mining);
mcMMOPlayer.processAbilityActivation(SkillType.SWORDS); mcMMOPlayer.processAbilityActivation(SkillType.swords);
mcMMOPlayer.processAbilityActivation(SkillType.UNARMED); mcMMOPlayer.processAbilityActivation(SkillType.unarmed);
mcMMOPlayer.processAbilityActivation(SkillType.WOODCUTTING); mcMMOPlayer.processAbilityActivation(SkillType.woodcutting);
} }
/* ITEM CHECKS */ /* ITEM CHECKS */
@ -681,9 +681,9 @@ public class PlayerListener implements Listener {
String lowerCaseCommand = command.toLowerCase(); String lowerCaseCommand = command.toLowerCase();
// Do these ACTUALLY have to be lower case to work properly? // Do these ACTUALLY have to be lower case to work properly?
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.skillList) {
String skillName = skill.toString().toLowerCase(); String skillName = skill.toString().toLowerCase();
String localizedName = skill.getName().toLowerCase(); String localizedName = skill.getLocalizedName().toLowerCase();
if (lowerCaseCommand.equals(localizedName)) { if (lowerCaseCommand.equals(localizedName)) {
event.setMessage(message.replace(command, skillName)); event.setMessage(message.replace(command, skillName));

View File

@ -46,13 +46,13 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading")); sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Player", playerName));
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { for (SkillType skill : SkillType.nonChildSkills) {
if (!skill.getPermissions(player)) { if (!skill.getPermissions(player)) {
continue; continue;
} }
rank = skills.get(skill); rank = skills.get(skill);
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", skill.getName(), (rank == null ? LocaleLoader.getString("Commands.mcrank.Unranked") : rank))); sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", skill.getLocalizedName(), (rank == null ? LocaleLoader.getString("Commands.mcrank.Unranked") : rank)));
} }
rank = skills.get(null); rank = skills.get(null);

View File

@ -50,7 +50,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
} }
else { else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName())); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getLocalizedName()));
} }
int place = (page * 10) - 9; int place = (page * 10) - 9;

View File

@ -59,7 +59,7 @@ public class FormulaConversionTask extends BukkitRunnable {
private void editValues(PlayerProfile profile) { private void editValues(PlayerProfile profile) {
mcMMO.p.debug("========================================================================"); mcMMO.p.debug("========================================================================");
mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":"); mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":");
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
int oldLevel = profile.getSkillLevel(skillType); int oldLevel = profile.getSkillLevel(skillType);
int oldXPLevel = profile.getSkillXpLevel(skillType); int oldXPLevel = profile.getSkillXpLevel(skillType);
int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel); int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel);

View File

@ -37,7 +37,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
brewTimer = DEFAULT_BREW_TICKS; brewTimer = DEFAULT_BREW_TICKS;
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) { if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.ALCHEMY)); double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.alchemy));
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis); McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);

View File

@ -25,7 +25,7 @@ public class AcrobaticsManager extends SkillManager {
Location lastFallLocation; Location lastFallLocation;
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) { public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.ACROBATICS); super(mcMMOPlayer, SkillType.acrobatics);
} }
public boolean canRoll() { public boolean canRoll() {

View File

@ -17,7 +17,7 @@ public class AlchemyManager extends SkillManager {
private final double LUCKY_MODIFIER = 4.0 / 3.0; private final double LUCKY_MODIFIER = 4.0 / 3.0;
public AlchemyManager(McMMOPlayer mcMMOPlayer) { public AlchemyManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.ALCHEMY); super(mcMMOPlayer, SkillType.alchemy);
} }
public int getTier() { public int getTier() {

View File

@ -20,7 +20,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class ArcheryManager extends SkillManager { public class ArcheryManager extends SkillManager {
public ArcheryManager(McMMOPlayer mcMMOPlayer) { public ArcheryManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.ARCHERY); super(mcMMOPlayer, SkillType.archery);
} }
public boolean canDaze(LivingEntity target) { public boolean canDaze(LivingEntity target) {

View File

@ -23,7 +23,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class AxesManager extends SkillManager { public class AxesManager extends SkillManager {
public AxesManager(McMMOPlayer mcMMOPlayer) { public AxesManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.AXES); super(mcMMOPlayer, SkillType.axes);
} }
public boolean canUseAxeMastery() { public boolean canUseAxeMastery() {

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.skills.child; package com.gmail.nossr50.skills.child;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -20,15 +22,15 @@ public class ChildConfig extends AutoUpdateConfigLoader {
FamilyTree.clearRegistrations(); // when reloading, need to clear statics FamilyTree.clearRegistrations(); // when reloading, need to clear statics
for (SkillType skill : SkillType.CHILD_SKILLS) { for (SkillType skill : SkillType.childSkills) {
plugin.debug("Finding parents of " + skill.name()); plugin.debug("Finding parents of " + skill.getLocalizedName());
EnumSet<SkillType> parentSkills = EnumSet.noneOf(SkillType.class); Set<SkillType> parentSkills = new HashSet<SkillType>();
boolean useDefaults = false; // If we had an error we back out and use defaults boolean useDefaults = false; // If we had an error we back out and use defaults
for (String name : config.getStringList(StringUtils.getCapitalized(skill.name()))) { for (String name : config.getStringList(StringUtils.getCapitalized(skill.getName()))) {
try { try {
SkillType parentSkill = SkillType.valueOf(name.toUpperCase()); SkillType parentSkill = SkillType.getSkill(name);
FamilyTree.enforceNotChildSkill(parentSkill); FamilyTree.enforceNotChildSkill(parentSkill);
parentSkills.add(parentSkill); parentSkills.add(parentSkill);
} }
@ -41,18 +43,18 @@ public class ChildConfig extends AutoUpdateConfigLoader {
if (useDefaults) { if (useDefaults) {
parentSkills.clear(); parentSkills.clear();
for (String name : config.getDefaults().getStringList(StringUtils.getCapitalized(skill.name()))) { for (String name : config.getDefaults().getStringList(StringUtils.getCapitalized(skill.getName()))) {
/* We do less checks in here because it's from inside our jar. /* We do less checks in here because it's from inside our jar.
* If they're dedicated enough to have modified it, they can have the errors it may produce. * If they're dedicated enough to have modified it, they can have the errors it may produce.
* Alternatively, this can be used to allow child skills to be parent skills, provided there are no circular dependencies this is an advanced sort of configuration. * Alternatively, this can be used to allow child skills to be parent skills, provided there are no circular dependencies this is an advanced sort of configuration.
*/ */
parentSkills.add(SkillType.valueOf(name.toUpperCase())); parentSkills.add(SkillType.getSkill(name));
} }
} }
// Register them // Register them
for (SkillType parentSkill : parentSkills) { for (SkillType parentSkill : parentSkills) {
plugin.debug("Registering " + parentSkill.name() + " as parent of " + skill.name()); plugin.debug("Registering " + parentSkill.getName() + " as parent of " + skill.getName());
FamilyTree.registerParent(skill, parentSkill); FamilyTree.registerParent(skill, parentSkill);
} }
} }

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.child;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
@ -22,7 +23,7 @@ public class FamilyTree {
enforceNotChildSkill(parentSkill); enforceNotChildSkill(parentSkill);
if (!tree.containsKey(childSkill)) { if (!tree.containsKey(childSkill)) {
tree.put(childSkill, EnumSet.noneOf(SkillType.class)); tree.put(childSkill, new HashSet<SkillType>());
} }
tree.get(childSkill).add(parentSkill); tree.get(childSkill).add(parentSkill);
@ -41,13 +42,13 @@ public class FamilyTree {
protected static void enforceChildSkill(SkillType skill) { protected static void enforceChildSkill(SkillType skill) {
if (!skill.isChildSkill()) { if (!skill.isChildSkill()) {
throw new IllegalArgumentException(skill.name() + " is not a child skill!"); throw new IllegalArgumentException(skill.getName() + " is not a child skill!");
} }
} }
protected static void enforceNotChildSkill(SkillType skill) { protected static void enforceNotChildSkill(SkillType skill) {
if (skill.isChildSkill()) { if (skill.isChildSkill()) {
throw new IllegalArgumentException(skill.name() + " is a child skill!"); throw new IllegalArgumentException(skill.getName() + " is a child skill!");
} }
} }
} }

View File

@ -58,7 +58,7 @@ public class Excavation {
xp = ExperienceConfig.getInstance().getDirtAndSandXp(blockState.getData()); xp = ExperienceConfig.getInstance().getDirtAndSandXp(blockState.getData());
} }
else { else {
xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, material); xp = ExperienceConfig.getInstance().getXp(SkillType.excavation, material);
} }
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) { if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {

View File

@ -18,7 +18,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class ExcavationManager extends SkillManager { public class ExcavationManager extends SkillManager {
public ExcavationManager(McMMOPlayer mcMMOPlayer) { public ExcavationManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.EXCAVATION); super(mcMMOPlayer, SkillType.excavation);
} }
/** /**

View File

@ -72,7 +72,7 @@ public class FishingManager extends SkillManager {
private Location hookLocation; private Location hookLocation;
public FishingManager(McMMOPlayer mcMMOPlayer) { public FishingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.FISHING); super(mcMMOPlayer, SkillType.fishing);
} }
public boolean canShake(Entity target) { public boolean canShake(Entity target) {

View File

@ -40,7 +40,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class HerbalismManager extends SkillManager { public class HerbalismManager extends SkillManager {
public HerbalismManager(McMMOPlayer mcMMOPlayer) { public HerbalismManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.HERBALISM); super(mcMMOPlayer, SkillType.herbalism);
} }
public boolean canBlockCheck() { public boolean canBlockCheck() {

View File

@ -19,7 +19,7 @@ public class Mining {
*/ */
protected static int getBlockXp(BlockState blockState) { protected static int getBlockXp(BlockState blockState) {
Material blockType = blockState.getType(); Material blockType = blockState.getType();
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE); int xp = ExperienceConfig.getInstance().getXp(SkillType.mining, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE);
if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) { if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
xp = mcMMO.getModManager().getBlock(blockState).getXpGain(); xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
@ -50,7 +50,7 @@ public class Mining {
return; return;
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) { if (Config.getInstance().getDoubleDropsEnabled(SkillType.mining, Material.REDSTONE_ORE)) {
Misc.dropItem(blockState.getLocation(), new ItemStack(Material.REDSTONE_ORE)); Misc.dropItem(blockState.getLocation(), new ItemStack(Material.REDSTONE_ORE));
} }
return; return;
@ -104,7 +104,7 @@ public class Mining {
return; return;
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) { if (Config.getInstance().getDoubleDropsEnabled(SkillType.mining, Material.REDSTONE_ORE)) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
} }
return; return;

View File

@ -29,7 +29,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class MiningManager extends SkillManager { public class MiningManager extends SkillManager {
public MiningManager(McMMOPlayer mcMMOPlayer) { public MiningManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.MINING); super(mcMMOPlayer, SkillType.mining);
} }
public boolean canUseDemolitionsExpertise() { public boolean canUseDemolitionsExpertise() {

View File

@ -33,7 +33,7 @@ public class RepairManager extends SkillManager {
private int lastClick; private int lastClick;
public RepairManager(McMMOPlayer mcMMOPlayer) { public RepairManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.REPAIR); super(mcMMOPlayer, SkillType.repair);
} }
/** /**

View File

@ -30,7 +30,7 @@ public class SalvageManager extends SkillManager {
private int lastClick; private int lastClick;
public SalvageManager(McMMOPlayer mcMMOPlayer) { public SalvageManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.SALVAGE); super(mcMMOPlayer, SkillType.salvage);
} }
/** /**

View File

@ -50,6 +50,6 @@ public class Smelting {
MaterialData data = smelting.getData(); MaterialData data = smelting.getData();
Material resourceType = smelting.getType(); Material resourceType = smelting.getType();
return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE); return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.smelting, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE);
} }
} }

View File

@ -22,7 +22,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class SmeltingManager extends SkillManager { public class SmeltingManager extends SkillManager {
public SmeltingManager(McMMOPlayer mcMMOPlayer) { public SmeltingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.SMELTING); super(mcMMOPlayer, SkillType.smelting);
} }
public boolean canUseFluxMining(BlockState blockState) { public boolean canUseFluxMining(BlockState blockState) {

View File

@ -23,7 +23,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class SwordsManager extends SkillManager { public class SwordsManager extends SkillManager {
public SwordsManager(McMMOPlayer mcMMOPlayer) { public SwordsManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.SWORDS); super(mcMMOPlayer, SkillType.swords);
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {

View File

@ -28,7 +28,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class TamingManager extends SkillManager { public class TamingManager extends SkillManager {
public TamingManager(McMMOPlayer mcMMOPlayer) { public TamingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.TAMING); super(mcMMOPlayer, SkillType.taming);
} }
public boolean canUseThickFur() { public boolean canUseThickFur() {

View File

@ -26,7 +26,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class UnarmedManager extends SkillManager { public class UnarmedManager extends SkillManager {
public UnarmedManager(McMMOPlayer mcMMOPlayer) { public UnarmedManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.UNARMED); super(mcMMOPlayer, SkillType.unarmed);
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {

View File

@ -30,7 +30,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class WoodcuttingManager extends SkillManager { public class WoodcuttingManager extends SkillManager {
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) { public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, SkillType.WOODCUTTING); super(mcMMOPlayer, SkillType.woodcutting);
} }
public boolean canUseLeafBlower(ItemStack heldItem) { public boolean canUseLeafBlower(ItemStack heldItem) {

View File

@ -177,7 +177,7 @@ public class EventUtils {
experienceChanged = event.getExperienceChanged(); experienceChanged = event.getExperienceChanged();
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile(); PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
String skillName = skillType.toString(); String skillName = skillType.toString();
int playerSkillLevel = playerProfile.getSkillLevel(skillType); int playerSkillLevel = playerProfile.getSkillLevel(skillType);
@ -215,7 +215,7 @@ public class EventUtils {
McMMOPlayer killerPlayer = UserManager.getPlayer(killer); McMMOPlayer killerPlayer = UserManager.getPlayer(killer);
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile(); PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
String skillName = skillType.toString(); String skillName = skillType.toString();
int victimSkillLevel = victimProfile.getSkillLevel(skillType); int victimSkillLevel = victimProfile.getSkillLevel(skillType);

View File

@ -23,7 +23,7 @@ public final class HardcoreManager {
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>(); HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
HashMap<String, Float> experienceChanged = new HashMap<String, Float>(); HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
if (!skillType.getHardcoreStatLossEnabled()) { if (!skillType.getHardcoreStatLossEnabled()) {
break; break;
} }
@ -62,7 +62,7 @@ public final class HardcoreManager {
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>(); HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
HashMap<String, Float> experienceChanged = new HashMap<String, Float>(); HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
if (!skillType.getHardcoreVampirismEnabled()) { if (!skillType.getHardcoreVampirismEnabled()) {
break; break;
} }
@ -107,7 +107,7 @@ public final class HardcoreManager {
public static boolean isStatLossEnabled() { public static boolean isStatLossEnabled() {
boolean enabled = false; boolean enabled = false;
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
if (skillType.getHardcoreStatLossEnabled()) { if (skillType.getHardcoreStatLossEnabled()) {
enabled = true; enabled = true;
break; break;
@ -125,7 +125,7 @@ public final class HardcoreManager {
public static boolean isVampirismEnabled() { public static boolean isVampirismEnabled() {
boolean enabled = false; boolean enabled = false;
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.nonChildSkills) {
if (skillType.getHardcoreVampirismEnabled()) { if (skillType.getHardcoreVampirismEnabled()) {
enabled = true; enabled = true;
break; break;

View File

@ -375,7 +375,7 @@ public final class HolidayManager {
} }
public void levelUpApril(Player player, FakeSkillType fakeSkillType) { public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(SkillType.MINING)) + 1; int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(SkillType.mining)) + 1;
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")"); player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")");
ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size()))); ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));

View File

@ -85,7 +85,7 @@ public final class Motd {
* @param player Target player * @param player Target player
*/ */
public static void displayXpPerks(Player player) { public static void displayXpPerks(Player player) {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.skillList) {
if (PerksUtils.handleXpPerks(player, 1, skill) > 1) { if (PerksUtils.handleXpPerks(player, 1, skill) > 1) {
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.XP.Name"), LocaleLoader.getString("Perks.XP.Desc"))); player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.XP.Name"), LocaleLoader.getString("Perks.XP.Desc")));
return; return;
@ -126,7 +126,7 @@ public final class Motd {
* @param player Target player * @param player Target player
*/ */
public static void displayLuckyPerks(Player player) { public static void displayLuckyPerks(Player player) {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.skillList) {
if (Permissions.lucky(player, skill)) { if (Permissions.lucky(player, skill)) {
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc.Login"))); player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc.Login")));
return; return;

View File

@ -61,9 +61,9 @@ public final class CommandRegistrationManager {
private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission"); private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
private static void registerSkillCommands() { private static void registerSkillCommands() {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.skillList) {
String commandName = skill.toString().toLowerCase(); String commandName = skill.toString().toLowerCase();
String localizedName = skill.getName().toLowerCase(); String localizedName = skill.getLocalizedName().toLowerCase();
PluginCommand command; PluginCommand command;
@ -74,69 +74,10 @@ public final class CommandRegistrationManager {
command.setUsage(LocaleLoader.getString("Commands.Usage.0", localizedName)); command.setUsage(LocaleLoader.getString("Commands.Usage.0", localizedName));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", localizedName, "?", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]")); command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", localizedName, "?", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
switch (skill) { try {
case ACROBATICS: command.setExecutor(skill.getCommandClass().newInstance());
command.setExecutor(new AcrobaticsCommand()); } catch (Exception e) {
break; e.printStackTrace();
case ALCHEMY:
command.setExecutor(new AlchemyCommand());
break;
case ARCHERY:
command.setExecutor(new ArcheryCommand());
break;
case AXES:
command.setExecutor(new AxesCommand());
break;
case EXCAVATION:
command.setExecutor(new ExcavationCommand());
break;
case FISHING:
command.setExecutor(new FishingCommand());
break;
case HERBALISM:
command.setExecutor(new HerbalismCommand());
break;
case MINING:
command.setExecutor(new MiningCommand());
break;
case REPAIR:
command.setExecutor(new RepairCommand());
break;
case SALVAGE:
command.setExecutor(new SalvageCommand());
break;
case SMELTING:
command.setExecutor(new SmeltingCommand());
break;
case SWORDS:
command.setExecutor(new SwordsCommand());
break;
case TAMING:
command.setExecutor(new TamingCommand());
break;
case UNARMED:
command.setExecutor(new UnarmedCommand());
break;
case WOODCUTTING:
command.setExecutor(new WoodcuttingCommand());
break;
default:
break;
} }
} }
} }

View File

@ -181,7 +181,7 @@ public final class CommandUtils {
* @param display The sender to display stats to * @param display The sender to display stats to
*/ */
public static void printGatheringSkills(Player inspect, CommandSender display) { public static void printGatheringSkills(Player inspect, CommandSender display) {
printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Gathering"), SkillType.GATHERING_SKILLS); printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Gathering"), SkillType.gatheringSkills);
} }
public static void printGatheringSkills(Player player) { public static void printGatheringSkills(Player player) {
@ -195,7 +195,7 @@ public final class CommandUtils {
* @param display The sender to display stats to * @param display The sender to display stats to
*/ */
public static void printCombatSkills(Player inspect, CommandSender display) { public static void printCombatSkills(Player inspect, CommandSender display) {
printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Combat"), SkillType.COMBAT_SKILLS); printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Combat"), SkillType.combatSkills);
} }
public static void printCombatSkills(Player player) { public static void printCombatSkills(Player player) {
@ -209,7 +209,7 @@ public final class CommandUtils {
* @param display The sender to display stats to * @param display The sender to display stats to
*/ */
public static void printMiscSkills(Player inspect, CommandSender display) { public static void printMiscSkills(Player inspect, CommandSender display) {
printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Misc"), SkillType.MISC_SKILLS); printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Misc"), SkillType.miscSkills);
} }
public static void printMiscSkills(Player player) { public static void printMiscSkills(Player player) {

View File

@ -76,14 +76,14 @@ public class ScoreboardManager {
Collections.shuffle(colors, Misc.getRandom()); Collections.shuffle(colors, Misc.getRandom());
int i = 0; int i = 0;
for (SkillType type : SkillType.values()) { for (SkillType type : SkillType.skillList) {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false)); skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getLocalizedName(), false));
if (type.getAbility() != null) { if (type.getAbility() != null) {
abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getName())); abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getName()));
if (type == SkillType.MINING) { if (type == SkillType.mining) {
abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(colors.get(i) + AbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(colors.get(i) + AbilityType.BLAST_MINING.getName()));
} }
} }
@ -94,14 +94,14 @@ public class ScoreboardManager {
} }
} }
else { else {
for (SkillType type : SkillType.values()) { for (SkillType type : SkillType.skillList) {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName())); skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getLocalizedName()));
if (type.getAbility() != null) { if (type.getAbility() != null) {
abilityLabelBuilder.put(type.getAbility(), getShortenedName(ChatColor.AQUA + type.getAbility().getName())); abilityLabelBuilder.put(type.getAbility(), getShortenedName(ChatColor.AQUA + type.getAbility().getName()));
if (type == SkillType.MINING) { if (type == SkillType.mining) {
abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(ChatColor.AQUA + AbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(ChatColor.AQUA + AbilityType.BLAST_MINING.getName()));
} }
} }

View File

@ -426,7 +426,7 @@ public class ScoreboardWrapper {
if (targetSkill.getAbility() != null) { if (targetSkill.getAbility() != null) {
boolean stopUpdating; boolean stopUpdating;
if (targetSkill == SkillType.MINING) { if (targetSkill == SkillType.mining) {
// Special-Case: Mining has two abilities, both with cooldowns // Special-Case: Mining has two abilities, both with cooldowns
Score cooldownSB = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.SUPER_BREAKER)); Score cooldownSB = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.SUPER_BREAKER));
Score cooldownBM = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.BLAST_MINING)); Score cooldownBM = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.BLAST_MINING));
@ -494,7 +494,7 @@ public class ScoreboardWrapper {
// Calculate power level here // Calculate power level here
int powerLevel = 0; int powerLevel = 0;
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long for (SkillType skill : SkillType.nonChildSkills) { // Don't include child skills, makes the list too long
int level = newProfile.getSkillLevel(skill); int level = newProfile.getSkillLevel(skill);
powerLevel += level; powerLevel += level;
@ -527,7 +527,7 @@ public class ScoreboardWrapper {
Integer rank; Integer rank;
Player player = mcMMO.p.getServer().getPlayerExact(playerName); Player player = mcMMO.p.getServer().getPlayerExact(playerName);
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { for (SkillType skill : SkillType.nonChildSkills) {
if (!skill.getPermissions(player)) { if (!skill.getPermissions(player)) {
continue; continue;
} }

View File

@ -60,7 +60,7 @@ public final class CombatUtils {
Map<DamageModifier, Double> modifiers = getModifiers(event); Map<DamageModifier, Double> modifiers = getModifiers(event);
if (swordsManager.canActivateAbility()) { if (swordsManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(SkillType.SWORDS); mcMMOPlayer.checkAbilityActivation(SkillType.swords);
} }
if (swordsManager.canUseBleed()) { if (swordsManager.canUseBleed()) {
@ -71,7 +71,7 @@ public final class CombatUtils {
swordsManager.serratedStrikes(target, initialDamage, modifiers); swordsManager.serratedStrikes(target, initialDamage, modifiers);
} }
startGainXp(mcMMOPlayer, target, SkillType.SWORDS); startGainXp(mcMMOPlayer, target, SkillType.swords);
} }
private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) { private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
@ -83,7 +83,7 @@ public final class CombatUtils {
AxesManager axesManager = mcMMOPlayer.getAxesManager(); AxesManager axesManager = mcMMOPlayer.getAxesManager();
if (axesManager.canActivateAbility()) { if (axesManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(SkillType.AXES); mcMMOPlayer.checkAbilityActivation(SkillType.axes);
} }
if (axesManager.canUseAxeMastery()) { if (axesManager.canUseAxeMastery()) {
@ -106,7 +106,7 @@ public final class CombatUtils {
} }
applyScaledModifiers(initialDamage, finalDamage, event); applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, SkillType.AXES); startGainXp(mcMMOPlayer, target, SkillType.axes);
} }
private static void processUnarmedCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) { private static void processUnarmedCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
@ -117,7 +117,7 @@ public final class CombatUtils {
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager(); UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
if (unarmedManager.canActivateAbility()) { if (unarmedManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED); mcMMOPlayer.checkAbilityActivation(SkillType.unarmed);
} }
if (unarmedManager.canUseIronArm()) { if (unarmedManager.canUseIronArm()) {
@ -133,7 +133,7 @@ public final class CombatUtils {
} }
applyScaledModifiers(initialDamage, finalDamage, event); applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, SkillType.UNARMED); startGainXp(mcMMOPlayer, target, SkillType.unarmed);
} }
private static void processTamingCombat(LivingEntity target, Player master, Wolf wolf, EntityDamageByEntityEvent event) { private static void processTamingCombat(LivingEntity target, Player master, Wolf wolf, EntityDamageByEntityEvent event) {
@ -156,7 +156,7 @@ public final class CombatUtils {
} }
applyScaledModifiers(initialDamage, finalDamage, event); applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, SkillType.TAMING); startGainXp(mcMMOPlayer, target, SkillType.taming);
} }
private static void processArcheryCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Arrow arrow) { private static void processArcheryCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Arrow arrow) {
@ -166,7 +166,7 @@ public final class CombatUtils {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager(); ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
if (target instanceof Player && SkillType.UNARMED.getPVPEnabled()) { if (target instanceof Player && SkillType.unarmed.getPVPEnabled()) {
UnarmedManager unarmedManager = UserManager.getPlayer((Player) target).getUnarmedManager(); UnarmedManager unarmedManager = UserManager.getPlayer((Player) target).getUnarmedManager();
if (unarmedManager.canDeflect()) { if (unarmedManager.canDeflect()) {
@ -193,7 +193,7 @@ public final class CombatUtils {
archeryManager.distanceXpBonus(target, arrow); archeryManager.distanceXpBonus(target, arrow);
applyScaledModifiers(initialDamage, finalDamage, event); applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble()); startGainXp(mcMMOPlayer, target, SkillType.archery, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
} }
/** /**
@ -231,29 +231,29 @@ public final class CombatUtils {
} }
if (ItemUtils.isSword(heldItem)) { if (ItemUtils.isSword(heldItem)) {
if (!SkillType.SWORDS.shouldProcess(target)) { if (!SkillType.swords.shouldProcess(target)) {
return; return;
} }
if (SkillType.SWORDS.getPermissions(player)) { if (SkillType.swords.getPermissions(player)) {
processSwordCombat(target, player, event); processSwordCombat(target, player, event);
} }
} }
else if (ItemUtils.isAxe(heldItem)) { else if (ItemUtils.isAxe(heldItem)) {
if (!SkillType.AXES.shouldProcess(target)) { if (!SkillType.axes.shouldProcess(target)) {
return; return;
} }
if (SkillType.AXES.getPermissions(player)) { if (SkillType.axes.getPermissions(player)) {
processAxeCombat(target, player, event); processAxeCombat(target, player, event);
} }
} }
else if (heldItem.getType() == Material.AIR) { else if (heldItem.getType() == Material.AIR) {
if (!SkillType.UNARMED.shouldProcess(target)) { if (!SkillType.unarmed.shouldProcess(target)) {
return; return;
} }
if (SkillType.UNARMED.getPermissions(player)) { if (SkillType.unarmed.getPermissions(player)) {
processUnarmedCombat(target, player, event); processUnarmedCombat(target, player, event);
} }
} }
@ -263,10 +263,10 @@ public final class CombatUtils {
Wolf wolf = (Wolf) damager; Wolf wolf = (Wolf) damager;
AnimalTamer tamer = wolf.getOwner(); AnimalTamer tamer = wolf.getOwner();
if (tamer != null && tamer instanceof Player && SkillType.TAMING.shouldProcess(target)) { if (tamer != null && tamer instanceof Player && SkillType.taming.shouldProcess(target)) {
Player master = (Player) tamer; Player master = (Player) tamer;
if (!Misc.isNPCEntity(master) && SkillType.TAMING.getPermissions(master)) { if (!Misc.isNPCEntity(master) && SkillType.taming.getPermissions(master)) {
processTamingCombat(target, master, wolf, event); processTamingCombat(target, master, wolf, event);
} }
} }
@ -275,10 +275,10 @@ public final class CombatUtils {
Arrow arrow = (Arrow) damager; Arrow arrow = (Arrow) damager;
ProjectileSource projectileSource = arrow.getShooter(); ProjectileSource projectileSource = arrow.getShooter();
if (projectileSource != null && projectileSource instanceof Player && SkillType.ARCHERY.shouldProcess(target)) { if (projectileSource != null && projectileSource instanceof Player && SkillType.archery.shouldProcess(target)) {
Player player = (Player) projectileSource; Player player = (Player) projectileSource;
if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) { if (!Misc.isNPCEntity(player) && SkillType.archery.getPermissions(player)) {
processArcheryCombat(target, player, event, arrow); processArcheryCombat(target, player, event, arrow);
} }
} }
@ -301,7 +301,7 @@ public final class CombatUtils {
} }
if (ItemUtils.isSword(player.getItemInHand())) { if (ItemUtils.isSword(player.getItemInHand())) {
if (!SkillType.SWORDS.shouldProcess(target)) { if (!SkillType.swords.shouldProcess(target)) {
return; return;
} }
@ -393,24 +393,17 @@ public final class CombatUtils {
LivingEntity livingEntity = (LivingEntity) entity; LivingEntity livingEntity = (LivingEntity) entity;
EventUtils.callFakeArmSwingEvent(attacker); EventUtils.callFakeArmSwingEvent(attacker);
switch (type) { if(type == SkillType.swords) {
case SWORDS:
if (entity instanceof Player) { if (entity instanceof Player) {
((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck")); ((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck"));
} }
BleedTimerTask.add(livingEntity, Swords.serratedStrikesBleedTicks); BleedTimerTask.add(livingEntity, Swords.serratedStrikesBleedTicks);
break; }
else if(type == SkillType.axes) {
case AXES:
if (entity instanceof Player) { if (entity instanceof Player) {
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.SS.Struck")); ((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.SS.Struck"));
} }
break;
default:
break;
} }
dealDamage(livingEntity, damageAmount, attacker); dealDamage(livingEntity, damageAmount, attacker);

View File

@ -82,7 +82,7 @@ public class SkillUtils {
* @return true if this is a valid skill, false otherwise * @return true if this is a valid skill, false otherwise
*/ */
public static boolean isSkill(String skillName) { public static boolean isSkill(String skillName) {
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? SkillType.getSkill(skillName) != null : isLocalizedSkill(skillName); return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? SkillType.getSkillFromLocalized(skillName) != null : isLocalizedSkill(skillName);
} }
public static void sendSkillMessage(Player player, String message) { public static void sendSkillMessage(Player player, String message) {
@ -132,7 +132,7 @@ public class SkillUtils {
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
SkillType skill = mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) ? SkillType.MINING : SkillType.EXCAVATION; SkillType skill = mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) ? SkillType.mining : SkillType.excavation;
int ticks = PerksUtils.handleActivationPerks(player, 2 + (mcMMOPlayer.getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR; int ticks = PerksUtils.handleActivationPerks(player, 2 + (mcMMOPlayer.getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), skill.getAbility().getMaxLength()) * Misc.TICK_CONVERSION_FACTOR;
PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10); PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
@ -229,7 +229,7 @@ public class SkillUtils {
} }
private static boolean isLocalizedSkill(String skillName) { private static boolean isLocalizedSkill(String skillName) {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.skillList) {
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"))) { if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"))) {
return true; return true;
} }