More work on migrating commands to new API

This commit is contained in:
nossr50 2020-12-23 15:29:39 -08:00
parent 537b120ffc
commit 9b9ffbb982
46 changed files with 352 additions and 341 deletions

View File

@ -31,7 +31,7 @@
// * @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 PrimarySkillType.getSkill(skillType) != null; // return mcMMO.p.getSkillRegister().getSkill(skillType) != null;
// } // }
// //
// /** // /**
@ -74,7 +74,7 @@
// * @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) {
// PrimarySkillType skill = PrimarySkillType.getSkill(skillType); // PrimarySkillType skill = mcMMO.p.getSkillRegister().getSkill(skillType);
// //
// return skill != null && !skill.isChildSkill(); // return skill != null && !skill.isChildSkill();
// } // }
@ -1164,7 +1164,7 @@
// } // }
// //
// private static PrimarySkillType getSkillType(String skillType) throws InvalidSkillException { // private static PrimarySkillType getSkillType(String skillType) throws InvalidSkillException {
// PrimarySkillType skill = PrimarySkillType.getSkill(skillType); // PrimarySkillType skill = mcMMO.p.getSkillRegister().getSkill(skillType);
// //
// if (skill == null) { // if (skill == null) {
// throw new InvalidSkillException(); // throw new InvalidSkillException();

View File

@ -150,7 +150,7 @@ public class McImportCommand implements CommandExecutor {
return; return;
} }
// Write the file, go through each skill and write all the materials // Write the file, go through each rootSkilland write all the materials
for (String configSection : configSections.keySet()) { for (String configSection : configSections.keySet()) {
if (configSection.equals("UNIDENTIFIED")) { if (configSection.equals("UNIDENTIFIED")) {
writer.append("# This isn't a valid config section and all materials in this category need to be").append("\r\n"); writer.append("# This isn't a valid config section and all materials in this category need to be").append("\r\n");
@ -211,19 +211,19 @@ public class McImportCommand implements CommandExecutor {
skillName = "Excavation"; skillName = "Excavation";
} }
if (!configSections.containsKey(skillName)) { if (!configSections.containsKey(rootSkillName)) {
configSections.put(skillName, new ArrayList<>()); configSections.put(rootSkillName, new ArrayList<>());
} }
ArrayList<String> skillContents = configSections.get(skillName); ArrayList<String> skillContents = configSections.get(rootSkillName);
skillContents.add(" " + materialName + "|0:"); skillContents.add(" " + materialName + "|0:");
skillContents.add(" " + " " + "XP_Gain: 99"); skillContents.add(" " + " " + "XP_Gain: 99");
skillContents.add(" " + " " + "Double_Drops_Enabled: true"); skillContents.add(" " + " " + "Double_Drops_Enabled: true");
if (skillName.equals("Mining")) { if (rootSkillName.equals("Mining")) {
skillContents.add(" " + " " + "Smelting_XP_Gain: 9"); skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
} }
else if (skillName.equals("Woodcutting")) { else if (rootSkillName.equals("Woodcutting")) {
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG")); skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
} }
} }

View File

@ -22,7 +22,7 @@ public class DatabaseRemovePlayerCommand implements TabExecutor {
if (args.length == 1) { if (args.length == 1) {
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
if (mcMMO.getUserManager().queryPlayerName(playerName) == null if (mcMMO.getUserManager().queryPlayer(playerName) == null
&& CommandUtils.hasNoProfile(sender, mcMMO.getDatabaseManager().queryPlayerDataByUUID(playerName, false))) { && CommandUtils.hasNoProfile(sender, mcMMO.getDatabaseManager().queryPlayerDataByUUID(playerName, false))) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline")); sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true; return true;

View File

@ -21,15 +21,15 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
float xpRemoved = profile.getSkillXpLevelRaw(skill); float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
profile.addLevels(skill, value); profile.addLevels(rootSkill, value);
if (player == null) { if (player == null) {
profile.scheduleAsyncSave(); profile.scheduleAsyncSave();
return; return;
} }
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND); EventUtils.tryLevelChangeEvent(player, rootSkill, value, xpRemoved, true, XPGainReason.COMMAND);
} }
@Override @Override
@ -45,6 +45,6 @@ public class AddlevelsCommand extends ExperienceCommand {
if(isSilent) if(isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, rootSkill.getName()));
} }
} }

View File

@ -25,10 +25,10 @@ public class AddxpCommand extends ExperienceCommand {
if(mcMMO.getUserManager().getPlayer(player) == null) if(mcMMO.getUserManager().getPlayer(player) == null)
return; return;
mcMMO.getUserManager().getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND); mcMMO.getUserManager().getPlayer(player).applyXpGain(rootSkill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
} }
else { else {
profile.addXp(skill, value); profile.addXp(rootSkill, value);
profile.scheduleAsyncSave(); profile.scheduleAsyncSave();
} }
} }
@ -46,6 +46,6 @@ public class AddxpCommand extends ExperienceCommand {
if(isSilent) if(isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, rootSkill.getName()));
} }
} }

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.MMOPlayer; import com.neetgames.mcmmo.player.MMOPlayer;
@ -45,14 +46,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
skill = PrimarySkillType.getSkill(args[0]); rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; rootSkill = null;
} }
if (skill != null && skill.isChildSkill()) if (rootSkill != null && rootSkill.isChildSkill()) {
{
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
@ -66,7 +66,7 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
editValues(mmoPlayer, skill, Integer.parseInt(args[1]), isSilent(args)); editValues(mmoPlayer, rootSkill, Integer.parseInt(args[1]), isSilent(args));
return true; return true;
} else if((args.length == 3 && !isSilent(args)) } else if((args.length == 3 && !isSilent(args))
|| (args.length == 4 && isSilent(args))) { || (args.length == 4 && isSilent(args))) {
@ -79,13 +79,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
skill = PrimarySkillType.getSkill(args[1]); rootSkill = mcMMO.p.getSkillRegister().getSkill(args[1]);
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; rootSkill = null;
} }
if (skill != null && skill.isChildSkill()) if (rootSkill != null && rootSkill.isChildSkill())
{ {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true; return true;
@ -94,7 +94,7 @@ public abstract class ExperienceCommand implements TabExecutor {
int value = Integer.parseInt(args[2]); int value = Integer.parseInt(args[2]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName); OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerName);
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process. // If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mmoPlayer == null) { if (mmoPlayer == null) {
@ -109,10 +109,10 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
editValues(null, profile, skill, value, isSilent(args)); editValues(null, profile, rootSkill, value, isSilent(args));
} }
else { else {
editValues(Misc.adaptPlayer(mmoPlayer), mcMMOPlayer.getProfile(), skill, value, isSilent(args)); editValues(Misc.adaptPlayer(mmoPlayer), mcMMOPlayer.getProfile(), rootSkill, value, isSilent(args));
} }
handleSenderMessage(sender, playerName, skill); handleSenderMessage(sender, playerName, skill);
@ -157,11 +157,11 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
protected static void handleSenderMessage(CommandSender sender, String playerName, RootSkill rootSkill) { protected static void handleSenderMessage(CommandSender sender, String playerName, RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
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", rootSkill.getName(), playerName));
} }
} }

View File

@ -21,10 +21,10 @@ public class MmoeditCommand extends ExperienceCommand {
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
int skillLevel = profile.getSkillLevel(skill); int skillLevel = profile.getSkillLevel(rootSkill);
float xpRemoved = profile.getSkillXpLevelRaw(skill); float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
profile.modifySkill(skill, value); profile.modifySkill(rootSkill, value);
if (player == null) { if (player == null) {
profile.scheduleAsyncSave(); profile.scheduleAsyncSave();
@ -35,7 +35,7 @@ public class MmoeditCommand extends ExperienceCommand {
return; return;
} }
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel); EventUtils.tryLevelEditEvent(player, rootSkill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
} }
@Override @Override
@ -51,6 +51,6 @@ public class MmoeditCommand extends ExperienceCommand {
if(isSilent) if(isSilent)
return; return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value)); player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", rootSkill.getName(), value));
} }
} }

View File

@ -45,10 +45,10 @@ public class SkillresetCommand implements TabExecutor {
} }
if (args[0].equalsIgnoreCase("all")) { if (args[0].equalsIgnoreCase("all")) {
skill = null; rootSkill = null;
} }
else { else {
skill = PrimarySkillType.getSkill(args[0]); rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
} }
editValues((Player) sender, mcMMO.getUserManager().queryPlayer(player) editValues((Player) sender, mcMMO.getUserManager().queryPlayer(player)
@ -66,14 +66,14 @@ public class SkillresetCommand implements TabExecutor {
} }
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
skill = null; rootSkill = null;
} }
else { else {
skill = PrimarySkillType.getSkill(args[1]); rootSkill = mcMMO.p.getSkillRegister().getSkill(args[1]);
} }
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName); OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerName);
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process. // If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mmoPlayer == null) { if (mmoPlayer == null) {
@ -116,17 +116,17 @@ public class SkillresetCommand implements TabExecutor {
} }
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill) {
int levelsRemoved = profile.getSkillLevel(skill); int levelsRemoved = profile.getSkillLevel(rootSkill);
float xpRemoved = profile.getSkillXpLevelRaw(skill); float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
profile.modifySkill(skill, 0); profile.modifySkill(rootSkill, 0);
if (player == null) { if (player == null) {
profile.scheduleAsyncSave(); profile.scheduleAsyncSave();
return; return;
} }
EventUtils.tryLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false, XPGainReason.COMMAND); EventUtils.tryLevelChangeEvent(player, rootSkill, levelsRemoved, xpRemoved, false, XPGainReason.COMMAND);
} }
protected boolean permissionsCheckSelf(CommandSender sender) { protected boolean permissionsCheckSelf(CommandSender sender) {
@ -142,7 +142,7 @@ public class SkillresetCommand implements TabExecutor {
} }
protected void handlePlayerMessageSkill(Player player, RootSkill rootSkill) { protected void handlePlayerMessageSkill(Player player, RootSkill rootSkill) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", rootSkill.getName()));
} }
private boolean validateArguments(CommandSender sender, String skillName) { private boolean validateArguments(CommandSender sender, String skillName) {
@ -150,16 +150,16 @@ public class SkillresetCommand implements TabExecutor {
} }
protected static void handleSenderMessage(CommandSender sender, String playerName, RootSkill rootSkill) { protected static void handleSenderMessage(CommandSender sender, String playerName, RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
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", rootSkill.getName(), playerName));
} }
} }
protected void editValues(Player player, PlayerProfile profile, RootSkill rootSkill) { protected void editValues(Player player, PlayerProfile profile, RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, primarySkillType); handleCommand(player, profile, primarySkillType);
} }

