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

View File

@ -150,7 +150,7 @@ public class McImportCommand implements CommandExecutor {
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()) {
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");
@ -211,19 +211,19 @@ public class McImportCommand implements CommandExecutor {
skillName = "Excavation";
}
if (!configSections.containsKey(skillName)) {
configSections.put(skillName, new ArrayList<>());
if (!configSections.containsKey(rootSkillName)) {
configSections.put(rootSkillName, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(skillName);
ArrayList<String> skillContents = configSections.get(rootSkillName);
skillContents.add(" " + materialName + "|0:");
skillContents.add(" " + " " + "XP_Gain: 99");
skillContents.add(" " + " " + "Double_Drops_Enabled: true");
if (skillName.equals("Mining")) {
if (rootSkillName.equals("Mining")) {
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
}
else if (skillName.equals("Woodcutting")) {
else if (rootSkillName.equals("Woodcutting")) {
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
}
}

View File

@ -22,7 +22,7 @@ public class DatabaseRemovePlayerCommand implements TabExecutor {
if (args.length == 1) {
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))) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return true;

View File

@ -21,15 +21,15 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
float xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.addLevels(skill, value);
float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
profile.addLevels(rootSkill, value);
if (player == null) {
profile.scheduleAsyncSave();
return;
}
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
EventUtils.tryLevelChangeEvent(player, rootSkill, value, xpRemoved, true, XPGainReason.COMMAND);
}
@Override
@ -45,6 +45,6 @@ public class AddlevelsCommand extends ExperienceCommand {
if(isSilent)
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)
return;
mcMMO.getUserManager().getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
mcMMO.getUserManager().getPlayer(player).applyXpGain(rootSkill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
}
else {
profile.addXp(skill, value);
profile.addXp(rootSkill, value);
profile.scheduleAsyncSave();
}
}
@ -46,6 +46,6 @@ public class AddxpCommand extends ExperienceCommand {
if(isSilent)
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.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.MMOPlayer;
@ -45,14 +46,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
skill = PrimarySkillType.getSkill(args[0]);
rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
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"));
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;
} else if((args.length == 3 && !isSilent(args))
|| (args.length == 4 && isSilent(args))) {
@ -79,13 +79,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
skill = PrimarySkillType.getSkill(args[1]);
rootSkill = mcMMO.p.getSkillRegister().getSkill(args[1]);
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"));
return true;
@ -94,7 +94,7 @@ public abstract class ExperienceCommand implements TabExecutor {
int value = Integer.parseInt(args[2]);
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 (mmoPlayer == null) {
@ -109,10 +109,10 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
editValues(null, profile, skill, value, isSilent(args));
editValues(null, profile, rootSkill, value, isSilent(args));
}
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);
@ -157,11 +157,11 @@ public abstract class ExperienceCommand implements TabExecutor {
}
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));
}
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
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
int skillLevel = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill);
int skillLevel = profile.getSkillLevel(rootSkill);
float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
profile.modifySkill(skill, value);
profile.modifySkill(rootSkill, value);
if (player == null) {
profile.scheduleAsyncSave();
@ -35,7 +35,7 @@ public class MmoeditCommand extends ExperienceCommand {
return;
}
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
EventUtils.tryLevelEditEvent(player, rootSkill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
}
@Override
@ -51,6 +51,6 @@ public class MmoeditCommand extends ExperienceCommand {
if(isSilent)
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")) {
skill = null;
rootSkill = null;
}
else {
skill = PrimarySkillType.getSkill(args[0]);
rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
}
editValues((Player) sender, mcMMO.getUserManager().queryPlayer(player)
@ -66,14 +66,14 @@ public class SkillresetCommand implements TabExecutor {
}
if (args[1].equalsIgnoreCase("all")) {
skill = null;
rootSkill = null;
}
else {
skill = PrimarySkillType.getSkill(args[1]);
rootSkill = mcMMO.p.getSkillRegister().getSkill(args[1]);
}
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 (mmoPlayer == null) {
@ -116,17 +116,17 @@ public class SkillresetCommand implements TabExecutor {
}
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill) {
int levelsRemoved = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill);
int levelsRemoved = profile.getSkillLevel(rootSkill);
float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
profile.modifySkill(skill, 0);
profile.modifySkill(rootSkill, 0);
if (player == null) {
profile.scheduleAsyncSave();
return;
}
EventUtils.tryLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false, XPGainReason.COMMAND);
EventUtils.tryLevelChangeEvent(player, rootSkill, levelsRemoved, xpRemoved, false, XPGainReason.COMMAND);
}
protected boolean permissionsCheckSelf(CommandSender sender) {
@ -142,7 +142,7 @@ public class SkillresetCommand implements TabExecutor {
}
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) {
@ -150,16 +150,16 @@ public class SkillresetCommand implements TabExecutor {
}
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));
}
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) {
if (skill == null) {
if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, primarySkillType);
}