View File

@ -20,7 +20,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
@Override @Override
protected boolean checkEnabled(RootSkill rootSkill) { protected boolean checkEnabled(RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.values()) { for (RootSkill rootSkill : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreStatLossEnabled()) { if (!primarySkillType.getHardcoreStatLossEnabled()) {
return false; return false;
@ -30,7 +30,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
return true; return true;
} }
return skill.getHardcoreStatLossEnabled(); return rootSkill.getHardcoreStatLossEnabled();
} }
@Override @Override
@ -50,15 +50,15 @@ public class HardcoreCommand extends HardcoreModeCommand {
} }
private void toggle(boolean enable, RootSkill rootSkill) { private void toggle(boolean enable, RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreStatLossEnabled(enable); primarySkillType.setHardcoreStatLossEnabled(enable);
} }
} }
else { else {
skill.setHardcoreStatLossEnabled(enable); rootSkill.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"), (rootSkill == null ? "all skills" : rootSkill.getName())));
} }
} }

View File

@ -75,7 +75,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true; return true;
} }
RootSkill rootSkill = PrimarySkillType.getSkill(args[0]); RootSkill rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
if (!CommandUtils.isChildSkill(sender, skill)) { if (!CommandUtils.isChildSkill(sender, skill)) {
return true; return true;
@ -87,7 +87,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true; return true;
} }
enable(skill); enable(rootSkill);
return true; return true;
} }
@ -97,7 +97,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true; return true;
} }
enable(skill); enable(rootSkill);
return true; return true;
} }

View File

@ -20,7 +20,7 @@ public class VampirismCommand extends HardcoreModeCommand {
@Override @Override
protected boolean checkEnabled(RootSkill rootSkill) { protected boolean checkEnabled(RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.values()) { for (RootSkill rootSkill : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreVampirismEnabled()) { if (!primarySkillType.getHardcoreVampirismEnabled()) {
return false; return false;
@ -30,7 +30,7 @@ public class VampirismCommand extends HardcoreModeCommand {
return true; return true;
} }
return skill.getHardcoreVampirismEnabled(); return rootSkill.getHardcoreVampirismEnabled();
} }
@Override @Override
@ -50,15 +50,15 @@ public class VampirismCommand extends HardcoreModeCommand {
} }
private void toggle(boolean enable, RootSkill rootSkill) { private void toggle(boolean enable, RootSkill rootSkill) {
if (skill == null) { if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreVampirismEnabled(enable); primarySkillType.setHardcoreVampirismEnabled(enable);
} }
} }
else { else {
skill.setHardcoreVampirismEnabled(enable); rootSkill.setHardcoreVampirismEnabled(enable);
} }
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (skill == null ? "all skills" : skill))); mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (rootSkill == null ? "all skills" : skill)));
} }
} }

View File

@ -17,7 +17,7 @@ public class PartyInviteCommand implements CommandExecutor {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) { if (args.length == 2) {
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayerName(targetName); OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false; return false;

View File

@ -35,7 +35,7 @@ public class PtpAcceptCommand implements CommandExecutor {
return true; return true;
} }
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) { if (rootSkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
ptpRecord.removeRequest(); ptpRecord.removeRequest();
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired")); player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
return true; return true;

View File

@ -52,7 +52,7 @@ public class McrankCommand implements TabExecutor {
} }
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName); OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerName);
if (mmoPlayer != null) { if (mmoPlayer != null) {
Player player = Misc.adaptPlayer(mmoPlayer); Player player = Misc.adaptPlayer(mmoPlayer);

View File

@ -125,7 +125,7 @@ public class MctopCommand implements TabExecutor {
return null; return null;
} }
RootSkill rootSkill = PrimarySkillType.getSkill(skillName); RootSkill rootSkill = mcMMO.p.getSkillRegister().getSkill(rootSkillName);
if (CommandUtils.isChildSkill(sender, skill)) { if (CommandUtils.isChildSkill(sender, skill)) {
return null; return null;

View File

@ -32,23 +32,23 @@ public class XPBarCommand implements TabExecutor {
} else if(args.length < 2) { } else if(args.length < 2) {
String option = args[0]; String option = args[0];
if(option.equalsIgnoreCase(SkillBossBarSetting.RESET.toString())) { if(option.equalsIgnoreCase(rootSkillBossBarSetting.RESET.toString())) {
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(SkillBossBarSetting.RESET, null); mmoPlayer.getExperienceBarManager().xpBarSettingToggle(rootSkillBossBarSetting.RESET, null);
return true; return true;
} else if(option.equalsIgnoreCase(SkillBossBarSetting.DISABLE.toString())) { } else if(option.equalsIgnoreCase(rootSkillBossBarSetting.DISABLE.toString())) {
mmoPlayer.getExperienceBarManager().disableAllBars(); mmoPlayer.getExperienceBarManager().disableAllBars();
return true; return true;
} else { } else {
return false; return false;
} }
//Per skill Settings path //Per rootSkillSettings path
} else if (args.length == 2) { } else if (args.length == 2) {
String skillName = args[1]; String skillName = args[1];
if(SkillUtils.isSkill(skillName)) { if(rootSkillUtils.isSkill(rootSkillName)) {
PrimarySkillType targetSkill = PrimarySkillType.getSkill(skillName); PrimarySkillType targetSkill = mcMMO.p.getSkillRegister().getSkill(rootSkillName);
//Target setting //Target setting
String option = args[0].toLowerCase(); String option = args[0].toLowerCase();
@ -93,13 +93,13 @@ public class XPBarCommand implements TabExecutor {
case 1: case 1:
List<String> options = new ArrayList<>(); List<String> options = new ArrayList<>();
for(SkillBossBarSetting settingTarget : SkillBossBarSetting.values()) { for(rootSkillBossBarSetting settingTarget : SkillBossBarSetting.values()) {
options.add(StringUtils.getCapitalized(settingTarget.toString())); options.add(StringUtils.getCapitalized(settingTarget.toString()));
} }
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(SkillBossBarSetting.values().length)); return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(rootSkillBossBarSetting.values().length));
case 2: case 2:
if(!args[0].equalsIgnoreCase(SkillBossBarSetting.RESET.toString())) if(!args[0].equalsIgnoreCase(rootSkillBossBarSetting.RESET.toString()))
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* This command facilitates switching the skill system scale between classic and modern scale * This command facilitates switching the rootSkillsystem scale between classic and modern scale
*/ */
public class Mcmmoupgrade implements CommandExecutor { public class Mcmmoupgrade implements CommandExecutor {
@Override @Override

View File

@ -1,9 +1,11 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.random.RandomChanceSkill; import com.gmail.nossr50.util.random.RandomChanceSkill;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
@ -23,7 +25,7 @@ public class AcrobaticsCommand extends SkillCommand {
private boolean canRoll; private boolean canRoll;
public AcrobaticsCommand() { public AcrobaticsCommand() {
super(PrimarySkillType.ACROBATICS); super(CoreSkills.ACROBATICS);
} }
@Override @Override
@ -92,7 +94,7 @@ public class AcrobaticsCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ACROBATICS); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.ACROBATICS);
return textComponents; return textComponents;
} }

View File

@ -29,7 +29,7 @@ public class AlchemyCommand extends SkillCommand {
private boolean canConcoctions; private boolean canConcoctions;
public AlchemyCommand() { public AlchemyCommand() {
super(PrimarySkillType.ALCHEMY); super(CoreSkills.ALCHEMY);
} }
protected String[] calculateAbilityDisplayValues(@NotNull Player player) { protected String[] calculateAbilityDisplayValues(@NotNull Player player) {
@ -48,7 +48,7 @@ public class AlchemyCommand extends SkillCommand {
AlchemyManager alchemyManager = ((McMMOPlayer) (mmoPlayer)).getAlchemyManager(); AlchemyManager alchemyManager = ((McMMOPlayer) (mmoPlayer)).getAlchemyManager();
String[] displayValues = new String[2]; String[] displayValues = new String[2];
boolean isLucky = Permissions.lucky(Misc.adaptPlayer(mmoPlayer), PrimarySkillType.ALCHEMY); boolean isLucky = Permissions.lucky(Misc.adaptPlayer(mmoPlayer), CoreSkills.ALCHEMY);
displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x"; displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x";
displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null; displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null;
@ -105,7 +105,7 @@ public class AlchemyCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ALCHEMY); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.ALCHEMY);
return textComponents; return textComponents;
} }

View File

@ -32,7 +32,7 @@ public class AprilCommand implements TabExecutor {
if (args.length == 0) { if (args.length == 0) {
Player player = (Player) sender; Player player = (Player) sender;
FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName); FakeSkillType fakeSkillType = FakeSkillType.getByName(rootSkillName);
float skillValue = Misc.getRandom().nextInt(99); float skillValue = Misc.getRandom().nextInt(99);

View File

@ -25,7 +25,7 @@ public class ArcheryCommand extends SkillCommand {
private boolean canRetrieve; private boolean canRetrieve;
public ArcheryCommand() { public ArcheryCommand() {
super(PrimarySkillType.ARCHERY); super(CoreSkills.ARCHERY);
} }
@Override @Override
@ -44,7 +44,7 @@ public class ArcheryCommand extends SkillCommand {
dazeChanceLucky = dazeStrings[1]; dazeChanceLucky = dazeStrings[1];
} }
// SKILL SHOT // rootSkillSHOT
if (canSkillShot) { if (canSkillShot) {
skillShotBonus = percent.format(Archery.getDamageBonusPercent(mmoPlayer)); skillShotBonus = percent.format(Archery.getDamageBonusPercent(mmoPlayer));
} }
@ -87,7 +87,7 @@ public class ArcheryCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ARCHERY); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.ARCHERY);
return textComponents; return textComponents;
} }

View File

@ -30,7 +30,7 @@ public class AxesCommand extends SkillCommand {
private boolean canGreaterImpact; private boolean canGreaterImpact;
public AxesCommand() { public AxesCommand() {
super(PrimarySkillType.AXES); super(CoreSkills.AXES);
} }
@Override @Override
@ -107,7 +107,7 @@ public class AxesCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.AXES); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.AXES);
return textComponents; return textComponents;
} }