View File

@ -20,7 +20,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
@Override
protected boolean checkEnabled(RootSkill rootSkill) {
if (skill == null) {
if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreStatLossEnabled()) {
return false;
@ -30,7 +30,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
return true;
}
return skill.getHardcoreStatLossEnabled();
return rootSkill.getHardcoreStatLossEnabled();
}
@Override
@ -50,15 +50,15 @@ public class HardcoreCommand extends HardcoreModeCommand {
}
private void toggle(boolean enable, RootSkill rootSkill) {
if (skill == null) {
if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreStatLossEnabled(enable);
}
}
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;
}
RootSkill rootSkill = PrimarySkillType.getSkill(args[0]);
RootSkill rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
if (!CommandUtils.isChildSkill(sender, skill)) {
return true;
@ -87,7 +87,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true;
}
enable(skill);
enable(rootSkill);
return true;
}
@ -97,7 +97,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true;
}
enable(skill);
enable(rootSkill);
return true;
}

View File

@ -20,7 +20,7 @@ public class VampirismCommand extends HardcoreModeCommand {
@Override
protected boolean checkEnabled(RootSkill rootSkill) {
if (skill == null) {
if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreVampirismEnabled()) {
return false;
@ -30,7 +30,7 @@ public class VampirismCommand extends HardcoreModeCommand {
return true;
}
return skill.getHardcoreVampirismEnabled();
return rootSkill.getHardcoreVampirismEnabled();
}
@Override
@ -50,15 +50,15 @@ public class VampirismCommand extends HardcoreModeCommand {
}
private void toggle(boolean enable, RootSkill rootSkill) {
if (skill == null) {
if (rootSkill == null) {
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreVampirismEnabled(enable);
}
}
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) {
if (args.length == 2) {
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayerName(targetName);
OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;

View File

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

View File

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

View File

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

View File

@ -32,23 +32,23 @@ public class XPBarCommand implements TabExecutor {
} else if(args.length < 2) {
String option = args[0];
if(option.equalsIgnoreCase(SkillBossBarSetting.RESET.toString())) {
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(SkillBossBarSetting.RESET, null);
if(option.equalsIgnoreCase(rootSkillBossBarSetting.RESET.toString())) {
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(rootSkillBossBarSetting.RESET, null);
return true;
} else if(option.equalsIgnoreCase(SkillBossBarSetting.DISABLE.toString())) {
} else if(option.equalsIgnoreCase(rootSkillBossBarSetting.DISABLE.toString())) {
mmoPlayer.getExperienceBarManager().disableAllBars();
return true;
} else {
return false;
}
//Per skill Settings path
//Per rootSkillSettings path
} else if (args.length == 2) {
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
String option = args[0].toLowerCase();
@ -93,13 +93,13 @@ public class XPBarCommand implements TabExecutor {
case 1:
List<String> options = new ArrayList<>();
for(SkillBossBarSetting settingTarget : SkillBossBarSetting.values()) {
for(rootSkillBossBarSetting settingTarget : SkillBossBarSetting.values()) {
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:
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()));
default:
return ImmutableList.of();

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
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 {
@Override

View File

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

View File

@ -29,7 +29,7 @@ public class AlchemyCommand extends SkillCommand {
private boolean canConcoctions;
public AlchemyCommand() {
super(PrimarySkillType.ALCHEMY);
super(CoreSkills.ALCHEMY);
}
protected String[] calculateAbilityDisplayValues(@NotNull Player player) {
@ -48,7 +48,7 @@ public class AlchemyCommand extends SkillCommand {
AlchemyManager alchemyManager = ((McMMOPlayer) (mmoPlayer)).getAlchemyManager();
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[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) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ALCHEMY);
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.ALCHEMY);
return textComponents;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,12 @@
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.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.text.TextComponentFactory;
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.Mystery"));
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]);
return true;
@ -72,14 +74,14 @@ public class MmoInfoCommand implements TabExecutor {
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
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();
}
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);
if(abstractSubSkill != null)
{
@ -88,12 +90,14 @@ public class MmoInfoCommand implements TabExecutor {
//TextComponentFactory.sendPlayerUrlHeader(player);
} else {
/*
* Skill is only in the old system
* rootSkillis only in the old system
*/
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
Player player = Misc.adaptPlayer(mmoPlayer);
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
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())

View File

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

View File

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

View File

@ -77,7 +77,7 @@ public abstract class SkillCommand implements TabExecutor {
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
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())
for (int i = 0; i < 2; i++) {
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) {
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) {
int maxLength = primarySkillType.getSuperAbilityType().getMaxLength();
int maxLength = CoreSkills.getSuperAbilityType().getMaxLength();
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
@ -217,7 +217,7 @@ public abstract class SkillCommand implements TabExecutor {
if(abilityLengthCap <= 0)
{
length = 2 + (int) (skillValue / abilityLengthVar);
length = 2 + (int) (rootSkillValue / abilityLengthVar);
}
else {
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
* @param mmoPlayer target player
* @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) {
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.Arrays;
//TODO: Switch to root skill based
//TODO: Switch to root rootSkillbased
public class SkillGuideCommand implements CommandExecutor {
private final String header;
private final RootSkill rootSkill;
@ -21,9 +21,9 @@ public class SkillGuideCommand implements CommandExecutor {
private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
public SkillGuideCommand(@NotNull RootSkill rootSkill) {
skill = CoreSkills.getSkill(rootSkill);
header = LocaleLoader.getString("Guides.Header", skill.getName());
guide = getGuide(skill);
rootSkill = CoreSkills.getSkill(rootSkill);
header = LocaleLoader.getString("Guides.Header", rootSkill.getName());
guide = getGuide(rootSkill);
}
@Override
@ -94,7 +94,7 @@ public class SkillGuideCommand implements CommandExecutor {
ArrayList<String> guide = new ArrayList<>();
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("!")) {
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,9 @@
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.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
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_NON_CHILD_SKILLS;
public static final @NotNull CoreRootSkill ACROBATICS_CS, ALCHEMY_CS, ARCHERY_CS, AXES_CS, EXCAVATION_CS,
FISHING_CS, HERBALISM_CS, MINING_CS, REPAIR_CS, SALVAGE_CS, SMELTING_CS, SWORDS_CS, TAMING_CS, UNARMED_CS,
WOODCUTTING_CS, TRIDENTS_CS, CROSSBOWS_CS;
public static final @NotNull CoreRootSkill ACROBATICS, ALCHEMY, ARCHERY, AXES, EXCAVATION,
FISHING, HERBALISM, MINING, REPAIR, SALVAGE, SMELTING, SWORDS, TAMING, UNARMED,
WOODCUTTING, TRIDENTS, CROSSBOWS;
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,
@ -38,78 +33,78 @@ public class CoreSkills {
HashSet<CoreRootSkill> rootSkillSet = new HashSet<>();
HashSet<CoreRootSkill> childSkillSet = new HashSet<>();
ACROBATICS_CS = new CoreRootSkill("acrobatics");
ACROBATICS_ID = ACROBATICS_CS.getSkillIdentity();
ACROBATICS = new CoreRootSkill("acrobatics");
ACROBATICS_ID = ACROBATICS.getSkillIdentity();
ALCHEMY_CS = new CoreRootSkill("alchemy");
ALCHEMY_ID = ALCHEMY_CS.getSkillIdentity();
ALCHEMY = new CoreRootSkill("alchemy");
ALCHEMY_ID = ALCHEMY.getSkillIdentity();
ARCHERY_CS = new CoreRootSkill("archery");
ARCHERY_ID = ARCHERY_CS.getSkillIdentity();
ARCHERY = new CoreRootSkill("archery");
ARCHERY_ID = ARCHERY.getSkillIdentity();
AXES_CS = new CoreRootSkill("axes");
AXES_ID = AXES_CS.getSkillIdentity();
AXES = new CoreRootSkill("axes");
AXES_ID = AXES.getSkillIdentity();
EXCAVATION_CS = new CoreRootSkill("excavation");
EXCAVATION_ID = EXCAVATION_CS.getSkillIdentity();
EXCAVATION = new CoreRootSkill("excavation");
EXCAVATION_ID = EXCAVATION.getSkillIdentity();
FISHING_CS = new CoreRootSkill("fishing");
FISHING_ID = FISHING_CS.getSkillIdentity();
FISHING = new CoreRootSkill("fishing");
FISHING_ID = FISHING.getSkillIdentity();
HERBALISM_CS = new CoreRootSkill("herbalism");
HERBALISM_ID = HERBALISM_CS.getSkillIdentity();
HERBALISM = new CoreRootSkill("herbalism");
HERBALISM_ID = HERBALISM.getSkillIdentity();
MINING_CS = new CoreRootSkill("mining");
MINING_ID = MINING_CS.getSkillIdentity();
MINING = new CoreRootSkill("mining");
MINING_ID = MINING.getSkillIdentity();
REPAIR_CS = new CoreRootSkill("repair");
REPAIR_ID = REPAIR_CS.getSkillIdentity();
REPAIR = new CoreRootSkill("repair");
REPAIR_ID = REPAIR.getSkillIdentity();
SALVAGE_CS = new CoreRootSkill("salvage");
SALVAGE_ID = SALVAGE_CS.getSkillIdentity();
SALVAGE = new CoreRootSkill("salvage");
SALVAGE_ID = SALVAGE.getSkillIdentity();
SMELTING_CS = new CoreRootSkill("smelting");
SMELTING_ID = SMELTING_CS.getSkillIdentity();
SMELTING = new CoreRootSkill("smelting");
SMELTING_ID = SMELTING.getSkillIdentity();
SWORDS_CS = new CoreRootSkill("swords");
SWORDS_ID = SWORDS_CS.getSkillIdentity();
SWORDS = new CoreRootSkill("swords");
SWORDS_ID = SWORDS.getSkillIdentity();
TAMING_CS = new CoreRootSkill("taming");
TAMING_ID = TAMING_CS.getSkillIdentity();
TAMING = new CoreRootSkill("taming");
TAMING_ID = TAMING.getSkillIdentity();
UNARMED_CS = new CoreRootSkill("unarmed");
UNARMED_ID = UNARMED_CS.getSkillIdentity();
UNARMED = new CoreRootSkill("unarmed");
UNARMED_ID = UNARMED.getSkillIdentity();
WOODCUTTING_CS = new CoreRootSkill("woodcutting");
WOODCUTTING_ID = WOODCUTTING_CS.getSkillIdentity();
WOODCUTTING = new CoreRootSkill("woodcutting");
WOODCUTTING_ID = WOODCUTTING.getSkillIdentity();
TRIDENTS_CS = new CoreRootSkill("tridents");
TRIDENTS_ID = TRIDENTS_CS.getSkillIdentity();
TRIDENTS = new CoreRootSkill("tridents");
TRIDENTS_ID = TRIDENTS.getSkillIdentity();
CROSSBOWS_CS = new CoreRootSkill("crossbows");
CROSSBOWS_ID = CROSSBOWS_CS.getSkillIdentity();
CROSSBOWS = new CoreRootSkill("crossbows");
CROSSBOWS_ID = CROSSBOWS.getSkillIdentity();
//Child skills (soon to be removed)
childSkillSet.add(SMELTING_CS);
childSkillSet.add(SALVAGE_CS);
childSkillSet.add(SMELTING);
childSkillSet.add(SALVAGE);
rootSkillSet.add(ACROBATICS_CS);
rootSkillSet.add(ALCHEMY_CS);
rootSkillSet.add(ARCHERY_CS);
rootSkillSet.add(AXES_CS);
rootSkillSet.add(EXCAVATION_CS);
rootSkillSet.add(FISHING_CS);
rootSkillSet.add(HERBALISM_CS);
rootSkillSet.add(MINING_CS);
rootSkillSet.add(REPAIR_CS);
rootSkillSet.add(SALVAGE_CS);
rootSkillSet.add(SMELTING_CS);
rootSkillSet.add(SWORDS_CS);
rootSkillSet.add(TAMING_CS);
rootSkillSet.add(UNARMED_CS);
rootSkillSet.add(WOODCUTTING_CS);
rootSkillSet.add(TRIDENTS_CS);
rootSkillSet.add(CROSSBOWS_CS);
rootSkillSet.add(ACROBATICS);
rootSkillSet.add(ALCHEMY);
rootSkillSet.add(ARCHERY);
rootSkillSet.add(AXES);
rootSkillSet.add(EXCAVATION);
rootSkillSet.add(FISHING);
rootSkillSet.add(HERBALISM);
rootSkillSet.add(MINING);
rootSkillSet.add(REPAIR);
rootSkillSet.add(SALVAGE);
rootSkillSet.add(SMELTING);
rootSkillSet.add(SWORDS);
rootSkillSet.add(TAMING);
rootSkillSet.add(UNARMED);
rootSkillSet.add(WOODCUTTING);
rootSkillSet.add(TRIDENTS);
rootSkillSet.add(CROSSBOWS);
CORE_ROOT_SKILLS = ImmutableSet.copyOf(rootSkillSet);
CORE_CHILD_SKILLS = ImmutableSet.copyOf(childSkillSet);
@ -182,56 +177,56 @@ public class CoreSkills {
protected void initMappings() {
//TODO: add tests
//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);
rootToPrimaryMap.put(ACROBATICS_CS, PrimarySkillType.ACROBATICS);
primaryToRootMap.put(PrimarySkillType.ACROBATICS, ACROBATICS);
rootToPrimaryMap.put(ACROBATICS, PrimarySkillType.ACROBATICS);
primaryToRootMap.put(PrimarySkillType.ALCHEMY, ALCHEMY_CS);
rootToPrimaryMap.put(ALCHEMY_CS, PrimarySkillType.ALCHEMY);
primaryToRootMap.put(PrimarySkillType.ALCHEMY, ALCHEMY);
rootToPrimaryMap.put(ALCHEMY, PrimarySkillType.ALCHEMY);
primaryToRootMap.put(PrimarySkillType.ARCHERY, ARCHERY_CS);
rootToPrimaryMap.put(ARCHERY_CS, PrimarySkillType.ARCHERY);
primaryToRootMap.put(PrimarySkillType.ARCHERY, ARCHERY);
rootToPrimaryMap.put(ARCHERY, PrimarySkillType.ARCHERY);
primaryToRootMap.put(PrimarySkillType.AXES, AXES_CS);
rootToPrimaryMap.put(AXES_CS, PrimarySkillType.AXES);
primaryToRootMap.put(PrimarySkillType.AXES, AXES);
rootToPrimaryMap.put(AXES, PrimarySkillType.AXES);
primaryToRootMap.put(PrimarySkillType.EXCAVATION, EXCAVATION_CS);
rootToPrimaryMap.put(EXCAVATION_CS, PrimarySkillType.EXCAVATION);
primaryToRootMap.put(PrimarySkillType.EXCAVATION, EXCAVATION);
rootToPrimaryMap.put(EXCAVATION, PrimarySkillType.EXCAVATION);
primaryToRootMap.put(PrimarySkillType.FISHING, FISHING_CS);
rootToPrimaryMap.put(FISHING_CS, PrimarySkillType.FISHING);
primaryToRootMap.put(PrimarySkillType.FISHING, FISHING);
rootToPrimaryMap.put(FISHING, PrimarySkillType.FISHING);
primaryToRootMap.put(PrimarySkillType.HERBALISM, HERBALISM_CS);
rootToPrimaryMap.put(HERBALISM_CS, PrimarySkillType.HERBALISM);
primaryToRootMap.put(PrimarySkillType.HERBALISM, HERBALISM);
rootToPrimaryMap.put(HERBALISM, PrimarySkillType.HERBALISM);
primaryToRootMap.put(PrimarySkillType.MINING, MINING_CS);
rootToPrimaryMap.put(MINING_CS, PrimarySkillType.MINING);
primaryToRootMap.put(PrimarySkillType.MINING, MINING);
rootToPrimaryMap.put(MINING, PrimarySkillType.MINING);
primaryToRootMap.put(PrimarySkillType.REPAIR, REPAIR_CS);
rootToPrimaryMap.put(REPAIR_CS, PrimarySkillType.REPAIR);
primaryToRootMap.put(PrimarySkillType.REPAIR, REPAIR);
rootToPrimaryMap.put(REPAIR, PrimarySkillType.REPAIR);
primaryToRootMap.put(PrimarySkillType.SALVAGE, SALVAGE_CS);
rootToPrimaryMap.put(SALVAGE_CS, PrimarySkillType.SALVAGE);
primaryToRootMap.put(PrimarySkillType.SALVAGE, SALVAGE);
rootToPrimaryMap.put(SALVAGE, PrimarySkillType.SALVAGE);
primaryToRootMap.put(PrimarySkillType.SMELTING, SMELTING_CS);
rootToPrimaryMap.put(SMELTING_CS, PrimarySkillType.SMELTING);
primaryToRootMap.put(PrimarySkillType.SMELTING, SMELTING);
rootToPrimaryMap.put(SMELTING, PrimarySkillType.SMELTING);
primaryToRootMap.put(PrimarySkillType.SWORDS, SWORDS_CS);
rootToPrimaryMap.put(SWORDS_CS, PrimarySkillType.SWORDS);
primaryToRootMap.put(PrimarySkillType.SWORDS, SWORDS);
rootToPrimaryMap.put(SWORDS, PrimarySkillType.SWORDS);
primaryToRootMap.put(PrimarySkillType.TAMING, TAMING_CS);
rootToPrimaryMap.put(TAMING_CS, PrimarySkillType.TAMING);
primaryToRootMap.put(PrimarySkillType.TAMING, TAMING);
rootToPrimaryMap.put(TAMING, PrimarySkillType.TAMING);
primaryToRootMap.put(PrimarySkillType.UNARMED, UNARMED_CS);
rootToPrimaryMap.put(UNARMED_CS, PrimarySkillType.UNARMED);
primaryToRootMap.put(PrimarySkillType.UNARMED, UNARMED);
rootToPrimaryMap.put(UNARMED, PrimarySkillType.UNARMED);
primaryToRootMap.put(PrimarySkillType.WOODCUTTING, WOODCUTTING_CS);
rootToPrimaryMap.put(WOODCUTTING_CS, PrimarySkillType.WOODCUTTING);
primaryToRootMap.put(PrimarySkillType.WOODCUTTING, WOODCUTTING);
rootToPrimaryMap.put(WOODCUTTING, PrimarySkillType.WOODCUTTING);
primaryToRootMap.put(PrimarySkillType.TRIDENTS, TRIDENTS_CS);
rootToPrimaryMap.put(TRIDENTS_CS, PrimarySkillType.TRIDENTS);
primaryToRootMap.put(PrimarySkillType.TRIDENTS, TRIDENTS);
rootToPrimaryMap.put(TRIDENTS, PrimarySkillType.TRIDENTS);
primaryToRootMap.put(PrimarySkillType.CROSSBOWS, CROSSBOWS_CS);
rootToPrimaryMap.put(CROSSBOWS_CS, PrimarySkillType.CROSSBOWS);
primaryToRootMap.put(PrimarySkillType.CROSSBOWS, CROSSBOWS);
rootToPrimaryMap.put(CROSSBOWS, PrimarySkillType.CROSSBOWS);
init = true;
}

View File

@ -60,6 +60,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
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);
return in == null ? null : new InputStreamReader(in, Charsets.UTF_8);
}
@ -657,19 +658,19 @@ public class mcMMO extends JavaPlugin {
return isRetroModeEnabled;
}
public static WorldBlacklist getWorldBlacklist() {
public static @NotNull WorldBlacklist getWorldBlacklist() {
return worldBlacklist;
}
public static PlatformManager getPlatformManager() {
public static @NotNull PlatformManager getPlatformManager() {
return platformManager;
}
public static SmeltingTracker getSmeltingTracker() {
public static @NotNull SmeltingTracker getSmeltingTracker() {
return smeltingTracker;
}
public static SpawnedProjectileTracker getSpawnedProjectileTracker() {
public static @NotNull SpawnedProjectileTracker getSpawnedProjectileTracker() {
return spawnedProjectileTracker;
}
@ -677,11 +678,11 @@ public class mcMMO extends JavaPlugin {
return userManager;
}
public static PartyManager getPartyManager() {
public static @NotNull PartyManager getPartyManager() {
return partyManager;
}
public static BukkitAudiences getAudiences() {
public static @NotNull BukkitAudiences getAudiences() {
return audiences;
}
@ -689,17 +690,17 @@ public class mcMMO extends JavaPlugin {
return projectKorraEnabled;
}
public static TransientMetadataTools getTransientMetadataTools() {
public static @NotNull TransientMetadataTools getTransientMetadataTools() {
return transientMetadataTools;
}
public ChatManager getChatManager() {
public @NotNull ChatManager getChatManager() {
return chatManager;
}
public CommandManager getCommandManager() {
public @NotNull CommandManager getCommandManager() {
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.neetgames.mcmmo.exceptions.UnknownSkillException;
import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -25,16 +24,16 @@ public class FamilyTree {
smeltingParents = new HashSet<>();
salvageParents = new HashSet<>();
smeltingParents.add(CoreSkills.MINING_CS);
smeltingParents.add(CoreSkills.REPAIR_CS);
smeltingParents.add(CoreSkills.MINING);
smeltingParents.add(CoreSkills.REPAIR);
salvageParents.add(CoreSkills.FISHING_CS);
salvageParents.add(CoreSkills.REPAIR_CS);
salvageParents.add(CoreSkills.FISHING);
salvageParents.add(CoreSkills.REPAIR);
}
if(rootSkill.equals(CoreSkills.SALVAGE_CS)) {
if(rootSkill.equals(CoreSkills.SALVAGE)) {
return salvageParents;
} else if (rootSkill.equals(CoreSkills.SMELTING_CS)) {
} else if (rootSkill.equals(CoreSkills.SMELTING)) {
return smeltingParents;
} else {
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)
{
for(SubSkillType subSkillType : primarySkillType.getSkillAbilities())
for(SubSkillType subSkillType : mcMMO.p.getSkillRegister().getSkillAbilities())
{
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
*/
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) {

View File

@ -4,6 +4,8 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.RankConfig;
import com.gmail.nossr50.datatypes.json.McMMOUrl;
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.gmail.nossr50.datatypes.skills.PrimarySkillType;
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.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils;
import com.neetgames.mcmmo.skill.RootSkill;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
@ -485,6 +488,10 @@ public class TextComponentFactory {
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) {
for(SubSkillType subSkillType : SubSkillType.values())
{