View File

@ -12,7 +12,7 @@ import java.util.List;
public class CrossbowsCommand extends SkillCommand { public class CrossbowsCommand extends SkillCommand {
public CrossbowsCommand() { public CrossbowsCommand() {
super(PrimarySkillType.CROSSBOWS); super(CoreSkills.CROSSBOWS);
} }
@Override @Override
@ -43,7 +43,7 @@ public class CrossbowsCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.CROSSBOWS); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.CROSSBOWS);
return textComponents; return textComponents;
} }

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.excavation.ExcavationManager;
@ -21,7 +23,7 @@ public class ExcavationCommand extends SkillCommand {
private boolean canTreasureHunt; private boolean canTreasureHunt;
public ExcavationCommand() { public ExcavationCommand() {
super(PrimarySkillType.EXCAVATION); super(CoreSkills.EXCAVATION);
} }
@Override @Override
@ -68,7 +70,7 @@ public class ExcavationCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.EXCAVATION); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.EXCAVATION);
return textComponents; return textComponents;
} }

View File

@ -42,7 +42,7 @@ public class FishingCommand extends SkillCommand {
private String maMinWaitTime, maMaxWaitTime; private String maMinWaitTime, maMaxWaitTime;
public FishingCommand() { public FishingCommand() {
super(PrimarySkillType.FISHING); super(CoreSkills.FISHING);
} }
@Override @Override
@ -78,7 +78,7 @@ public class FishingCommand extends SkillCommand {
// FISHING_SHAKE // FISHING_SHAKE
if (canShake) { if (canShake) {
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(mmoPlayer, PrimarySkillType.FISHING, fishingManager.getShakeChance()); String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(mmoPlayer, CoreSkills.FISHING, fishingManager.getShakeChance());
shakeChance = shakeStrings[0]; shakeChance = shakeStrings[0];
shakeChanceLucky = shakeStrings[1]; shakeChanceLucky = shakeStrings[1];
} }
@ -154,7 +154,7 @@ public class FishingCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.FISHING); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.FISHING);
return textComponents; return textComponents;
} }

View File

@ -1,7 +1,9 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
@ -37,7 +39,7 @@ public class HerbalismCommand extends SkillCommand {
private boolean canShroomThumb; private boolean canShroomThumb;
public HerbalismCommand() { public HerbalismCommand() {
super(PrimarySkillType.HERBALISM); super(CoreSkills.HERBALISM);
} }
@Override @Override
@ -154,7 +156,7 @@ public class HerbalismCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.HERBALISM); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.HERBALISM);
return textComponents; return textComponents;
} }

View File

@ -34,7 +34,7 @@ public class MiningCommand extends SkillCommand {
private boolean canDemoExpert; private boolean canDemoExpert;
public MiningCommand() { public MiningCommand() {
super(PrimarySkillType.MINING); super(CoreSkills.MINING);
} }
@Override @Override
@ -113,7 +113,7 @@ public class MiningCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.MINING); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.MINING);
return textComponents; return textComponents;
} }

View File

@ -1,10 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -54,7 +56,7 @@ public class MmoInfoCommand implements TabExecutor {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery"));
return true; return true;
} else if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0])) } else if(InteractionManager.getAbstractByName(args[0]) != null || CoreSkills.SUBSKILL_NAMES.contains(args[0]))
{ {
displayInfo(mmoPlayer, args[0]); displayInfo(mmoPlayer, args[0]);
return true; return true;
@ -72,14 +74,14 @@ public class MmoInfoCommand implements TabExecutor {
@Override @Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) { if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<>(PrimarySkillType.SUBSKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[0], CoreSkills.SUBSKILL_NAMES, new ArrayList<>(CoreSkills.SUBSKILL_NAMES.size()));
} }
return ImmutableList.of(); return ImmutableList.of();
} }
private void displayInfo(@NotNull OnlineMMOPlayer mmoPlayer, String subSkillName) private void displayInfo(@NotNull OnlineMMOPlayer mmoPlayer, String subSkillName)
{ {
//Check to see if the skill exists in the new system //Check to see if the rootSkillexists in the new system
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName); AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
if(abstractSubSkill != null) if(abstractSubSkill != null)
{ {
@ -88,12 +90,14 @@ public class MmoInfoCommand implements TabExecutor {
//TextComponentFactory.sendPlayerUrlHeader(player); //TextComponentFactory.sendPlayerUrlHeader(player);
} else { } else {
/* /*
* Skill is only in the old system * rootSkillis only in the old system
*/ */
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); Player player = Misc.adaptPlayer(mmoPlayer);
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill")); player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
} }
for(SubSkillType subSkillType : SubSkillType.values()) for(SubSkillType subSkillType : SubSkillType.values())

View File

@ -43,7 +43,7 @@ public class RepairCommand extends SkillCommand {
private int stoneLevel; private int stoneLevel;
public RepairCommand() { public RepairCommand() {
super(PrimarySkillType.REPAIR); super(CoreSkills.REPAIR);
} }
@Override @Override
@ -123,7 +123,7 @@ public class RepairCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.REPAIR); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.REPAIR);
return textComponents; return textComponents;
} }

View File

@ -18,7 +18,7 @@ public class SalvageCommand extends SkillCommand {
private boolean canArcaneSalvage; private boolean canArcaneSalvage;
public SalvageCommand() { public SalvageCommand() {
super(PrimarySkillType.SALVAGE); super(CoreSkills.SALVAGE);
} }
@Override @Override
@ -66,7 +66,7 @@ public class SalvageCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SALVAGE); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.SALVAGE);
return textComponents; return textComponents;
} }

View File

@ -77,7 +77,7 @@ public abstract class SkillCommand implements TabExecutor {
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0); boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
float skillValue = mmoPlayer.getExperienceHandler().getSkillLevel(rootSkill); float skillValue = mmoPlayer.getExperienceHandler().getSkillLevel(rootSkill);
//Send the players a few blank lines to make finding the top of the skill command easier //Send the players a few blank lines to make finding the top of the rootSkillcommand easier
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines()) if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
player.sendMessage(""); player.sendMessage("");
@ -205,11 +205,11 @@ public abstract class SkillCommand implements TabExecutor {
} }
protected @NotNull String[] getAbilityDisplayValues(@NotNull SkillActivationType skillActivationType, @NotNull OnlineMMOPlayer mmoPlayer, @NotNull SubSkillType subSkill) { protected @NotNull String[] getAbilityDisplayValues(@NotNull SkillActivationType skillActivationType, @NotNull OnlineMMOPlayer mmoPlayer, @NotNull SubSkillType subSkill) {
return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, Misc.adaptPlayer(mmoPlayer), subSkill); return RandomChanceUtil.calculateAbilityDisplayValues(SkillActivationType, Misc.adaptPlayer(mmoPlayer), subSkill);
} }
protected @NotNull String[] calculateLengthDisplayValues(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) { protected @NotNull String[] calculateLengthDisplayValues(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
int maxLength = primarySkillType.getSuperAbilityType().getMaxLength(); int maxLength = CoreSkills.getSuperAbilityType().getMaxLength();
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap(); int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
@ -217,7 +217,7 @@ public abstract class SkillCommand implements TabExecutor {
if(abilityLengthCap <= 0) if(abilityLengthCap <= 0)
{ {
length = 2 + (int) (skillValue / abilityLengthVar); length = 2 + (int) (rootSkillValue / abilityLengthVar);
} }
else { else {
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar); length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
@ -273,7 +273,7 @@ public abstract class SkillCommand implements TabExecutor {
* Checks if a player can use a skill * Checks if a player can use a skill
* @param mmoPlayer target player * @param mmoPlayer target player
* @param subSkillType target subskill * @param subSkillType target subskill
* @return true if the player has permission and has the skill unlocked * @return true if the player has permission and has the rootSkillunlocked
*/ */
protected boolean canUseSubskill(@NotNull OnlineMMOPlayer mmoPlayer, SubSkillType subSkillType) { protected boolean canUseSubskill(@NotNull OnlineMMOPlayer mmoPlayer, SubSkillType subSkillType) {
return Permissions.isSubSkillEnabled(Misc.adaptPlayer(mmoPlayer), subSkillType) && RankUtils.hasUnlockedSubskill(mmoPlayer, subSkillType); return Permissions.isSubSkillEnabled(Misc.adaptPlayer(mmoPlayer), subSkillType) && RankUtils.hasUnlockedSubskill(mmoPlayer, subSkillType);

View File

@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
//TODO: Switch to root skill based //TODO: Switch to root rootSkillbased
public class SkillGuideCommand implements CommandExecutor { public class SkillGuideCommand implements CommandExecutor {
private final String header; private final String header;
private final RootSkill rootSkill; private final RootSkill rootSkill;
@ -21,9 +21,9 @@ public class SkillGuideCommand implements CommandExecutor {
private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid"); private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
public SkillGuideCommand(@NotNull RootSkill rootSkill) { public SkillGuideCommand(@NotNull RootSkill rootSkill) {
skill = CoreSkills.getSkill(rootSkill); rootSkill = CoreSkills.getSkill(rootSkill);
header = LocaleLoader.getString("Guides.Header", skill.getName()); header = LocaleLoader.getString("Guides.Header", rootSkill.getName());
guide = getGuide(skill); guide = getGuide(rootSkill);
} }
@Override @Override
@ -94,7 +94,7 @@ public class SkillGuideCommand implements CommandExecutor {
ArrayList<String> guide = new ArrayList<>(); ArrayList<String> guide = new ArrayList<>();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n"); String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(rootSkill.toString()) + ".Section." + i).split("\n");
if (section[0].startsWith("!")) { if (section[0].startsWith("!")) {
break; break;

View File

@ -26,7 +26,7 @@ public class SmeltingCommand extends SkillCommand {
private boolean canUnderstandTheArt; private boolean canUnderstandTheArt;
public SmeltingCommand() { public SmeltingCommand() {
super(PrimarySkillType.SMELTING); super(CoreSkills.SMELTING);
} }
@Override @Override
@ -90,7 +90,7 @@ public class SmeltingCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SMELTING); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.SMELTING);
return textComponents; return textComponents;
} }

View File

@ -29,7 +29,7 @@ public class SwordsCommand extends SkillCommand {
private boolean canBleed; private boolean canBleed;
public SwordsCommand() { public SwordsCommand() {
super(PrimarySkillType.SWORDS); super(CoreSkills.SWORDS);
} }
@Override @Override
@ -112,7 +112,7 @@ public class SwordsCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SWORDS); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.SWORDS);
return textComponents; return textComponents;
} }

View File

@ -29,7 +29,7 @@ public class TamingCommand extends SkillCommand {
private boolean canHolyHound; private boolean canHolyHound;
public TamingCommand() { public TamingCommand() {
super(PrimarySkillType.TAMING); super(CoreSkills.TAMING);
} }
@Override @Override

View File

@ -10,7 +10,7 @@ import java.util.List;
public class TridentsCommand extends SkillCommand { public class TridentsCommand extends SkillCommand {
public TridentsCommand() { public TridentsCommand() {
super(PrimarySkillType.TRIDENTS); super(CoreSkills.TRIDENTS);
} }
@Override @Override
@ -32,7 +32,7 @@ public class TridentsCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.TRIDENTS); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.TRIDENTS);
return textComponents; return textComponents;
} }

View File

@ -32,7 +32,7 @@ public class UnarmedCommand extends SkillCommand {
private boolean canIronGrip; private boolean canIronGrip;
public UnarmedCommand() { public UnarmedCommand() {
super(PrimarySkillType.UNARMED); super(CoreSkills.UNARMED);
} }
@Override @Override
@ -125,7 +125,7 @@ public class UnarmedCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.UNARMED); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.UNARMED);
return textComponents; return textComponents;
} }

View File

@ -28,7 +28,7 @@ public class WoodcuttingCommand extends SkillCommand {
private boolean canNaturesBounty; private boolean canNaturesBounty;
public WoodcuttingCommand() { public WoodcuttingCommand() {
super(PrimarySkillType.WOODCUTTING); super(CoreSkills.WOODCUTTING);
} }
@Override @Override
@ -100,7 +100,7 @@ public class WoodcuttingCommand extends SkillCommand {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) { protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>(); List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.WOODCUTTING); TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.WOODCUTTING);
return textComponents; return textComponents;
} }

View File

@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.database.UpgradeType; import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.player.*; import com.gmail.nossr50.datatypes.player.*;
import com.gmail.nossr50.datatypes.skills.CoreSkills; import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
@ -260,21 +259,21 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
+ ", unarmed = ?, herbalism = ?, excavation = ?" + ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?" + ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, total = ? WHERE user_id = ?"); + ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, total = ? WHERE user_id = ?");
statement.setInt(1, dataSnapshot.getSkillLevel(CoreSkills.TAMING_CS)); statement.setInt(1, dataSnapshot.getSkillLevel(CoreSkills.TAMING));
statement.setInt(2, dataSnapshot.getSkillLevel(CoreSkills.MINING_CS)); statement.setInt(2, dataSnapshot.getSkillLevel(CoreSkills.MINING));
statement.setInt(3, dataSnapshot.getSkillLevel(CoreSkills.REPAIR_CS)); statement.setInt(3, dataSnapshot.getSkillLevel(CoreSkills.REPAIR));
statement.setInt(4, dataSnapshot.getSkillLevel(CoreSkills.WOODCUTTING_CS)); statement.setInt(4, dataSnapshot.getSkillLevel(CoreSkills.WOODCUTTING));
statement.setInt(5, dataSnapshot.getSkillLevel(CoreSkills.UNARMED_CS)); statement.setInt(5, dataSnapshot.getSkillLevel(CoreSkills.UNARMED));
statement.setInt(6, dataSnapshot.getSkillLevel(CoreSkills.HERBALISM_CS)); statement.setInt(6, dataSnapshot.getSkillLevel(CoreSkills.HERBALISM));
statement.setInt(7, dataSnapshot.getSkillLevel(CoreSkills.EXCAVATION_CS)); statement.setInt(7, dataSnapshot.getSkillLevel(CoreSkills.EXCAVATION));
statement.setInt(8, dataSnapshot.getSkillLevel(CoreSkills.ARCHERY_CS)); statement.setInt(8, dataSnapshot.getSkillLevel(CoreSkills.ARCHERY));
statement.setInt(9, dataSnapshot.getSkillLevel(CoreSkills.SWORDS_CS)); statement.setInt(9, dataSnapshot.getSkillLevel(CoreSkills.SWORDS));
statement.setInt(10, dataSnapshot.getSkillLevel(CoreSkills.AXES_CS)); statement.setInt(10, dataSnapshot.getSkillLevel(CoreSkills.AXES));
statement.setInt(11, dataSnapshot.getSkillLevel(CoreSkills.ACROBATICS_CS)); statement.setInt(11, dataSnapshot.getSkillLevel(CoreSkills.ACROBATICS));
statement.setInt(12, dataSnapshot.getSkillLevel(CoreSkills.FISHING_CS)); statement.setInt(12, dataSnapshot.getSkillLevel(CoreSkills.FISHING));
statement.setInt(13, dataSnapshot.getSkillLevel(CoreSkills.ALCHEMY_CS)); statement.setInt(13, dataSnapshot.getSkillLevel(CoreSkills.ALCHEMY));
statement.setInt(14, dataSnapshot.getSkillLevel(CoreSkills.TRIDENTS_CS)); statement.setInt(14, dataSnapshot.getSkillLevel(CoreSkills.TRIDENTS));
statement.setInt(15, dataSnapshot.getSkillLevel(CoreSkills.CROSSBOWS_CS)); statement.setInt(15, dataSnapshot.getSkillLevel(CoreSkills.CROSSBOWS));
int total = 0; int total = 0;
for (RootSkill rootSkill : CoreSkills.getNonChildSkills()) for (RootSkill rootSkill : CoreSkills.getNonChildSkills())
total += dataSnapshot.getSkillLevel(rootSkill); total += dataSnapshot.getSkillLevel(rootSkill);
@ -292,21 +291,21 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
+ ", unarmed = ?, herbalism = ?, excavation = ?" + ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?" + ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, WHERE user_id = ?"); + ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, WHERE user_id = ?");
statement.setInt(1, dataSnapshot.getSkillXpLevel(CoreSkills.TAMING_CS)); statement.setInt(1, dataSnapshot.getSkillXpLevel(CoreSkills.TAMING));
statement.setInt(2, dataSnapshot.getSkillXpLevel(CoreSkills.MINING_CS)); statement.setInt(2, dataSnapshot.getSkillXpLevel(CoreSkills.MINING));
statement.setInt(3, dataSnapshot.getSkillXpLevel(CoreSkills.REPAIR_CS)); statement.setInt(3, dataSnapshot.getSkillXpLevel(CoreSkills.REPAIR));
statement.setInt(4, dataSnapshot.getSkillXpLevel(CoreSkills.WOODCUTTING_CS)); statement.setInt(4, dataSnapshot.getSkillXpLevel(CoreSkills.WOODCUTTING));
statement.setInt(5, dataSnapshot.getSkillXpLevel(CoreSkills.UNARMED_CS)); statement.setInt(5, dataSnapshot.getSkillXpLevel(CoreSkills.UNARMED));
statement.setInt(6, dataSnapshot.getSkillXpLevel(CoreSkills.HERBALISM_CS)); statement.setInt(6, dataSnapshot.getSkillXpLevel(CoreSkills.HERBALISM));
statement.setInt(7, dataSnapshot.getSkillXpLevel(CoreSkills.EXCAVATION_CS)); statement.setInt(7, dataSnapshot.getSkillXpLevel(CoreSkills.EXCAVATION));
statement.setInt(8, dataSnapshot.getSkillXpLevel(CoreSkills.ARCHERY_CS)); statement.setInt(8, dataSnapshot.getSkillXpLevel(CoreSkills.ARCHERY));
statement.setInt(9, dataSnapshot.getSkillXpLevel(CoreSkills.SWORDS_CS)); statement.setInt(9, dataSnapshot.getSkillXpLevel(CoreSkills.SWORDS));
statement.setInt(10, dataSnapshot.getSkillXpLevel(CoreSkills.AXES_CS)); statement.setInt(10, dataSnapshot.getSkillXpLevel(CoreSkills.AXES));
statement.setInt(11, dataSnapshot.getSkillXpLevel(CoreSkills.ACROBATICS_CS)); statement.setInt(11, dataSnapshot.getSkillXpLevel(CoreSkills.ACROBATICS));
statement.setInt(12, dataSnapshot.getSkillXpLevel(CoreSkills.FISHING_CS)); statement.setInt(12, dataSnapshot.getSkillXpLevel(CoreSkills.FISHING));
statement.setInt(13, dataSnapshot.getSkillXpLevel(CoreSkills.ALCHEMY_CS)); statement.setInt(13, dataSnapshot.getSkillXpLevel(CoreSkills.ALCHEMY));
statement.setInt(14, dataSnapshot.getSkillXpLevel(CoreSkills.TRIDENTS_CS)); statement.setInt(14, dataSnapshot.getSkillXpLevel(CoreSkills.TRIDENTS));
statement.setInt(15, dataSnapshot.getSkillXpLevel(CoreSkills.CROSSBOWS_CS)); statement.setInt(15, dataSnapshot.getSkillXpLevel(CoreSkills.CROSSBOWS));
statement.setInt(16, id); statement.setInt(16, id);
success &= (statement.executeUpdate() != 0); success &= (statement.executeUpdate() != 0);
statement.close(); statement.close();
@ -357,23 +356,23 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
+ ", view_unarmed = ?, view_herbalism = ?, view_excavation = ?" + ", view_unarmed = ?, view_herbalism = ?, view_excavation = ?"
+ ", view_archery = ?, view_swords = ?, view_axes = ?, view_acrobatics = ?" + ", view_archery = ?, view_swords = ?, view_axes = ?, view_acrobatics = ?"
+ ", view_fishing = ?, view_alchemy = ?, view_salvage = ?, view_smelting = ?, view_tridents = ?, view_crossbows = ? WHERE user_id = ?"); + ", view_fishing = ?, view_alchemy = ?, view_salvage = ?, view_smelting = ?, view_tridents = ?, view_crossbows = ? WHERE user_id = ?");
statement.setString(1, dataSnapshot.getBarStateMap().get(CoreSkills.TAMING_CS).toString()); statement.setString(1, dataSnapshot.getBarStateMap().get(CoreSkills.TAMING).toString());
statement.setString(2, dataSnapshot.getBarStateMap().get(CoreSkills.MINING_CS).toString()); statement.setString(2, dataSnapshot.getBarStateMap().get(CoreSkills.MINING).toString());
statement.setString(3, dataSnapshot.getBarStateMap().get(CoreSkills.REPAIR_CS).toString()); statement.setString(3, dataSnapshot.getBarStateMap().get(CoreSkills.REPAIR).toString());
statement.setString(4, dataSnapshot.getBarStateMap().get(CoreSkills.WOODCUTTING_CS).toString()); statement.setString(4, dataSnapshot.getBarStateMap().get(CoreSkills.WOODCUTTING).toString());
statement.setString(5, dataSnapshot.getBarStateMap().get(CoreSkills.UNARMED_CS).toString()); statement.setString(5, dataSnapshot.getBarStateMap().get(CoreSkills.UNARMED).toString());
statement.setString(6, dataSnapshot.getBarStateMap().get(CoreSkills.HERBALISM_CS).toString()); statement.setString(6, dataSnapshot.getBarStateMap().get(CoreSkills.HERBALISM).toString());
statement.setString(7, dataSnapshot.getBarStateMap().get(CoreSkills.EXCAVATION_CS).toString()); statement.setString(7, dataSnapshot.getBarStateMap().get(CoreSkills.EXCAVATION).toString());
statement.setString(8, dataSnapshot.getBarStateMap().get(CoreSkills.ARCHERY_CS).toString()); statement.setString(8, dataSnapshot.getBarStateMap().get(CoreSkills.ARCHERY).toString());
statement.setString(9, dataSnapshot.getBarStateMap().get(CoreSkills.SWORDS_CS).toString()); statement.setString(9, dataSnapshot.getBarStateMap().get(CoreSkills.SWORDS).toString());
statement.setString(10, dataSnapshot.getBarStateMap().get(CoreSkills.AXES_CS).toString()); statement.setString(10, dataSnapshot.getBarStateMap().get(CoreSkills.AXES).toString());
statement.setString(11, dataSnapshot.getBarStateMap().get(CoreSkills.ACROBATICS_CS).toString()); statement.setString(11, dataSnapshot.getBarStateMap().get(CoreSkills.ACROBATICS).toString());
statement.setString(12, dataSnapshot.getBarStateMap().get(CoreSkills.FISHING_CS).toString()); statement.setString(12, dataSnapshot.getBarStateMap().get(CoreSkills.FISHING).toString());
statement.setString(13, dataSnapshot.getBarStateMap().get(CoreSkills.ALCHEMY_CS).toString()); statement.setString(13, dataSnapshot.getBarStateMap().get(CoreSkills.ALCHEMY).toString());
statement.setString(14, dataSnapshot.getBarStateMap().get(CoreSkills.SALVAGE_CS).toString()); statement.setString(14, dataSnapshot.getBarStateMap().get(CoreSkills.SALVAGE).toString());
statement.setString(15, dataSnapshot.getBarStateMap().get(CoreSkills.SMELTING_CS).toString()); statement.setString(15, dataSnapshot.getBarStateMap().get(CoreSkills.SMELTING).toString());
statement.setString(16, dataSnapshot.getBarStateMap().get(CoreSkills.TRIDENTS_CS).toString()); statement.setString(16, dataSnapshot.getBarStateMap().get(CoreSkills.TRIDENTS).toString());
statement.setString(17, dataSnapshot.getBarStateMap().get(CoreSkills.CROSSBOWS_CS).toString()); statement.setString(17, dataSnapshot.getBarStateMap().get(CoreSkills.CROSSBOWS).toString());
statement.setInt(18, id); statement.setInt(18, id);
success &= (statement.executeUpdate() != 0); success &= (statement.executeUpdate() != 0);
statement.close(); statement.close();
@ -1209,37 +1208,37 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
final int OFFSET_XPBAR = OFFSET_OTHER + otherCount; final int OFFSET_XPBAR = OFFSET_OTHER + otherCount;
final int OFFSET_TOGGLE = OFFSET_XPBAR + allSkills; final int OFFSET_TOGGLE = OFFSET_XPBAR + allSkills;
skills.put(CoreSkills.TAMING_CS, result.getInt(OFFSET_SKILLS + 1)); skills.put(CoreSkills.TAMING, result.getInt(OFFSET_SKILLS + 1));
skills.put(CoreSkills.MINING_CS, result.getInt(OFFSET_SKILLS + 2)); skills.put(CoreSkills.MINING, result.getInt(OFFSET_SKILLS + 2));
skills.put(CoreSkills.REPAIR_CS, result.getInt(OFFSET_SKILLS + 3)); skills.put(CoreSkills.REPAIR, result.getInt(OFFSET_SKILLS + 3));
skills.put(CoreSkills.WOODCUTTING_CS, result.getInt(OFFSET_SKILLS + 4)); skills.put(CoreSkills.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
skills.put(CoreSkills.UNARMED_CS, result.getInt(OFFSET_SKILLS + 5)); skills.put(CoreSkills.UNARMED, result.getInt(OFFSET_SKILLS + 5));
skills.put(CoreSkills.HERBALISM_CS, result.getInt(OFFSET_SKILLS + 6)); skills.put(CoreSkills.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
skills.put(CoreSkills.EXCAVATION_CS, result.getInt(OFFSET_SKILLS + 7)); skills.put(CoreSkills.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
skills.put(CoreSkills.ARCHERY_CS, result.getInt(OFFSET_SKILLS + 8)); skills.put(CoreSkills.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
skills.put(CoreSkills.SWORDS_CS, result.getInt(OFFSET_SKILLS + 9)); skills.put(CoreSkills.SWORDS, result.getInt(OFFSET_SKILLS + 9));
skills.put(CoreSkills.AXES_CS, result.getInt(OFFSET_SKILLS + 10)); skills.put(CoreSkills.AXES, result.getInt(OFFSET_SKILLS + 10));
skills.put(CoreSkills.ACROBATICS_CS, result.getInt(OFFSET_SKILLS + 11)); skills.put(CoreSkills.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
skills.put(CoreSkills.FISHING_CS, result.getInt(OFFSET_SKILLS + 12)); skills.put(CoreSkills.FISHING, result.getInt(OFFSET_SKILLS + 12));
skills.put(CoreSkills.ALCHEMY_CS, result.getInt(OFFSET_SKILLS + 13)); skills.put(CoreSkills.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
skills.put(CoreSkills.TRIDENTS_CS, result.getInt(OFFSET_SKILLS + 14)); skills.put(CoreSkills.TRIDENTS, result.getInt(OFFSET_SKILLS + 14));
skills.put(CoreSkills.CROSSBOWS_CS, result.getInt(OFFSET_SKILLS + 15)); skills.put(CoreSkills.CROSSBOWS, result.getInt(OFFSET_SKILLS + 15));
skillsXp.put(CoreSkills.TAMING_CS, result.getFloat(OFFSET_EXPERIENCE + 1)); skillsXp.put(CoreSkills.TAMING, result.getFloat(OFFSET_EXPERIENCE + 1));
skillsXp.put(CoreSkills.MINING_CS, result.getFloat(OFFSET_EXPERIENCE + 2)); skillsXp.put(CoreSkills.MINING, result.getFloat(OFFSET_EXPERIENCE + 2));
skillsXp.put(CoreSkills.REPAIR_CS, result.getFloat(OFFSET_EXPERIENCE + 3)); skillsXp.put(CoreSkills.REPAIR, result.getFloat(OFFSET_EXPERIENCE + 3));
skillsXp.put(CoreSkills.WOODCUTTING_CS, result.getFloat(OFFSET_EXPERIENCE + 4)); skillsXp.put(CoreSkills.WOODCUTTING, result.getFloat(OFFSET_EXPERIENCE + 4));
skillsXp.put(CoreSkills.UNARMED_CS, result.getFloat(OFFSET_EXPERIENCE + 5)); skillsXp.put(CoreSkills.UNARMED, result.getFloat(OFFSET_EXPERIENCE + 5));
skillsXp.put(CoreSkills.HERBALISM_CS, result.getFloat(OFFSET_EXPERIENCE + 6)); skillsXp.put(CoreSkills.HERBALISM, result.getFloat(OFFSET_EXPERIENCE + 6));
skillsXp.put(CoreSkills.EXCAVATION_CS, result.getFloat(OFFSET_EXPERIENCE + 7)); skillsXp.put(CoreSkills.EXCAVATION, result.getFloat(OFFSET_EXPERIENCE + 7));
skillsXp.put(CoreSkills.ARCHERY_CS, result.getFloat(OFFSET_EXPERIENCE + 8)); skillsXp.put(CoreSkills.ARCHERY, result.getFloat(OFFSET_EXPERIENCE + 8));
skillsXp.put(CoreSkills.SWORDS_CS, result.getFloat(OFFSET_EXPERIENCE + 9)); skillsXp.put(CoreSkills.SWORDS, result.getFloat(OFFSET_EXPERIENCE + 9));
skillsXp.put(CoreSkills.AXES_CS, result.getFloat(OFFSET_EXPERIENCE + 10)); skillsXp.put(CoreSkills.AXES, result.getFloat(OFFSET_EXPERIENCE + 10));
skillsXp.put(CoreSkills.ACROBATICS_CS, result.getFloat(OFFSET_EXPERIENCE + 11)); skillsXp.put(CoreSkills.ACROBATICS, result.getFloat(OFFSET_EXPERIENCE + 11));
skillsXp.put(CoreSkills.FISHING_CS, result.getFloat(OFFSET_EXPERIENCE + 12)); skillsXp.put(CoreSkills.FISHING, result.getFloat(OFFSET_EXPERIENCE + 12));
skillsXp.put(CoreSkills.ALCHEMY_CS, result.getFloat(OFFSET_EXPERIENCE + 13)); skillsXp.put(CoreSkills.ALCHEMY, result.getFloat(OFFSET_EXPERIENCE + 13));
skillsXp.put(CoreSkills.TRIDENTS_CS, result.getFloat(OFFSET_EXPERIENCE + 14)); skillsXp.put(CoreSkills.TRIDENTS, result.getFloat(OFFSET_EXPERIENCE + 14));
skillsXp.put(CoreSkills.CROSSBOWS_CS, result.getFloat(OFFSET_EXPERIENCE + 15)); skillsXp.put(CoreSkills.CROSSBOWS, result.getFloat(OFFSET_EXPERIENCE + 15));
// Taming - Unused - result.getInt(OFFSET_COOLDOWNS + 1) // Taming - Unused - result.getInt(OFFSET_COOLDOWNS + 1)
skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_COOLDOWNS + 2)); skillsDATS.put(SuperAbilityType.SUPER_BREAKER, result.getInt(OFFSET_COOLDOWNS + 2));
@ -1282,23 +1281,23 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
} }
//XPBAR //XPBAR
xpBarStateMap.put(CoreSkills.TAMING_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 1))); xpBarStateMap.put(CoreSkills.TAMING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 1)));
xpBarStateMap.put(CoreSkills.MINING_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 2))); xpBarStateMap.put(CoreSkills.MINING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 2)));
xpBarStateMap.put(CoreSkills.REPAIR_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 3))); xpBarStateMap.put(CoreSkills.REPAIR, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 3)));
xpBarStateMap.put(CoreSkills.WOODCUTTING_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 4))); xpBarStateMap.put(CoreSkills.WOODCUTTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 4)));
xpBarStateMap.put(CoreSkills.UNARMED_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 5))); xpBarStateMap.put(CoreSkills.UNARMED, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 5)));
xpBarStateMap.put(CoreSkills.HERBALISM_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 6))); xpBarStateMap.put(CoreSkills.HERBALISM, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 6)));
xpBarStateMap.put(CoreSkills.EXCAVATION_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 7))); xpBarStateMap.put(CoreSkills.EXCAVATION, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 7)));
xpBarStateMap.put(CoreSkills.ARCHERY_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 8))); xpBarStateMap.put(CoreSkills.ARCHERY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 8)));
xpBarStateMap.put(CoreSkills.SWORDS_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 9))); xpBarStateMap.put(CoreSkills.SWORDS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 9)));
xpBarStateMap.put(CoreSkills.AXES_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 10))); xpBarStateMap.put(CoreSkills.AXES, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 10)));
xpBarStateMap.put(CoreSkills.ACROBATICS_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 11))); xpBarStateMap.put(CoreSkills.ACROBATICS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 11)));
xpBarStateMap.put(CoreSkills.FISHING_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 12))); xpBarStateMap.put(CoreSkills.FISHING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 12)));
xpBarStateMap.put(CoreSkills.ALCHEMY_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 13))); xpBarStateMap.put(CoreSkills.ALCHEMY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 13)));
xpBarStateMap.put(CoreSkills.SALVAGE_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 14))); xpBarStateMap.put(CoreSkills.SALVAGE, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 14)));
xpBarStateMap.put(CoreSkills.SMELTING_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 15))); xpBarStateMap.put(CoreSkills.SMELTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 15)));
xpBarStateMap.put(CoreSkills.TRIDENTS_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 16))); xpBarStateMap.put(CoreSkills.TRIDENTS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 16)));
xpBarStateMap.put(CoreSkills.CROSSBOWS_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 17))); xpBarStateMap.put(CoreSkills.CROSSBOWS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 17)));
//TOGGLE //TOGGLE
boolean chatSpy = result.getBoolean(OFFSET_TOGGLE+1); boolean chatSpy = result.getBoolean(OFFSET_TOGGLE+1);

View File

@ -301,7 +301,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
return; return;
} }
setUsingUnarmed(rootSkill == CoreSkills.UNARMED_CS); setUsingUnarmed(rootSkill == CoreSkills.UNARMED);
updateLevelStats(rootSkill, xpGainReason, xpGainSource); updateLevelStats(rootSkill, xpGainReason, xpGainSource);
} }

View File

@ -1,14 +1,9 @@
package com.gmail.nossr50.datatypes.skills; package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity; import com.neetgames.mcmmo.skill.SkillIdentity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -22,9 +17,9 @@ public class CoreSkills {
private static final @NotNull ImmutableSet<RootSkill> CORE_CHILD_SKILLS; private static final @NotNull ImmutableSet<RootSkill> CORE_CHILD_SKILLS;
private static final @NotNull ImmutableSet<RootSkill> CORE_NON_CHILD_SKILLS; private static final @NotNull ImmutableSet<RootSkill> CORE_NON_CHILD_SKILLS;
public static final @NotNull CoreRootSkill ACROBATICS_CS, ALCHEMY_CS, ARCHERY_CS, AXES_CS, EXCAVATION_CS, public static final @NotNull CoreRootSkill ACROBATICS, ALCHEMY, ARCHERY, AXES, EXCAVATION,
FISHING_CS, HERBALISM_CS, MINING_CS, REPAIR_CS, SALVAGE_CS, SMELTING_CS, SWORDS_CS, TAMING_CS, UNARMED_CS, FISHING, HERBALISM, MINING, REPAIR, SALVAGE, SMELTING, SWORDS, TAMING, UNARMED,
WOODCUTTING_CS, TRIDENTS_CS, CROSSBOWS_CS; WOODCUTTING, TRIDENTS, CROSSBOWS;
public static final @NotNull SkillIdentity ACROBATICS_ID, ALCHEMY_ID, ARCHERY_ID, AXES_ID, EXCAVATION_ID, public static final @NotNull SkillIdentity ACROBATICS_ID, ALCHEMY_ID, ARCHERY_ID, AXES_ID, EXCAVATION_ID,
FISHING_ID, HERBALISM_ID, MINING_ID, REPAIR_ID, SALVAGE_ID, SMELTING_ID, SWORDS_ID, TAMING_ID, UNARMED_ID, FISHING_ID, HERBALISM_ID, MINING_ID, REPAIR_ID, SALVAGE_ID, SMELTING_ID, SWORDS_ID, TAMING_ID, UNARMED_ID,
@ -38,78 +33,78 @@ public class CoreSkills {
HashSet<CoreRootSkill> rootSkillSet = new HashSet<>(); HashSet<CoreRootSkill> rootSkillSet = new HashSet<>();
HashSet<CoreRootSkill> childSkillSet = new HashSet<>(); HashSet<CoreRootSkill> childSkillSet = new HashSet<>();
ACROBATICS_CS = new CoreRootSkill("acrobatics"); ACROBATICS = new CoreRootSkill("acrobatics");
ACROBATICS_ID = ACROBATICS_CS.getSkillIdentity(); ACROBATICS_ID = ACROBATICS.getSkillIdentity();
ALCHEMY_CS = new CoreRootSkill("alchemy"); ALCHEMY = new CoreRootSkill("alchemy");
ALCHEMY_ID = ALCHEMY_CS.getSkillIdentity(); ALCHEMY_ID = ALCHEMY.getSkillIdentity();
ARCHERY_CS = new CoreRootSkill("archery"); ARCHERY = new CoreRootSkill("archery");
ARCHERY_ID = ARCHERY_CS.getSkillIdentity(); ARCHERY_ID = ARCHERY.getSkillIdentity();
AXES_CS = new CoreRootSkill("axes"); AXES = new CoreRootSkill("axes");
AXES_ID = AXES_CS.getSkillIdentity(); AXES_ID = AXES.getSkillIdentity();
EXCAVATION_CS = new CoreRootSkill("excavation"); EXCAVATION = new CoreRootSkill("excavation");
EXCAVATION_ID = EXCAVATION_CS.getSkillIdentity(); EXCAVATION_ID = EXCAVATION.getSkillIdentity();
FISHING_CS = new CoreRootSkill("fishing"); FISHING = new CoreRootSkill("fishing");
FISHING_ID = FISHING_CS.getSkillIdentity(); FISHING_ID = FISHING.getSkillIdentity();
HERBALISM_CS = new CoreRootSkill("herbalism"); HERBALISM = new CoreRootSkill("herbalism");
HERBALISM_ID = HERBALISM_CS.getSkillIdentity(); HERBALISM_ID = HERBALISM.getSkillIdentity();
MINING_CS = new CoreRootSkill("mining"); MINING = new CoreRootSkill("mining");
MINING_ID = MINING_CS.getSkillIdentity(); MINING_ID = MINING.getSkillIdentity();
REPAIR_CS = new CoreRootSkill("repair"); REPAIR = new CoreRootSkill("repair");
REPAIR_ID = REPAIR_CS.getSkillIdentity(); REPAIR_ID = REPAIR.getSkillIdentity();
SALVAGE_CS = new CoreRootSkill("salvage"); SALVAGE = new CoreRootSkill("salvage");
SALVAGE_ID = SALVAGE_CS.getSkillIdentity(); SALVAGE_ID = SALVAGE.getSkillIdentity();
SMELTING_CS = new CoreRootSkill("smelting"); SMELTING = new CoreRootSkill("smelting");
SMELTING_ID = SMELTING_CS.getSkillIdentity(); SMELTING_ID = SMELTING.getSkillIdentity();
SWORDS_CS = new CoreRootSkill("swords"); SWORDS = new CoreRootSkill("swords");
SWORDS_ID = SWORDS_CS.getSkillIdentity(); SWORDS_ID = SWORDS.getSkillIdentity();
TAMING_CS = new CoreRootSkill("taming"); TAMING = new CoreRootSkill("taming");
TAMING_ID = TAMING_CS.getSkillIdentity(); TAMING_ID = TAMING.getSkillIdentity();
UNARMED_CS = new CoreRootSkill("unarmed"); UNARMED = new CoreRootSkill("unarmed");
UNARMED_ID = UNARMED_CS.getSkillIdentity(); UNARMED_ID = UNARMED.getSkillIdentity();
WOODCUTTING_CS = new CoreRootSkill("woodcutting"); WOODCUTTING = new CoreRootSkill("woodcutting");
WOODCUTTING_ID = WOODCUTTING_CS.getSkillIdentity(); WOODCUTTING_ID = WOODCUTTING.getSkillIdentity();
TRIDENTS_CS = new CoreRootSkill("tridents"); TRIDENTS = new CoreRootSkill("tridents");
TRIDENTS_ID = TRIDENTS_CS.getSkillIdentity(); TRIDENTS_ID = TRIDENTS.getSkillIdentity();
CROSSBOWS_CS = new CoreRootSkill("crossbows"); CROSSBOWS = new CoreRootSkill("crossbows");
CROSSBOWS_ID = CROSSBOWS_CS.getSkillIdentity(); CROSSBOWS_ID = CROSSBOWS.getSkillIdentity();
//Child skills (soon to be removed) //Child skills (soon to be removed)
childSkillSet.add(SMELTING_CS); childSkillSet.add(SMELTING);
childSkillSet.add(SALVAGE_CS); childSkillSet.add(SALVAGE);
rootSkillSet.add(ACROBATICS_CS); rootSkillSet.add(ACROBATICS);
rootSkillSet.add(ALCHEMY_CS); rootSkillSet.add(ALCHEMY);
rootSkillSet.add(ARCHERY_CS); rootSkillSet.add(ARCHERY);
rootSkillSet.add(AXES_CS); rootSkillSet.add(AXES);
rootSkillSet.add(EXCAVATION_CS); rootSkillSet.add(EXCAVATION);
rootSkillSet.add(FISHING_CS); rootSkillSet.add(FISHING);
rootSkillSet.add(HERBALISM_CS); rootSkillSet.add(HERBALISM);
rootSkillSet.add(MINING_CS); rootSkillSet.add(MINING);
rootSkillSet.add(REPAIR_CS); rootSkillSet.add(REPAIR);
rootSkillSet.add(SALVAGE_CS); rootSkillSet.add(SALVAGE);
rootSkillSet.add(SMELTING_CS); rootSkillSet.add(SMELTING);
rootSkillSet.add(SWORDS_CS); rootSkillSet.add(SWORDS);
rootSkillSet.add(TAMING_CS); rootSkillSet.add(TAMING);
rootSkillSet.add(UNARMED_CS); rootSkillSet.add(UNARMED);
rootSkillSet.add(WOODCUTTING_CS); rootSkillSet.add(WOODCUTTING);
rootSkillSet.add(TRIDENTS_CS); rootSkillSet.add(TRIDENTS);
rootSkillSet.add(CROSSBOWS_CS); rootSkillSet.add(CROSSBOWS);
CORE_ROOT_SKILLS = ImmutableSet.copyOf(rootSkillSet); CORE_ROOT_SKILLS = ImmutableSet.copyOf(rootSkillSet);
CORE_CHILD_SKILLS = ImmutableSet.copyOf(childSkillSet); CORE_CHILD_SKILLS = ImmutableSet.copyOf(childSkillSet);
@ -182,56 +177,56 @@ public class CoreSkills {
protected void initMappings() { protected void initMappings() {
//TODO: add tests //TODO: add tests
//Can't init these from the get go as PrimarySkillType does some stuff and it would be race condition hell //Can't init these from the get go as PrimarySkillType does some stuff and it would be race condition hell
primaryToRootMap.put(PrimarySkillType.ACROBATICS, ACROBATICS_CS); primaryToRootMap.put(PrimarySkillType.ACROBATICS, ACROBATICS);
rootToPrimaryMap.put(ACROBATICS_CS, PrimarySkillType.ACROBATICS); rootToPrimaryMap.put(ACROBATICS, PrimarySkillType.ACROBATICS);
primaryToRootMap.put(PrimarySkillType.ALCHEMY, ALCHEMY_CS); primaryToRootMap.put(PrimarySkillType.ALCHEMY, ALCHEMY);
rootToPrimaryMap.put(ALCHEMY_CS, PrimarySkillType.ALCHEMY); rootToPrimaryMap.put(ALCHEMY, PrimarySkillType.ALCHEMY);
primaryToRootMap.put(PrimarySkillType.ARCHERY, ARCHERY_CS); primaryToRootMap.put(PrimarySkillType.ARCHERY, ARCHERY);
rootToPrimaryMap.put(ARCHERY_CS, PrimarySkillType.ARCHERY); rootToPrimaryMap.put(ARCHERY, PrimarySkillType.ARCHERY);
primaryToRootMap.put(PrimarySkillType.AXES, AXES_CS); primaryToRootMap.put(PrimarySkillType.AXES, AXES);
rootToPrimaryMap.put(AXES_CS, PrimarySkillType.AXES); rootToPrimaryMap.put(AXES, PrimarySkillType.AXES);
primaryToRootMap.put(PrimarySkillType.EXCAVATION, EXCAVATION_CS); primaryToRootMap.put(PrimarySkillType.EXCAVATION, EXCAVATION);
rootToPrimaryMap.put(EXCAVATION_CS, PrimarySkillType.EXCAVATION); rootToPrimaryMap.put(EXCAVATION, PrimarySkillType.EXCAVATION);
primaryToRootMap.put(PrimarySkillType.FISHING, FISHING_CS); primaryToRootMap.put(PrimarySkillType.FISHING, FISHING);
rootToPrimaryMap.put(FISHING_CS, PrimarySkillType.FISHING); rootToPrimaryMap.put(FISHING, PrimarySkillType.FISHING);
primaryToRootMap.put(PrimarySkillType.HERBALISM, HERBALISM_CS); primaryToRootMap.put(PrimarySkillType.HERBALISM, HERBALISM);
rootToPrimaryMap.put(HERBALISM_CS, PrimarySkillType.HERBALISM); rootToPrimaryMap.put(HERBALISM, PrimarySkillType.HERBALISM);
primaryToRootMap.put(PrimarySkillType.MINING, MINING_CS); primaryToRootMap.put(PrimarySkillType.MINING, MINING);
rootToPrimaryMap.put(MINING_CS, PrimarySkillType.MINING); rootToPrimaryMap.put(MINING, PrimarySkillType.MINING);
primaryToRootMap.put(PrimarySkillType.REPAIR, REPAIR_CS); primaryToRootMap.put(PrimarySkillType.REPAIR, REPAIR);
rootToPrimaryMap.put(REPAIR_CS, PrimarySkillType.REPAIR); rootToPrimaryMap.put(REPAIR, PrimarySkillType.REPAIR);
primaryToRootMap.put(PrimarySkillType.SALVAGE, SALVAGE_CS); primaryToRootMap.put(PrimarySkillType.SALVAGE, SALVAGE);
rootToPrimaryMap.put(SALVAGE_CS, PrimarySkillType.SALVAGE); rootToPrimaryMap.put(SALVAGE, PrimarySkillType.SALVAGE);
primaryToRootMap.put(PrimarySkillType.SMELTING, SMELTING_CS); primaryToRootMap.put(PrimarySkillType.SMELTING, SMELTING);
rootToPrimaryMap.put(SMELTING_CS, PrimarySkillType.SMELTING); rootToPrimaryMap.put(SMELTING, PrimarySkillType.SMELTING);
primaryToRootMap.put(PrimarySkillType.SWORDS, SWORDS_CS); primaryToRootMap.put(PrimarySkillType.SWORDS, SWORDS);
rootToPrimaryMap.put(SWORDS_CS, PrimarySkillType.SWORDS); rootToPrimaryMap.put(SWORDS, PrimarySkillType.SWORDS);
primaryToRootMap.put(PrimarySkillType.TAMING, TAMING_CS); primaryToRootMap.put(PrimarySkillType.TAMING, TAMING);
rootToPrimaryMap.put(TAMING_CS, PrimarySkillType.TAMING); rootToPrimaryMap.put(TAMING, PrimarySkillType.TAMING);
primaryToRootMap.put(PrimarySkillType.UNARMED, UNARMED_CS); primaryToRootMap.put(PrimarySkillType.UNARMED, UNARMED);
rootToPrimaryMap.put(UNARMED_CS, PrimarySkillType.UNARMED); rootToPrimaryMap.put(UNARMED, PrimarySkillType.UNARMED);
primaryToRootMap.put(PrimarySkillType.WOODCUTTING, WOODCUTTING_CS); primaryToRootMap.put(PrimarySkillType.WOODCUTTING, WOODCUTTING);
rootToPrimaryMap.put(WOODCUTTING_CS, PrimarySkillType.WOODCUTTING); rootToPrimaryMap.put(WOODCUTTING, PrimarySkillType.WOODCUTTING);
primaryToRootMap.put(PrimarySkillType.TRIDENTS, TRIDENTS_CS); primaryToRootMap.put(PrimarySkillType.TRIDENTS, TRIDENTS);
rootToPrimaryMap.put(TRIDENTS_CS, PrimarySkillType.TRIDENTS); rootToPrimaryMap.put(TRIDENTS, PrimarySkillType.TRIDENTS);
primaryToRootMap.put(PrimarySkillType.CROSSBOWS, CROSSBOWS_CS); primaryToRootMap.put(PrimarySkillType.CROSSBOWS, CROSSBOWS);
rootToPrimaryMap.put(CROSSBOWS_CS, PrimarySkillType.CROSSBOWS); rootToPrimaryMap.put(CROSSBOWS, PrimarySkillType.CROSSBOWS);
init = true; init = true;
} }

View File

@ -60,6 +60,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -642,7 +643,7 @@ public class mcMMO extends JavaPlugin {
} }
} }
public InputStreamReader getResourceAsReader(String fileName) { public @Nullable InputStreamReader getResourceAsReader(String fileName) {
InputStream in = getResource(fileName); InputStream in = getResource(fileName);
return in == null ? null : new InputStreamReader(in, Charsets.UTF_8); return in == null ? null : new InputStreamReader(in, Charsets.UTF_8);
} }
@ -657,19 +658,19 @@ public class mcMMO extends JavaPlugin {
return isRetroModeEnabled; return isRetroModeEnabled;
} }
public static WorldBlacklist getWorldBlacklist() { public static @NotNull WorldBlacklist getWorldBlacklist() {
return worldBlacklist; return worldBlacklist;
} }
public static PlatformManager getPlatformManager() { public static @NotNull PlatformManager getPlatformManager() {
return platformManager; return platformManager;
} }
public static SmeltingTracker getSmeltingTracker() { public static @NotNull SmeltingTracker getSmeltingTracker() {
return smeltingTracker; return smeltingTracker;
} }
public static SpawnedProjectileTracker getSpawnedProjectileTracker() { public static @NotNull SpawnedProjectileTracker getSpawnedProjectileTracker() {
return spawnedProjectileTracker; return spawnedProjectileTracker;
} }
@ -677,11 +678,11 @@ public class mcMMO extends JavaPlugin {
return userManager; return userManager;
} }
public static PartyManager getPartyManager() { public static @NotNull PartyManager getPartyManager() {
return partyManager; return partyManager;
} }
public static BukkitAudiences getAudiences() { public static @NotNull BukkitAudiences getAudiences() {
return audiences; return audiences;
} }
@ -689,17 +690,17 @@ public class mcMMO extends JavaPlugin {
return projectKorraEnabled; return projectKorraEnabled;
} }
public static TransientMetadataTools getTransientMetadataTools() { public static @NotNull TransientMetadataTools getTransientMetadataTools() {
return transientMetadataTools; return transientMetadataTools;
} }
public ChatManager getChatManager() { public @NotNull ChatManager getChatManager() {
return chatManager; return chatManager;
} }
public CommandManager getCommandManager() { public @NotNull CommandManager getCommandManager() {
return commandManager; return commandManager;
} }
public SkillRegister getSkillRegister() { return skillRegister; } public @NotNull SkillRegister getSkillRegister() { return skillRegister; }
} }

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.exceptions.UnknownSkillException; import com.neetgames.mcmmo.exceptions.UnknownSkillException;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -25,16 +24,16 @@ public class FamilyTree {
smeltingParents = new HashSet<>(); smeltingParents = new HashSet<>();
salvageParents = new HashSet<>(); salvageParents = new HashSet<>();
smeltingParents.add(CoreSkills.MINING_CS); smeltingParents.add(CoreSkills.MINING);
smeltingParents.add(CoreSkills.REPAIR_CS); smeltingParents.add(CoreSkills.REPAIR);
salvageParents.add(CoreSkills.FISHING_CS); salvageParents.add(CoreSkills.FISHING);
salvageParents.add(CoreSkills.REPAIR_CS); salvageParents.add(CoreSkills.REPAIR);
} }
if(rootSkill.equals(CoreSkills.SALVAGE_CS)) { if(rootSkill.equals(CoreSkills.SALVAGE)) {
return salvageParents; return salvageParents;
} else if (rootSkill.equals(CoreSkills.SMELTING_CS)) { } else if (rootSkill.equals(CoreSkills.SMELTING)) {
return smeltingParents; return smeltingParents;
} else { } else {
mcMMO.p.getLogger().severe("root skill argument is not a child skill! " + rootSkill.toString()); mcMMO.p.getLogger().severe("root skill argument is not a child skill! " + rootSkill.toString());

View File

@ -27,7 +27,7 @@ public class RankUtils {
*/ */
public static void executeSkillUnlockNotifications(@NotNull Plugin plugin, @NotNull OnlineMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int newLevel) public static void executeSkillUnlockNotifications(@NotNull Plugin plugin, @NotNull OnlineMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int newLevel)
{ {
for(SubSkillType subSkillType : primarySkillType.getSkillAbilities()) for(SubSkillType subSkillType : mcMMO.p.getSkillRegister().getSkillAbilities())
{ {
int playerRankInSkill = getRank(mmoPlayer, subSkillType); int playerRankInSkill = getRank(mmoPlayer, subSkillType);

View File

@ -135,7 +135,7 @@ public final 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(@NotNull String skillName) { public static boolean isSkill(@NotNull String skillName) {
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? PrimarySkillType.getSkill(skillName) != null : isLocalizedSkill(skillName); return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? mcMMO.p.getSkillRegister().getSkill(skillName) != null : isLocalizedSkill(skillName);
} }
public static void sendSkillMessage(@NotNull Player player, @NotNull NotificationType notificationType, @NotNull String key) { public static void sendSkillMessage(@NotNull Player player, @NotNull NotificationType notificationType, @NotNull String key) {

View File

@ -4,6 +4,8 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.RankConfig; import com.gmail.nossr50.config.RankConfig;
import com.gmail.nossr50.datatypes.json.McMMOUrl; import com.gmail.nossr50.datatypes.json.McMMOUrl;
import com.gmail.nossr50.datatypes.json.McMMOWebLinks; import com.gmail.nossr50.datatypes.json.McMMOWebLinks;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.util.Misc;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
@ -13,6 +15,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.neetgames.mcmmo.skill.RootSkill;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity; import net.kyori.adventure.identity.Identity;
@ -485,6 +488,10 @@ public class TextComponentFactory {
componentBuilder.append(Component.newline()); componentBuilder.append(Component.newline());
} }
public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull RootSkill rootSkill) {
return getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.getSkill(rootSkill));
}
public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull PrimarySkillType parentSkill) { public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull PrimarySkillType parentSkill) {
for(SubSkillType subSkillType : SubSkillType.values()) for(SubSkillType subSkillType : SubSkillType.values())
{ {