mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Gutting new skill system part 2
This commit is contained in:
parent
a6276bded8
commit
8e1b223288
@ -75,7 +75,7 @@ public class MctopCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void display(int page, @NotNull RootSkill rootSkill, @NotNull CommandSender sender, @NotNull Command command) {
|
private void display(int page, @NotNull RootSkill rootSkill, @NotNull CommandSender sender, @NotNull Command command) {
|
||||||
if (rootSkill != null && !Permissions.mctop(sender, CoreSkills.getSkill(rootSkill))) {
|
if (rootSkill != null && !Permissions.mctop(sender, PrimarySkillType.getSkill(rootSkill))) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
private boolean canRoll;
|
private boolean canRoll;
|
||||||
|
|
||||||
public AcrobaticsCommand() {
|
public AcrobaticsCommand() {
|
||||||
super(CoreSkills.ACROBATICS);
|
super(PrimarySkillType.ACROBATICS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -94,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, CoreSkills.ACROBATICS);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ACROBATICS);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
private boolean canConcoctions;
|
private boolean canConcoctions;
|
||||||
|
|
||||||
public AlchemyCommand() {
|
public AlchemyCommand() {
|
||||||
super(CoreSkills.ALCHEMY);
|
super(PrimarySkillType.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), CoreSkills.ALCHEMY);
|
boolean isLucky = Permissions.lucky(Misc.adaptPlayer(mmoPlayer), PrimarySkillType.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, CoreSkills.ALCHEMY);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ALCHEMY);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
private boolean canRetrieve;
|
private boolean canRetrieve;
|
||||||
|
|
||||||
public ArcheryCommand() {
|
public ArcheryCommand() {
|
||||||
super(CoreSkills.ARCHERY);
|
super(PrimarySkillType.ARCHERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -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, CoreSkills.ARCHERY);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ARCHERY);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
private boolean canGreaterImpact;
|
private boolean canGreaterImpact;
|
||||||
|
|
||||||
public AxesCommand() {
|
public AxesCommand() {
|
||||||
super(CoreSkills.AXES);
|
super(PrimarySkillType.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, CoreSkills.AXES);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.AXES);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CrossbowsCommand extends SkillCommand {
|
public class CrossbowsCommand extends SkillCommand {
|
||||||
public CrossbowsCommand() {
|
public CrossbowsCommand() {
|
||||||
super(CoreSkills.CROSSBOWS);
|
super(PrimarySkillType.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, CoreSkills.CROSSBOWS);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.CROSSBOWS);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
private boolean canTreasureHunt;
|
private boolean canTreasureHunt;
|
||||||
|
|
||||||
public ExcavationCommand() {
|
public ExcavationCommand() {
|
||||||
super(CoreSkills.EXCAVATION);
|
super(PrimarySkillType.EXCAVATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,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, CoreSkills.EXCAVATION);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.EXCAVATION);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
private String maMinWaitTime, maMaxWaitTime;
|
private String maMinWaitTime, maMaxWaitTime;
|
||||||
|
|
||||||
public FishingCommand() {
|
public FishingCommand() {
|
||||||
super(CoreSkills.FISHING);
|
super(PrimarySkillType.FISHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -79,7 +79,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// FISHING_SHAKE
|
// FISHING_SHAKE
|
||||||
if (canShake) {
|
if (canShake) {
|
||||||
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(mmoPlayer, CoreSkills.FISHING, fishingManager.getShakeChance());
|
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(mmoPlayer, PrimarySkillType.FISHING, fishingManager.getShakeChance());
|
||||||
shakeChance = shakeStrings[0];
|
shakeChance = shakeStrings[0];
|
||||||
shakeChanceLucky = shakeStrings[1];
|
shakeChanceLucky = shakeStrings[1];
|
||||||
}
|
}
|
||||||
@ -155,7 +155,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, CoreSkills.FISHING);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.FISHING);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
private boolean canShroomThumb;
|
private boolean canShroomThumb;
|
||||||
|
|
||||||
public HerbalismCommand() {
|
public HerbalismCommand() {
|
||||||
super(CoreSkills.HERBALISM);
|
super(PrimarySkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -156,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, CoreSkills.HERBALISM);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.HERBALISM);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
private boolean canDemoExpert;
|
private boolean canDemoExpert;
|
||||||
|
|
||||||
public MiningCommand() {
|
public MiningCommand() {
|
||||||
super(CoreSkills.MINING);
|
super(PrimarySkillType.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, CoreSkills.MINING);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.MINING);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -56,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 || CoreSkills.SUBSKILL_NAMES.contains(args[0]))
|
} else if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0]))
|
||||||
{
|
{
|
||||||
displayInfo(mmoPlayer, args[0]);
|
displayInfo(mmoPlayer, args[0]);
|
||||||
return true;
|
return true;
|
||||||
@ -74,7 +74,7 @@ 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], CoreSkills.SUBSKILL_NAMES, new ArrayList<>(CoreSkills.SUBSKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<>(PrimarySkillType.SUBSKILL_NAMES.size()));
|
||||||
}
|
}
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
private int stoneLevel;
|
private int stoneLevel;
|
||||||
|
|
||||||
public RepairCommand() {
|
public RepairCommand() {
|
||||||
super(CoreSkills.REPAIR);
|
super(PrimarySkillType.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, CoreSkills.REPAIR);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.REPAIR);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
private boolean canArcaneSalvage;
|
private boolean canArcaneSalvage;
|
||||||
|
|
||||||
public SalvageCommand() {
|
public SalvageCommand() {
|
||||||
super(CoreSkills.SALVAGE);
|
super(PrimarySkillType.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, CoreSkills.SALVAGE);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SALVAGE);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
private final CommandExecutor skillGuideCommand;
|
private final CommandExecutor skillGuideCommand;
|
||||||
|
|
||||||
public SkillCommand(@NotNull RootSkill rootSkill) {
|
public SkillCommand(@NotNull RootSkill rootSkill) {
|
||||||
this.rootSkill = CoreSkills.getSkill(primarySkillType);
|
this.rootSkill = PrimarySkillType.getSkill(primarySkillType);
|
||||||
this.primarySkillType = primarySkillType;
|
this.primarySkillType = primarySkillType;
|
||||||
skillName = rootSkill.getName();
|
skillName = rootSkill.getName();
|
||||||
skillGuideCommand = new SkillGuideCommand(rootSkill);
|
skillGuideCommand = new SkillGuideCommand(rootSkill);
|
||||||
@ -147,7 +147,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||||
|
|
||||||
if(!CoreSkills.isChildSkill(rootSkill))
|
if(!PrimarySkillType.isChildSkill(rootSkill))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* NON-CHILD SKILLS
|
* NON-CHILD SKILLS
|
||||||
@ -209,7 +209,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected @NotNull String[] calculateLengthDisplayValues(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
protected @NotNull String[] calculateLengthDisplayValues(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||||
int maxLength = CoreSkills.getSuperAbilityType().getMaxLength();
|
int maxLength = PrimarySkillType.getSuperAbilityType().getMaxLength();
|
||||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
||||||
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
private boolean canUnderstandTheArt;
|
private boolean canUnderstandTheArt;
|
||||||
|
|
||||||
public SmeltingCommand() {
|
public SmeltingCommand() {
|
||||||
super(CoreSkills.SMELTING);
|
super(PrimarySkillType.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, CoreSkills.SMELTING);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SMELTING);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
private boolean canBleed;
|
private boolean canBleed;
|
||||||
|
|
||||||
public SwordsCommand() {
|
public SwordsCommand() {
|
||||||
super(CoreSkills.SWORDS);
|
super(PrimarySkillType.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, CoreSkills.SWORDS);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SWORDS);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class TamingCommand extends SkillCommand {
|
|||||||
private boolean canHolyHound;
|
private boolean canHolyHound;
|
||||||
|
|
||||||
public TamingCommand() {
|
public TamingCommand() {
|
||||||
super(CoreSkills.TAMING);
|
super(PrimarySkillType.TAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class TridentsCommand extends SkillCommand {
|
public class TridentsCommand extends SkillCommand {
|
||||||
public TridentsCommand() {
|
public TridentsCommand() {
|
||||||
super(CoreSkills.TRIDENTS);
|
super(PrimarySkillType.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, CoreSkills.TRIDENTS);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.TRIDENTS);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
private boolean canIronGrip;
|
private boolean canIronGrip;
|
||||||
|
|
||||||
public UnarmedCommand() {
|
public UnarmedCommand() {
|
||||||
super(CoreSkills.UNARMED);
|
super(PrimarySkillType.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, CoreSkills.UNARMED);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.UNARMED);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
private boolean canNaturesBounty;
|
private boolean canNaturesBounty;
|
||||||
|
|
||||||
public WoodcuttingCommand() {
|
public WoodcuttingCommand() {
|
||||||
super(CoreSkills.WOODCUTTING);
|
super(PrimarySkillType.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, CoreSkills.WOODCUTTING);
|
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.WOODCUTTING);
|
||||||
|
|
||||||
return textComponents;
|
return textComponents;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,6 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
||||||
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
||||||
|
|
||||||
|
|
||||||
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
|
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
|
||||||
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
|
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.database.DatabaseType;
|
|||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
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.PrimarySkillType;
|
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;
|
||||||
@ -22,8 +21,6 @@ import com.neetgames.mcmmo.exceptions.ProfileRetrievalException;
|
|||||||
import com.neetgames.mcmmo.player.MMOPlayerData;
|
import com.neetgames.mcmmo.player.MMOPlayerData;
|
||||||
import com.neetgames.mcmmo.skill.RootSkill;
|
import com.neetgames.mcmmo.skill.RootSkill;
|
||||||
import com.neetgames.mcmmo.skill.SkillBossBarState;
|
import com.neetgames.mcmmo.skill.SkillBossBarState;
|
||||||
import com.neetgames.mcmmo.skill.SuperSkill;
|
|
||||||
import it.unimi.dsi.fastutil.Hash;
|
|
||||||
import org.apache.commons.lang.NullArgumentException;
|
import org.apache.commons.lang.NullArgumentException;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -35,6 +32,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
||||||
public static final String FLATFILE_SPLIT_CHARACTER_REGEX = ":";
|
public static final String FLATFILE_SPLIT_CHARACTER_REGEX = ":";
|
||||||
|
public static final String NULL_VALUE = NULL_VALUE;
|
||||||
private final HashMap<RootSkill, List<PlayerStat>> playerStatHash = new HashMap<>();
|
private final HashMap<RootSkill, List<PlayerStat>> playerStatHash = new HashMap<>();
|
||||||
private final List<PlayerStat> powerLevels = new ArrayList<>();
|
private final List<PlayerStat> powerLevels = new ArrayList<>();
|
||||||
private long lastUpdate = 0;
|
private long lastUpdate = 0;
|
||||||
@ -71,7 +69,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
Map<RootSkill, Integer> skills = getSkillMapFromLine(character);
|
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character);
|
||||||
|
|
||||||
boolean powerless = true;
|
boolean powerless = true;
|
||||||
for (int skill : skills.values()) {
|
for (int skill : skills.values()) {
|
||||||
@ -256,11 +254,6 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
return worked;
|
return worked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeCache(@NotNull UUID uuid) {
|
|
||||||
//Not used in FlatFile
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean saveUser(@NotNull MMODataSnapshot dataSnapshot) {
|
public boolean saveUser(@NotNull MMODataSnapshot dataSnapshot) {
|
||||||
String playerName = dataSnapshot.getPlayerName();
|
String playerName = dataSnapshot.getPlayerName();
|
||||||
UUID uuid = dataSnapshot.getPlayerUUID();
|
UUID uuid = dataSnapshot.getPlayerUUID();
|
||||||
@ -330,35 +323,35 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeUserToLine(@NotNull MMODataSnapshot mmoDataSnapshot, @NotNull String playerName, @NotNull UUID uuid, @NotNull StringBuilder writer) {
|
private void writeUserToLine(@NotNull MMODataSnapshot mmoDataSnapshot, @NotNull String playerName, @NotNull UUID uuid, @NotNull StringBuilder writer) {
|
||||||
ImmutableMap<RootSkill, Integer> primarySkillLevelMap = mmoDataSnapshot.getSkillLevelValues();
|
ImmutableMap<PrimarySkillType, Integer> primarySkillLevelMap = mmoDataSnapshot.getSkillLevelValues();
|
||||||
ImmutableMap<RootSkill, Float> primarySkillExperienceValueMap = mmoDataSnapshot.getSkillExperienceValues();
|
ImmutableMap<PrimarySkillType, Float> primarySkillExperienceValueMap = mmoDataSnapshot.getSkillExperienceValues();
|
||||||
|
|
||||||
writer.append(playerName).append(":");
|
writer.append(playerName).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.MINING_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.MINING)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.MINING_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.MINING)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.WOODCUTTING_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.WOODCUTTING)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.WOODCUTTING_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.WOODCUTTING)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.REPAIR_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.REPAIR)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.UNARMED_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.UNARMED)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.HERBALISM_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.HERBALISM)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.EXCAVATION_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.EXCAVATION)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.ARCHERY_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.ARCHERY)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.SWORDS_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.SWORDS)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.AXES_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.AXES)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.ACROBATICS_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.ACROBATICS)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.REPAIR_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.REPAIR)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.UNARMED_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.UNARMED)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.HERBALISM_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.HERBALISM)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.EXCAVATION_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.EXCAVATION)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.ARCHERY_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.ARCHERY)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.SWORDS_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.SWORDS)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.AXES_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.AXES)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.ACROBATICS_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.ACROBATICS)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.TAMING_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.TAMING)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.TAMING_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.TAMING)).append(":");
|
||||||
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.BERSERK)).append(":");
|
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.BERSERK)).append(":");
|
||||||
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER)).append(":");
|
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER)).append(":");
|
||||||
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.TREE_FELLER)).append(":");
|
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.TREE_FELLER)).append(":");
|
||||||
@ -367,17 +360,16 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.SKULL_SPLITTER)).append(":");
|
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.SKULL_SPLITTER)).append(":");
|
||||||
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.SUPER_BREAKER)).append(":");
|
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.SUPER_BREAKER)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.FISHING_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.FISHING)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.FISHING_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.FISHING)).append(":");
|
||||||
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.BLAST_MINING)).append(":");
|
writer.append((int) mmoDataSnapshot.getAbilityDATS(SuperAbilityType.BLAST_MINING)).append(":");
|
||||||
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
||||||
|
|
||||||
MobHealthBarType mobHealthbarType = mmoDataSnapshot.getMobHealthBarType();
|
writer.append(NULL_VALUE).append(":"); //Mob Health Bars are no longer based on player data
|
||||||
writer.append(mobHealthbarType.toString()).append(":");
|
|
||||||
|
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.ALCHEMY_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.ALCHEMY)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.ALCHEMY_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.ALCHEMY)).append(":");
|
||||||
writer.append(uuid != null ? uuid.toString() : "NULL").append(":");
|
writer.append(uuid != null ? uuid.toString() : NULL_VALUE).append(":");
|
||||||
writer.append(mmoDataSnapshot.getScoreboardTipsShown()).append(":");
|
writer.append(mmoDataSnapshot.getScoreboardTipsShown()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getUniqueData(UniqueDataType.CHIMAERA_WING_DATS)).append(":");
|
writer.append(mmoDataSnapshot.getUniqueData(UniqueDataType.CHIMAERA_WING_DATS)).append(":");
|
||||||
|
|
||||||
@ -405,29 +397,29 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
public static int BARSTATE_CROSSBOWS = 64;
|
public static int BARSTATE_CROSSBOWS = 64;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.TRIDENTS_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.TRIDENTS)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.TRIDENTS_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.TRIDENTS)).append(":");
|
||||||
writer.append(primarySkillLevelMap.get(CoreSkills.CROSSBOWS_CS)).append(":");
|
writer.append(primarySkillLevelMap.get(PrimarySkillType.CROSSBOWS)).append(":");
|
||||||
writer.append(primarySkillExperienceValueMap.get(CoreSkills.CROSSBOWS_CS)).append(":");
|
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.CROSSBOWS)).append(":");
|
||||||
|
|
||||||
//XPBar States
|
//XPBar States
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.ACROBATICS_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.ACROBATICS).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.ALCHEMY_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.ALCHEMY).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.ARCHERY_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.ARCHERY).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.AXES_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.AXES).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.EXCAVATION_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.EXCAVATION).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.FISHING_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.FISHING).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.HERBALISM_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.HERBALISM).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.MINING_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.MINING).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.REPAIR_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.REPAIR).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.SALVAGE_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SALVAGE).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.SMELTING_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SMELTING).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.SWORDS_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SWORDS).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.TAMING_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.TAMING).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.UNARMED_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.UNARMED).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.WOODCUTTING_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.WOODCUTTING).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.TRIDENTS_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.TRIDENTS).toString()).append(":");
|
||||||
writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.CROSSBOWS_CS).toString()).append(":");
|
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.CROSSBOWS).toString()).append(":");
|
||||||
|
|
||||||
writer.append(0).append(":"); //archery super 1 cd
|
writer.append(0).append(":"); //archery super 1 cd
|
||||||
writer.append(0).append(":"); //xbow super 1 cd
|
writer.append(0).append(":"); //xbow super 1 cd
|
||||||
@ -448,13 +440,13 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Map<RootSkill, Integer> readRank(@NotNull String playerName) {
|
public @NotNull Map<PrimarySkillType, Integer> readRank(@NotNull String playerName) {
|
||||||
updateLeaderboards();
|
updateLeaderboards();
|
||||||
|
|
||||||
Map<RootSkill, Integer> skills = new HashMap<>();
|
Map<PrimarySkillType, Integer> skills = new HashMap<>();
|
||||||
|
|
||||||
for (RootSkill rootSkill : CoreSkills.getImmutableCoreRootSkillSet()) {
|
for (RootSkill rootSkill : PrimarySkillType.getImmutableCoreRootSkillSet()) {
|
||||||
if(CoreSkills.isChildSkill(rootSkill))
|
if(PrimarySkillType.isChildSkill(rootSkill))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
skills.put(rootSkill, getPlayerRank(playerName, playerStatHash.get(rootSkill)));
|
skills.put(rootSkill, getPlayerRank(playerName, playerStatHash.get(rootSkill)));
|
||||||
@ -466,7 +458,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertNewUser(@NotNull String playerName, @NotNull UUID uuid) {
|
public void newUser(@NotNull String playerName, @NotNull UUID uuid) {
|
||||||
BufferedWriter out = null;
|
BufferedWriter out = null;
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -517,7 +509,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
out.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":"); // Mob Healthbar HUD
|
out.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":"); // Mob Healthbar HUD
|
||||||
out.append(startingLevel); // Alchemy
|
out.append(startingLevel); // Alchemy
|
||||||
out.append("0:"); // AlchemyXp
|
out.append("0:"); // AlchemyXp
|
||||||
out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID
|
out.append(uuid != null ? uuid.toString() : NULL_VALUE).append(":"); // UUID
|
||||||
out.append("0:"); // Scoreboard tips shown
|
out.append("0:"); // Scoreboard tips shown
|
||||||
out.append("0:"); // Chimaera Wing Dats
|
out.append("0:"); // Chimaera Wing Dats
|
||||||
|
|
||||||
@ -809,23 +801,23 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
playerName = data[FlatFileMappings.USERNAME];
|
playerName = data[FlatFileMappings.USERNAME];
|
||||||
int powerLevel = 0;
|
int powerLevel = 0;
|
||||||
|
|
||||||
Map<RootSkill, Integer> skills = getSkillMapFromLine(data);
|
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(data);
|
||||||
|
|
||||||
powerLevel += putStat(acrobatics, playerName, skills.get(CoreSkills.ACROBATICS_CS));
|
powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkillType.ACROBATICS));
|
||||||
powerLevel += putStat(alchemy, playerName, skills.get(CoreSkills.ALCHEMY_CS));
|
powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkillType.ALCHEMY));
|
||||||
powerLevel += putStat(archery, playerName, skills.get(CoreSkills.ARCHERY_CS));
|
powerLevel += putStat(archery, playerName, skills.get(PrimarySkillType.ARCHERY));
|
||||||
powerLevel += putStat(axes, playerName, skills.get(CoreSkills.AXES_CS));
|
powerLevel += putStat(axes, playerName, skills.get(PrimarySkillType.AXES));
|
||||||
powerLevel += putStat(excavation, playerName, skills.get(CoreSkills.EXCAVATION_CS));
|
powerLevel += putStat(excavation, playerName, skills.get(PrimarySkillType.EXCAVATION));
|
||||||
powerLevel += putStat(fishing, playerName, skills.get(CoreSkills.FISHING_CS));
|
powerLevel += putStat(fishing, playerName, skills.get(PrimarySkillType.FISHING));
|
||||||
powerLevel += putStat(herbalism, playerName, skills.get(CoreSkills.HERBALISM_CS));
|
powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkillType.HERBALISM));
|
||||||
powerLevel += putStat(mining, playerName, skills.get(CoreSkills.MINING_CS));
|
powerLevel += putStat(mining, playerName, skills.get(PrimarySkillType.MINING));
|
||||||
powerLevel += putStat(repair, playerName, skills.get(CoreSkills.REPAIR_CS));
|
powerLevel += putStat(repair, playerName, skills.get(PrimarySkillType.REPAIR));
|
||||||
powerLevel += putStat(swords, playerName, skills.get(CoreSkills.SWORDS_CS));
|
powerLevel += putStat(swords, playerName, skills.get(PrimarySkillType.SWORDS));
|
||||||
powerLevel += putStat(taming, playerName, skills.get(CoreSkills.TAMING_CS));
|
powerLevel += putStat(taming, playerName, skills.get(PrimarySkillType.TAMING));
|
||||||
powerLevel += putStat(unarmed, playerName, skills.get(CoreSkills.UNARMED_CS));
|
powerLevel += putStat(unarmed, playerName, skills.get(PrimarySkillType.UNARMED));
|
||||||
powerLevel += putStat(woodcutting, playerName, skills.get(CoreSkills.WOODCUTTING_CS));
|
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.WOODCUTTING));
|
||||||
powerLevel += putStat(woodcutting, playerName, skills.get(CoreSkills.CROSSBOWS_CS));
|
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.CROSSBOWS));
|
||||||
powerLevel += putStat(woodcutting, playerName, skills.get(CoreSkills.TRIDENTS_CS));
|
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.TRIDENTS));
|
||||||
|
|
||||||
putStat(powerLevels, playerName, powerLevel);
|
putStat(powerLevels, playerName, powerLevel);
|
||||||
}
|
}
|
||||||
@ -862,19 +854,19 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
alchemy.sort(c);
|
alchemy.sort(c);
|
||||||
powerLevels.sort(c);
|
powerLevels.sort(c);
|
||||||
|
|
||||||
playerStatHash.put(CoreSkills.MINING_CS, mining);
|
playerStatHash.put(PrimarySkillType.MINING, mining);
|
||||||
playerStatHash.put(CoreSkills.WOODCUTTING_CS, woodcutting);
|
playerStatHash.put(PrimarySkillType.WOODCUTTING, woodcutting);
|
||||||
playerStatHash.put(CoreSkills.REPAIR_CS, repair);
|
playerStatHash.put(PrimarySkillType.REPAIR, repair);
|
||||||
playerStatHash.put(CoreSkills.UNARMED_CS, unarmed);
|
playerStatHash.put(PrimarySkillType.UNARMED, unarmed);
|
||||||
playerStatHash.put(CoreSkills.HERBALISM_CS, herbalism);
|
playerStatHash.put(PrimarySkillType.HERBALISM, herbalism);
|
||||||
playerStatHash.put(CoreSkills.EXCAVATION_CS, excavation);
|
playerStatHash.put(PrimarySkillType.EXCAVATION, excavation);
|
||||||
playerStatHash.put(CoreSkills.ARCHERY_CS, archery);
|
playerStatHash.put(PrimarySkillType.ARCHERY, archery);
|
||||||
playerStatHash.put(CoreSkills.SWORDS_CS, swords);
|
playerStatHash.put(PrimarySkillType.SWORDS, swords);
|
||||||
playerStatHash.put(CoreSkills.AXES_CS, axes);
|
playerStatHash.put(PrimarySkillType.AXES, axes);
|
||||||
playerStatHash.put(CoreSkills.ACROBATICS_CS, acrobatics);
|
playerStatHash.put(PrimarySkillType.ACROBATICS, acrobatics);
|
||||||
playerStatHash.put(CoreSkills.TAMING_CS, taming);
|
playerStatHash.put(PrimarySkillType.TAMING, taming);
|
||||||
playerStatHash.put(CoreSkills.FISHING_CS, fishing);
|
playerStatHash.put(PrimarySkillType.FISHING, fishing);
|
||||||
playerStatHash.put(CoreSkills.ALCHEMY_CS, alchemy);
|
playerStatHash.put(PrimarySkillType.ALCHEMY, alchemy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -912,7 +904,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
if (!usernames.add(stringDataArray[FlatFileMappings.USERNAME])) {
|
if (!usernames.add(stringDataArray[FlatFileMappings.USERNAME])) {
|
||||||
stringDataArray[FlatFileMappings.USERNAME] = "_INVALID_OLD_USERNAME_'";
|
stringDataArray[FlatFileMappings.USERNAME] = "_INVALID_OLD_USERNAME_'";
|
||||||
updated = true;
|
updated = true;
|
||||||
if (stringDataArray.length < FlatFileMappings.UUID_INDEX + 1 || stringDataArray[FlatFileMappings.UUID_INDEX].equals("NULL")) {
|
if (stringDataArray.length < FlatFileMappings.UUID_INDEX + 1 || stringDataArray[FlatFileMappings.UUID_INDEX].equals(NULL_VALUE)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1007,7 +999,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
// Version 1.5.01
|
// Version 1.5.01
|
||||||
// Add a value because otherwise it gets removed
|
// Add a value because otherwise it gets removed
|
||||||
stringDataArray = Arrays.copyOf(stringDataArray, stringDataArray.length + 1);
|
stringDataArray = Arrays.copyOf(stringDataArray, stringDataArray.length + 1);
|
||||||
stringDataArray[stringDataArray.length - 1] = "NULL";
|
stringDataArray[stringDataArray.length - 1] = NULL_VALUE;
|
||||||
if (oldVersion == null) {
|
if (oldVersion == null) {
|
||||||
oldVersion = "1.5.01";
|
oldVersion = "1.5.01";
|
||||||
}
|
}
|
||||||
@ -1107,8 +1099,8 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
|
|
||||||
//TODO: If new skills are added this needs to be rewritten
|
//TODO: If new skills are added this needs to be rewritten
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (Config.getInstance().getTruncateSkills()) {
|
||||||
for (RootSkill rootSkill : CoreSkills.getImmutableCoreRootSkillSet()) {
|
for (RootSkill rootSkill : PrimarySkillType.getImmutableCoreRootSkillSet()) {
|
||||||
if(CoreSkills.isChildSkill(rootSkill))
|
if(PrimarySkillType.isChildSkill(rootSkill))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int index = getSkillIndex(rootSkill);
|
int index = getSkillIndex(rootSkill);
|
||||||
@ -1175,8 +1167,8 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
updated |= oldVersion != null;
|
updated |= oldVersion != null;
|
||||||
|
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (Config.getInstance().getTruncateSkills()) {
|
||||||
Map<RootSkill, Integer> skillsMap = getSkillMapFromLine(stringDataArray);
|
Map<PrimarySkillType, Integer> skillsMap = getSkillMapFromLine(stringDataArray);
|
||||||
for (RootSkill rootSkill : CoreSkills.getNonChildSkills()) {
|
for (RootSkill rootSkill : PrimarySkillType.getNonChildSkills()) {
|
||||||
int cap = Config.getInstance().getLevelCap(rootSkill);
|
int cap = Config.getInstance().getLevelCap(rootSkill);
|
||||||
if (skillsMap.get(rootSkill) > cap) {
|
if (skillsMap.get(rootSkill) > cap) {
|
||||||
updated = true;
|
updated = true;
|
||||||
@ -1191,7 +1183,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
// Prevent the same player from being present multiple times
|
// Prevent the same player from being present multiple times
|
||||||
if (stringDataArray.length == originalLength //If the length changed then the schema was expanded
|
if (stringDataArray.length == originalLength //If the length changed then the schema was expanded
|
||||||
&& (!stringDataArray[FlatFileMappings.UUID_INDEX].isEmpty()
|
&& (!stringDataArray[FlatFileMappings.UUID_INDEX].isEmpty()
|
||||||
&& !stringDataArray[FlatFileMappings.UUID_INDEX].equals("NULL")
|
&& !stringDataArray[FlatFileMappings.UUID_INDEX].equals(NULL_VALUE)
|
||||||
&& !players.add(stringDataArray[FlatFileMappings.UUID_INDEX]))) {
|
&& !players.add(stringDataArray[FlatFileMappings.UUID_INDEX]))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1279,29 +1271,31 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
|
|
||||||
private @Nullable MMOPlayerData loadFromLine(@NotNull String[] dataStrSplit) {
|
private @Nullable MMOPlayerData loadFromLine(@NotNull String[] dataStrSplit) {
|
||||||
MMODataBuilder playerDataBuilder = new MMODataBuilder();
|
MMODataBuilder playerDataBuilder = new MMODataBuilder();
|
||||||
|
String username = dataStrSplit[FlatFileMappings.USERNAME];
|
||||||
|
|
||||||
Map<RootSkill, Integer> skillLevelMap = getSkillMapFromLine(dataStrSplit); // Skill levels
|
Map<PrimarySkillType, Integer> skillLevelMap = getSkillMapFromLine(dataStrSplit); // Skill levels
|
||||||
Map<RootSkill, Float> skillExperienceValueMap = new HashMap<>(); // Skill & XP
|
Map<PrimarySkillType, Float> skillExperienceValueMap = new HashMap<>(); // Skill & XP
|
||||||
Map<SuperSkill, Integer> skillAbilityDeactivationTimeStamp = new HashMap<>(); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillAbilityDeactivationTimeStamp = new HashMap<>(); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class);
|
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class);
|
||||||
Map<RootSkill, SkillBossBarState> xpBarStateMap = new HashMap<>();
|
Map<PrimarySkillType, SkillBossBarState> xpBarStateMap = new HashMap<>();
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
|
|
||||||
skillExperienceValueMap.put(CoreSkills.TAMING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_TAMING]));
|
//XP Values
|
||||||
skillExperienceValueMap.put(CoreSkills.MINING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_MINING]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.TAMING, FlatFileMappings.EXP_TAMING, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.REPAIR_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_REPAIR]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.MINING, FlatFileMappings.EXP_MINING, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.WOODCUTTING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_WOODCUTTING]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.REPAIR, FlatFileMappings.EXP_REPAIR, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.UNARMED_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_UNARMED]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.WOODCUTTING, FlatFileMappings.EXP_WOODCUTTING, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.HERBALISM_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_HERBALISM]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.UNARMED, FlatFileMappings.EXP_UNARMED, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.EXCAVATION_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_EXCAVATION]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.HERBALISM, FlatFileMappings.EXP_HERBALISM, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.ARCHERY_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ARCHERY]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.EXCAVATION, FlatFileMappings.EXP_EXCAVATION, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.SWORDS_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_SWORDS]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.ARCHERY, FlatFileMappings.EXP_ARCHERY, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.AXES_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_AXES]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.SWORDS, FlatFileMappings.EXP_SWORDS, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.ACROBATICS_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ACROBATICS]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.AXES, FlatFileMappings.EXP_AXES, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.FISHING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_FISHING]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.ACROBATICS, FlatFileMappings.EXP_ACROBATICS, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.ALCHEMY_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ALCHEMY]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.FISHING, FlatFileMappings.EXP_FISHING, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.TRIDENTS_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_TRIDENTS]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.ALCHEMY, FlatFileMappings.EXP_ALCHEMY, username);
|
||||||
skillExperienceValueMap.put(CoreSkills.CROSSBOWS_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_CROSSBOWS]));
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.TRIDENTS, FlatFileMappings.EXP_TRIDENTS, username);
|
||||||
|
tryLoadSkillFloatValuesFromRawData(skillExperienceValueMap, dataStrSplit, PrimarySkillType.CROSSBOWS, FlatFileMappings.EXP_CROSSBOWS, username);
|
||||||
|
|
||||||
//Set Skill XP
|
//Set Skill XP
|
||||||
|
|
||||||
@ -1320,14 +1314,9 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
skillAbilityDeactivationTimeStamp.put(SuperAbilityType.SUPER_SHOTGUN, Integer.valueOf(dataStrSplit[FlatFileMappings.COOLDOWN_CROSSBOWS_SUPER_1]));
|
skillAbilityDeactivationTimeStamp.put(SuperAbilityType.SUPER_SHOTGUN, Integer.valueOf(dataStrSplit[FlatFileMappings.COOLDOWN_CROSSBOWS_SUPER_1]));
|
||||||
skillAbilityDeactivationTimeStamp.put(SuperAbilityType.TRIDENT_SUPER, Integer.valueOf(dataStrSplit[FlatFileMappings.COOLDOWN_TRIDENTS_SUPER_1]));
|
skillAbilityDeactivationTimeStamp.put(SuperAbilityType.TRIDENT_SUPER, Integer.valueOf(dataStrSplit[FlatFileMappings.COOLDOWN_TRIDENTS_SUPER_1]));
|
||||||
|
|
||||||
|
/*
|
||||||
// try {
|
* Mob Health Bars are no longer saved per player and are ignored from the data
|
||||||
// mobHealthbarType = MobHealthBarType.valueOf(dataStrSplit[FlatFileMappings.HEALTHBAR]);
|
*/
|
||||||
// }
|
|
||||||
// catch (Exception e) {
|
|
||||||
// mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//Sometimes players are retrieved by name
|
//Sometimes players are retrieved by name
|
||||||
UUID playerUUID;
|
UUID playerUUID;
|
||||||
@ -1347,7 +1336,6 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
scoreboardTipsShown = 0;
|
scoreboardTipsShown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
uniquePlayerDataMap.put(UniqueDataType.CHIMAERA_WING_DATS, Integer.valueOf(dataStrSplit[FlatFileMappings.COOLDOWN_CHIMAERA_WING]));
|
uniquePlayerDataMap.put(UniqueDataType.CHIMAERA_WING_DATS, Integer.valueOf(dataStrSplit[FlatFileMappings.COOLDOWN_CHIMAERA_WING]));
|
||||||
}
|
}
|
||||||
@ -1356,27 +1344,28 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
xpBarStateMap.put(CoreSkills.ACROBATICS_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ACROBATICS]));
|
xpBarStateMap.put(PrimarySkillType.ACROBATICS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ACROBATICS]));
|
||||||
xpBarStateMap.put(CoreSkills.ALCHEMY_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ALCHEMY]));
|
xpBarStateMap.put(PrimarySkillType.ALCHEMY, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ALCHEMY]));
|
||||||
xpBarStateMap.put(CoreSkills.ARCHERY_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ARCHERY]));
|
xpBarStateMap.put(PrimarySkillType.ARCHERY, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ARCHERY]));
|
||||||
xpBarStateMap.put(CoreSkills.AXES_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_AXES]));
|
xpBarStateMap.put(PrimarySkillType.AXES, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_AXES]));
|
||||||
xpBarStateMap.put(CoreSkills.EXCAVATION_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_EXCAVATION]));
|
xpBarStateMap.put(PrimarySkillType.EXCAVATION, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_EXCAVATION]));
|
||||||
xpBarStateMap.put(CoreSkills.FISHING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_FISHING]));
|
xpBarStateMap.put(PrimarySkillType.FISHING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_FISHING]));
|
||||||
xpBarStateMap.put(CoreSkills.HERBALISM_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_HERBALISM]));
|
xpBarStateMap.put(PrimarySkillType.HERBALISM, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_HERBALISM]));
|
||||||
xpBarStateMap.put(CoreSkills.MINING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_MINING]));
|
xpBarStateMap.put(PrimarySkillType.MINING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_MINING]));
|
||||||
xpBarStateMap.put(CoreSkills.REPAIR_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_REPAIR]));
|
xpBarStateMap.put(PrimarySkillType.REPAIR, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_REPAIR]));
|
||||||
xpBarStateMap.put(CoreSkills.SALVAGE_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SALVAGE]));
|
xpBarStateMap.put(PrimarySkillType.SALVAGE, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SALVAGE]));
|
||||||
xpBarStateMap.put(CoreSkills.SMELTING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SMELTING]));
|
xpBarStateMap.put(PrimarySkillType.SMELTING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SMELTING]));
|
||||||
xpBarStateMap.put(CoreSkills.SWORDS_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SWORDS]));
|
xpBarStateMap.put(PrimarySkillType.SWORDS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SWORDS]));
|
||||||
xpBarStateMap.put(CoreSkills.TAMING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TAMING]));
|
xpBarStateMap.put(PrimarySkillType.TAMING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TAMING]));
|
||||||
xpBarStateMap.put(CoreSkills.UNARMED_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_UNARMED]));
|
xpBarStateMap.put(PrimarySkillType.UNARMED, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_UNARMED]));
|
||||||
xpBarStateMap.put(CoreSkills.WOODCUTTING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_WOODCUTTING]));
|
xpBarStateMap.put(PrimarySkillType.WOODCUTTING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_WOODCUTTING]));
|
||||||
xpBarStateMap.put(CoreSkills.TRIDENTS_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TRIDENTS]));
|
xpBarStateMap.put(PrimarySkillType.TRIDENTS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TRIDENTS]));
|
||||||
xpBarStateMap.put(CoreSkills.CROSSBOWS_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_CROSSBOWS]));
|
xpBarStateMap.put(PrimarySkillType.CROSSBOWS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_CROSSBOWS]));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
xpBarStateMap = MMOExperienceBarManager.generateDefaultBarStateMap();
|
xpBarStateMap = MMOExperienceBarManager.generateDefaultBarStateMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
MMOPlayerData mmoPlayerData;
|
MMOPlayerData mmoPlayerData;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1399,36 +1388,68 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Add tests
|
private @NotNull Map<PrimarySkillType, Integer> getSkillMapFromLine(@NotNull String[] splitDataArray) {
|
||||||
private @NotNull Map<RootSkill, Integer> getSkillMapFromLine(@NotNull String[] stringDataArray) {
|
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
||||||
HashMap<RootSkill, Integer> skillLevelsMap = new HashMap<>(); // Skill & Level
|
String username = splitDataArray[FlatFileMappings.USERNAME];
|
||||||
|
|
||||||
skillLevelsMap.put(CoreSkills.TAMING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_TAMING]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.TAMING, FlatFileMappings.SKILLS_TAMING, username);
|
||||||
skillLevelsMap.put(CoreSkills.MINING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_MINING]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.MINING, FlatFileMappings.SKILLS_MINING, username);
|
||||||
skillLevelsMap.put(CoreSkills.REPAIR_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_REPAIR]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.REPAIR, FlatFileMappings.SKILLS_REPAIR, username);
|
||||||
skillLevelsMap.put(CoreSkills.WOODCUTTING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_WOODCUTTING]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.WOODCUTTING, FlatFileMappings.SKILLS_WOODCUTTING, username);
|
||||||
skillLevelsMap.put(CoreSkills.UNARMED_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_UNARMED]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.UNARMED, FlatFileMappings.SKILLS_UNARMED, username);
|
||||||
skillLevelsMap.put(CoreSkills.HERBALISM_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_HERBALISM]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.HERBALISM, FlatFileMappings.SKILLS_HERBALISM, username);
|
||||||
skillLevelsMap.put(CoreSkills.EXCAVATION_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_EXCAVATION]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.EXCAVATION, FlatFileMappings.SKILLS_EXCAVATION, username);
|
||||||
skillLevelsMap.put(CoreSkills.ARCHERY_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ARCHERY]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.ARCHERY, FlatFileMappings.SKILLS_ARCHERY, username);
|
||||||
skillLevelsMap.put(CoreSkills.SWORDS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_SWORDS]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.SWORDS, FlatFileMappings.SKILLS_SWORDS, username);
|
||||||
skillLevelsMap.put(CoreSkills.AXES_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_AXES]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.AXES, FlatFileMappings.SKILLS_AXES, username);
|
||||||
skillLevelsMap.put(CoreSkills.ACROBATICS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ACROBATICS]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.ACROBATICS, FlatFileMappings.SKILLS_ACROBATICS, username);
|
||||||
skillLevelsMap.put(CoreSkills.FISHING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_FISHING]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.FISHING, FlatFileMappings.SKILLS_FISHING, username);
|
||||||
skillLevelsMap.put(CoreSkills.ALCHEMY_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ALCHEMY]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.ALCHEMY, FlatFileMappings.SKILLS_ALCHEMY, username);
|
||||||
skillLevelsMap.put(CoreSkills.TRIDENTS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_TRIDENTS]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.TRIDENTS, FlatFileMappings.SKILLS_TRIDENTS, username);
|
||||||
skillLevelsMap.put(CoreSkills.CROSSBOWS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_CROSSBOWS]));
|
tryLoadSkillIntValuesFromRawData(skills, splitDataArray, PrimarySkillType.CROSSBOWS, FlatFileMappings.SKILLS_CROSSBOWS, username);
|
||||||
|
|
||||||
return skillLevelsMap;
|
return skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tryLoadSkillCooldownFromRawData(@NotNull Map<SuperAbilityType, Integer> cooldownMap, @NotNull String[] character, @NotNull SuperAbilityType superAbilityType, int cooldownSuperBreaker, @NotNull String userName) {
|
||||||
|
try {
|
||||||
|
cooldownMap.put(superAbilityType, Integer.valueOf(character[cooldownSuperBreaker]));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
mcMMO.p.getLogger().severe("Data corruption when trying to load the value for skill "+superAbilityType.toString()+" for player named " + userName+ " setting value to zero");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void tryLoadSkillFloatValuesFromRawData(@NotNull Map<PrimarySkillType, Float> skillMap, @NotNull String[] character, @NotNull PrimarySkillType primarySkillType, int index, @NotNull String userName) {
|
||||||
|
try {
|
||||||
|
float valueFromString = Integer.parseInt(character[index]);
|
||||||
|
skillMap.put(primarySkillType, valueFromString);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
skillMap.put(primarySkillType, 0F);
|
||||||
|
mcMMO.p.getLogger().severe("Data corruption when trying to load the value for skill "+primarySkillType.toString()+" for player named " + userName+ " setting value to zero");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void tryLoadSkillIntValuesFromRawData(@NotNull Map<PrimarySkillType, Integer> skillMap, @NotNull String[] character, @NotNull PrimarySkillType primarySkillType, int index, @NotNull String userName) {
|
||||||
|
try {
|
||||||
|
int valueFromString = Integer.parseInt(character[index]);
|
||||||
|
skillMap.put(primarySkillType, valueFromString);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
skillMap.put(primarySkillType, 0);
|
||||||
|
mcMMO.p.getLogger().severe("Data corruption when trying to load the value for skill "+primarySkillType.toString()+" for player named " + userName+ " setting value to zero");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public @NotNull DatabaseType getDatabaseType() {
|
public @NotNull DatabaseType getDatabaseType() {
|
||||||
return DatabaseType.FLATFILE;
|
return DatabaseType.FLATFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSkillIndex(@NotNull RootSkill rootSkill) {
|
private int getSkillIndex(@NotNull PrimarySkillType primarySkillType) {
|
||||||
PrimarySkillType primarySkillType = CoreSkills.getSkill(rootSkill);
|
|
||||||
|
|
||||||
switch (primarySkillType) {
|
switch (primarySkillType) {
|
||||||
case ACROBATICS:
|
case ACROBATICS:
|
||||||
return FlatFileMappings.SKILLS_ACROBATICS;
|
return FlatFileMappings.SKILLS_ACROBATICS;
|
||||||
|
@ -6,6 +6,7 @@ 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;
|
||||||
@ -264,23 +265,23 @@ 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));
|
statement.setInt(1, dataSnapshot.getSkillLevel(PrimarySkillType.TAMING));
|
||||||
statement.setInt(2, dataSnapshot.getSkillLevel(CoreSkills.MINING));
|
statement.setInt(2, dataSnapshot.getSkillLevel(PrimarySkillType.MINING));
|
||||||
statement.setInt(3, dataSnapshot.getSkillLevel(CoreSkills.REPAIR));
|
statement.setInt(3, dataSnapshot.getSkillLevel(PrimarySkillType.REPAIR));
|
||||||
statement.setInt(4, dataSnapshot.getSkillLevel(CoreSkills.WOODCUTTING));
|
statement.setInt(4, dataSnapshot.getSkillLevel(PrimarySkillType.WOODCUTTING));
|
||||||
statement.setInt(5, dataSnapshot.getSkillLevel(CoreSkills.UNARMED));
|
statement.setInt(5, dataSnapshot.getSkillLevel(PrimarySkillType.UNARMED));
|
||||||
statement.setInt(6, dataSnapshot.getSkillLevel(CoreSkills.HERBALISM));
|
statement.setInt(6, dataSnapshot.getSkillLevel(PrimarySkillType.HERBALISM));
|
||||||
statement.setInt(7, dataSnapshot.getSkillLevel(CoreSkills.EXCAVATION));
|
statement.setInt(7, dataSnapshot.getSkillLevel(PrimarySkillType.EXCAVATION));
|
||||||
statement.setInt(8, dataSnapshot.getSkillLevel(CoreSkills.ARCHERY));
|
statement.setInt(8, dataSnapshot.getSkillLevel(PrimarySkillType.ARCHERY));
|
||||||
statement.setInt(9, dataSnapshot.getSkillLevel(CoreSkills.SWORDS));
|
statement.setInt(9, dataSnapshot.getSkillLevel(PrimarySkillType.SWORDS));
|
||||||
statement.setInt(10, dataSnapshot.getSkillLevel(CoreSkills.AXES));
|
statement.setInt(10, dataSnapshot.getSkillLevel(PrimarySkillType.AXES));
|
||||||
statement.setInt(11, dataSnapshot.getSkillLevel(CoreSkills.ACROBATICS));
|
statement.setInt(11, dataSnapshot.getSkillLevel(PrimarySkillType.ACROBATICS));
|
||||||
statement.setInt(12, dataSnapshot.getSkillLevel(CoreSkills.FISHING));
|
statement.setInt(12, dataSnapshot.getSkillLevel(PrimarySkillType.FISHING));
|
||||||
statement.setInt(13, dataSnapshot.getSkillLevel(CoreSkills.ALCHEMY));
|
statement.setInt(13, dataSnapshot.getSkillLevel(PrimarySkillType.ALCHEMY));
|
||||||
statement.setInt(14, dataSnapshot.getSkillLevel(CoreSkills.TRIDENTS));
|
statement.setInt(14, dataSnapshot.getSkillLevel(PrimarySkillType.TRIDENTS));
|
||||||
statement.setInt(15, dataSnapshot.getSkillLevel(CoreSkills.CROSSBOWS));
|
statement.setInt(15, dataSnapshot.getSkillLevel(PrimarySkillType.CROSSBOWS));
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (RootSkill rootSkill : CoreSkills.getNonChildSkills())
|
for (RootSkill rootSkill : PrimarySkillType.getNonChildSkills())
|
||||||
total += dataSnapshot.getSkillLevel(rootSkill);
|
total += dataSnapshot.getSkillLevel(rootSkill);
|
||||||
statement.setInt(16, total);
|
statement.setInt(16, total);
|
||||||
statement.setInt(17, id);
|
statement.setInt(17, id);
|
||||||
@ -296,21 +297,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));
|
statement.setInt(1, dataSnapshot.getSkillXpLevel(PrimarySkillType.TAMING));
|
||||||
statement.setInt(2, dataSnapshot.getSkillXpLevel(CoreSkills.MINING));
|
statement.setInt(2, dataSnapshot.getSkillXpLevel(PrimarySkillType.MINING));
|
||||||
statement.setInt(3, dataSnapshot.getSkillXpLevel(CoreSkills.REPAIR));
|
statement.setInt(3, dataSnapshot.getSkillXpLevel(PrimarySkillType.REPAIR));
|
||||||
statement.setInt(4, dataSnapshot.getSkillXpLevel(CoreSkills.WOODCUTTING));
|
statement.setInt(4, dataSnapshot.getSkillXpLevel(PrimarySkillType.WOODCUTTING));
|
||||||
statement.setInt(5, dataSnapshot.getSkillXpLevel(CoreSkills.UNARMED));
|
statement.setInt(5, dataSnapshot.getSkillXpLevel(PrimarySkillType.UNARMED));
|
||||||
statement.setInt(6, dataSnapshot.getSkillXpLevel(CoreSkills.HERBALISM));
|
statement.setInt(6, dataSnapshot.getSkillXpLevel(PrimarySkillType.HERBALISM));
|
||||||
statement.setInt(7, dataSnapshot.getSkillXpLevel(CoreSkills.EXCAVATION));
|
statement.setInt(7, dataSnapshot.getSkillXpLevel(PrimarySkillType.EXCAVATION));
|
||||||
statement.setInt(8, dataSnapshot.getSkillXpLevel(CoreSkills.ARCHERY));
|
statement.setInt(8, dataSnapshot.getSkillXpLevel(PrimarySkillType.ARCHERY));
|
||||||
statement.setInt(9, dataSnapshot.getSkillXpLevel(CoreSkills.SWORDS));
|
statement.setInt(9, dataSnapshot.getSkillXpLevel(PrimarySkillType.SWORDS));
|
||||||
statement.setInt(10, dataSnapshot.getSkillXpLevel(CoreSkills.AXES));
|
statement.setInt(10, dataSnapshot.getSkillXpLevel(PrimarySkillType.AXES));
|
||||||
statement.setInt(11, dataSnapshot.getSkillXpLevel(CoreSkills.ACROBATICS));
|
statement.setInt(11, dataSnapshot.getSkillXpLevel(PrimarySkillType.ACROBATICS));
|
||||||
statement.setInt(12, dataSnapshot.getSkillXpLevel(CoreSkills.FISHING));
|
statement.setInt(12, dataSnapshot.getSkillXpLevel(PrimarySkillType.FISHING));
|
||||||
statement.setInt(13, dataSnapshot.getSkillXpLevel(CoreSkills.ALCHEMY));
|
statement.setInt(13, dataSnapshot.getSkillXpLevel(PrimarySkillType.ALCHEMY));
|
||||||
statement.setInt(14, dataSnapshot.getSkillXpLevel(CoreSkills.TRIDENTS));
|
statement.setInt(14, dataSnapshot.getSkillXpLevel(PrimarySkillType.TRIDENTS));
|
||||||
statement.setInt(15, dataSnapshot.getSkillXpLevel(CoreSkills.CROSSBOWS));
|
statement.setInt(15, dataSnapshot.getSkillXpLevel(PrimarySkillType.CROSSBOWS));
|
||||||
statement.setInt(16, id);
|
statement.setInt(16, id);
|
||||||
success &= (statement.executeUpdate() != 0);
|
success &= (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
@ -361,23 +362,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).toString());
|
statement.setString(1, dataSnapshot.getBarStateMap().get(PrimarySkillType.TAMING).toString());
|
||||||
statement.setString(2, dataSnapshot.getBarStateMap().get(CoreSkills.MINING).toString());
|
statement.setString(2, dataSnapshot.getBarStateMap().get(PrimarySkillType.MINING).toString());
|
||||||
statement.setString(3, dataSnapshot.getBarStateMap().get(CoreSkills.REPAIR).toString());
|
statement.setString(3, dataSnapshot.getBarStateMap().get(PrimarySkillType.REPAIR).toString());
|
||||||
statement.setString(4, dataSnapshot.getBarStateMap().get(CoreSkills.WOODCUTTING).toString());
|
statement.setString(4, dataSnapshot.getBarStateMap().get(PrimarySkillType.WOODCUTTING).toString());
|
||||||
statement.setString(5, dataSnapshot.getBarStateMap().get(CoreSkills.UNARMED).toString());
|
statement.setString(5, dataSnapshot.getBarStateMap().get(PrimarySkillType.UNARMED).toString());
|
||||||
statement.setString(6, dataSnapshot.getBarStateMap().get(CoreSkills.HERBALISM).toString());
|
statement.setString(6, dataSnapshot.getBarStateMap().get(PrimarySkillType.HERBALISM).toString());
|
||||||
statement.setString(7, dataSnapshot.getBarStateMap().get(CoreSkills.EXCAVATION).toString());
|
statement.setString(7, dataSnapshot.getBarStateMap().get(PrimarySkillType.EXCAVATION).toString());
|
||||||
statement.setString(8, dataSnapshot.getBarStateMap().get(CoreSkills.ARCHERY).toString());
|
statement.setString(8, dataSnapshot.getBarStateMap().get(PrimarySkillType.ARCHERY).toString());
|
||||||
statement.setString(9, dataSnapshot.getBarStateMap().get(CoreSkills.SWORDS).toString());
|
statement.setString(9, dataSnapshot.getBarStateMap().get(PrimarySkillType.SWORDS).toString());
|
||||||
statement.setString(10, dataSnapshot.getBarStateMap().get(CoreSkills.AXES).toString());
|
statement.setString(10, dataSnapshot.getBarStateMap().get(PrimarySkillType.AXES).toString());
|
||||||
statement.setString(11, dataSnapshot.getBarStateMap().get(CoreSkills.ACROBATICS).toString());
|
statement.setString(11, dataSnapshot.getBarStateMap().get(PrimarySkillType.ACROBATICS).toString());
|
||||||
statement.setString(12, dataSnapshot.getBarStateMap().get(CoreSkills.FISHING).toString());
|
statement.setString(12, dataSnapshot.getBarStateMap().get(PrimarySkillType.FISHING).toString());
|
||||||
statement.setString(13, dataSnapshot.getBarStateMap().get(CoreSkills.ALCHEMY).toString());
|
statement.setString(13, dataSnapshot.getBarStateMap().get(PrimarySkillType.ALCHEMY).toString());
|
||||||
statement.setString(14, dataSnapshot.getBarStateMap().get(CoreSkills.SALVAGE).toString());
|
statement.setString(14, dataSnapshot.getBarStateMap().get(PrimarySkillType.SALVAGE).toString());
|
||||||
statement.setString(15, dataSnapshot.getBarStateMap().get(CoreSkills.SMELTING).toString());
|
statement.setString(15, dataSnapshot.getBarStateMap().get(PrimarySkillType.SMELTING).toString());
|
||||||
statement.setString(16, dataSnapshot.getBarStateMap().get(CoreSkills.TRIDENTS).toString());
|
statement.setString(16, dataSnapshot.getBarStateMap().get(PrimarySkillType.TRIDENTS).toString());
|
||||||
statement.setString(17, dataSnapshot.getBarStateMap().get(CoreSkills.CROSSBOWS).toString());
|
statement.setString(17, dataSnapshot.getBarStateMap().get(PrimarySkillType.CROSSBOWS).toString());
|
||||||
statement.setInt(18, id);
|
statement.setInt(18, id);
|
||||||
success &= (statement.executeUpdate() != 0);
|
success &= (statement.executeUpdate() != 0);
|
||||||
statement.close();
|
statement.close();
|
||||||
@ -417,7 +418,7 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
List<PlayerStat> stats = new ArrayList<>();
|
List<PlayerStat> stats = new ArrayList<>();
|
||||||
|
|
||||||
//Fix for a plugin that people are using that is throwing SQL errors
|
//Fix for a plugin that people are using that is throwing SQL errors
|
||||||
if(rootSkill != null && CoreSkills.isChildSkill(rootSkill)) {
|
if(rootSkill != null && PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
mcMMO.p.getLogger().severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
mcMMO.p.getLogger().severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
||||||
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
||||||
}
|
}
|
||||||
@ -459,8 +460,8 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull Map<RootSkill, Integer> readRank(@NotNull String playerName) {
|
public @NotNull Map<PrimarySkillType, Integer> readRank(@NotNull String playerName) {
|
||||||
Map<RootSkill, Integer> skills = new HashMap<>();
|
Map<PrimarySkillType, Integer> skills = new HashMap<>();
|
||||||
|
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
@ -468,7 +469,7 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
connection = getConnection(PoolIdentifier.MISC);
|
connection = getConnection(PoolIdentifier.MISC);
|
||||||
for (RootSkill rootSkill : CoreSkills.getNonChildSkills()) {
|
for (RootSkill rootSkill : PrimarySkillType.getNonChildSkills()) {
|
||||||
String skillName = rootSkill.getRawSkillName().toLowerCase(Locale.ENGLISH);
|
String skillName = rootSkill.getRawSkillName().toLowerCase(Locale.ENGLISH);
|
||||||
// Get count of all users with higher skill level than player
|
// Get count of all users with higher skill level than player
|
||||||
String sql = "SELECT COUNT(*) AS 'rank' FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
String sql = "SELECT COUNT(*) AS 'rank' FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
||||||
@ -1056,7 +1057,7 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (Config.getInstance().getTruncateSkills()) {
|
||||||
for (RootSkill rootSkill : CoreSkills.getNonChildSkills()) {
|
for (RootSkill rootSkill : PrimarySkillType.getNonChildSkills()) {
|
||||||
int cap = Config.getInstance().getLevelCap(rootSkill);
|
int cap = Config.getInstance().getLevelCap(rootSkill);
|
||||||
if (cap != Integer.MAX_VALUE) {
|
if (cap != Integer.MAX_VALUE) {
|
||||||
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `"
|
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `"
|
||||||
@ -1227,8 +1228,8 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
|
|
||||||
private @Nullable MMOPlayerData loadFromResult(@NotNull String playerName, @NotNull ResultSet result) throws SQLException {
|
private @Nullable MMOPlayerData loadFromResult(@NotNull String playerName, @NotNull ResultSet result) throws SQLException {
|
||||||
MMODataBuilder MMODataBuilder = new MMODataBuilder();
|
MMODataBuilder MMODataBuilder = new MMODataBuilder();
|
||||||
Map<RootSkill, Integer> skills = new HashMap<>(); // Skill & Level
|
Map<PrimarySkillType, Integer> skills = new HashMap<>(); // Skill & Level
|
||||||
Map<RootSkill, Float> skillsXp = new HashMap<>(); // Skill & XP
|
Map<PrimarySkillType, Float> skillsXp = new HashMap<>(); // Skill & XP
|
||||||
Map<SuperSkill, Integer> skillsDATS = new HashMap<>(); // Ability & Cooldown
|
Map<SuperSkill, Integer> skillsDATS = new HashMap<>(); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniqueData = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
Map<UniqueDataType, Integer> uniqueData = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
||||||
Map<RootSkill, SkillBossBarState> xpBarStateMap = new HashMap<RootSkill, SkillBossBarState>();
|
Map<RootSkill, SkillBossBarState> xpBarStateMap = new HashMap<RootSkill, SkillBossBarState>();
|
||||||
@ -1246,37 +1247,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, result.getInt(OFFSET_SKILLS + 1));
|
skills.put(PrimarySkillType.TAMING, result.getInt(OFFSET_SKILLS + 1));
|
||||||
skills.put(CoreSkills.MINING, result.getInt(OFFSET_SKILLS + 2));
|
skills.put(PrimarySkillType.MINING, result.getInt(OFFSET_SKILLS + 2));
|
||||||
skills.put(CoreSkills.REPAIR, result.getInt(OFFSET_SKILLS + 3));
|
skills.put(PrimarySkillType.REPAIR, result.getInt(OFFSET_SKILLS + 3));
|
||||||
skills.put(CoreSkills.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
|
skills.put(PrimarySkillType.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4));
|
||||||
skills.put(CoreSkills.UNARMED, result.getInt(OFFSET_SKILLS + 5));
|
skills.put(PrimarySkillType.UNARMED, result.getInt(OFFSET_SKILLS + 5));
|
||||||
skills.put(CoreSkills.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
|
skills.put(PrimarySkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
|
||||||
skills.put(CoreSkills.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
|
skills.put(PrimarySkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
|
||||||
skills.put(CoreSkills.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
|
skills.put(PrimarySkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
|
||||||
skills.put(CoreSkills.SWORDS, result.getInt(OFFSET_SKILLS + 9));
|
skills.put(PrimarySkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9));
|
||||||
skills.put(CoreSkills.AXES, result.getInt(OFFSET_SKILLS + 10));
|
skills.put(PrimarySkillType.AXES, result.getInt(OFFSET_SKILLS + 10));
|
||||||
skills.put(CoreSkills.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
|
skills.put(PrimarySkillType.ACROBATICS, result.getInt(OFFSET_SKILLS + 11));
|
||||||
skills.put(CoreSkills.FISHING, result.getInt(OFFSET_SKILLS + 12));
|
skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12));
|
||||||
skills.put(CoreSkills.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13));
|
||||||
skills.put(CoreSkills.TRIDENTS, result.getInt(OFFSET_SKILLS + 14));
|
skills.put(PrimarySkillType.TRIDENTS, result.getInt(OFFSET_SKILLS + 14));
|
||||||
skills.put(CoreSkills.CROSSBOWS, result.getInt(OFFSET_SKILLS + 15));
|
skills.put(PrimarySkillType.CROSSBOWS, result.getInt(OFFSET_SKILLS + 15));
|
||||||
|
|
||||||
skillsXp.put(CoreSkills.TAMING, result.getFloat(OFFSET_EXPERIENCE + 1));
|
skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_EXPERIENCE + 1));
|
||||||
skillsXp.put(CoreSkills.MINING, result.getFloat(OFFSET_EXPERIENCE + 2));
|
skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_EXPERIENCE + 2));
|
||||||
skillsXp.put(CoreSkills.REPAIR, result.getFloat(OFFSET_EXPERIENCE + 3));
|
skillsXp.put(PrimarySkillType.REPAIR, result.getFloat(OFFSET_EXPERIENCE + 3));
|
||||||
skillsXp.put(CoreSkills.WOODCUTTING, result.getFloat(OFFSET_EXPERIENCE + 4));
|
skillsXp.put(PrimarySkillType.WOODCUTTING, result.getFloat(OFFSET_EXPERIENCE + 4));
|
||||||
skillsXp.put(CoreSkills.UNARMED, result.getFloat(OFFSET_EXPERIENCE + 5));
|
skillsXp.put(PrimarySkillType.UNARMED, result.getFloat(OFFSET_EXPERIENCE + 5));
|
||||||
skillsXp.put(CoreSkills.HERBALISM, result.getFloat(OFFSET_EXPERIENCE + 6));
|
skillsXp.put(PrimarySkillType.HERBALISM, result.getFloat(OFFSET_EXPERIENCE + 6));
|
||||||
skillsXp.put(CoreSkills.EXCAVATION, result.getFloat(OFFSET_EXPERIENCE + 7));
|
skillsXp.put(PrimarySkillType.EXCAVATION, result.getFloat(OFFSET_EXPERIENCE + 7));
|
||||||
skillsXp.put(CoreSkills.ARCHERY, result.getFloat(OFFSET_EXPERIENCE + 8));
|
skillsXp.put(PrimarySkillType.ARCHERY, result.getFloat(OFFSET_EXPERIENCE + 8));
|
||||||
skillsXp.put(CoreSkills.SWORDS, result.getFloat(OFFSET_EXPERIENCE + 9));
|
skillsXp.put(PrimarySkillType.SWORDS, result.getFloat(OFFSET_EXPERIENCE + 9));
|
||||||
skillsXp.put(CoreSkills.AXES, result.getFloat(OFFSET_EXPERIENCE + 10));
|
skillsXp.put(PrimarySkillType.AXES, result.getFloat(OFFSET_EXPERIENCE + 10));
|
||||||
skillsXp.put(CoreSkills.ACROBATICS, result.getFloat(OFFSET_EXPERIENCE + 11));
|
skillsXp.put(PrimarySkillType.ACROBATICS, result.getFloat(OFFSET_EXPERIENCE + 11));
|
||||||
skillsXp.put(CoreSkills.FISHING, result.getFloat(OFFSET_EXPERIENCE + 12));
|
skillsXp.put(PrimarySkillType.FISHING, result.getFloat(OFFSET_EXPERIENCE + 12));
|
||||||
skillsXp.put(CoreSkills.ALCHEMY, result.getFloat(OFFSET_EXPERIENCE + 13));
|
skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_EXPERIENCE + 13));
|
||||||
skillsXp.put(CoreSkills.TRIDENTS, result.getFloat(OFFSET_EXPERIENCE + 14));
|
skillsXp.put(PrimarySkillType.TRIDENTS, result.getFloat(OFFSET_EXPERIENCE + 14));
|
||||||
skillsXp.put(CoreSkills.CROSSBOWS, result.getFloat(OFFSET_EXPERIENCE + 15));
|
skillsXp.put(PrimarySkillType.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));
|
||||||
@ -1319,23 +1320,23 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//XPBAR
|
//XPBAR
|
||||||
xpBarStateMap.put(CoreSkills.TAMING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 1)));
|
xpBarStateMap.put(PrimarySkillType.TAMING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 1)));
|
||||||
xpBarStateMap.put(CoreSkills.MINING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 2)));
|
xpBarStateMap.put(PrimarySkillType.MINING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 2)));
|
||||||
xpBarStateMap.put(CoreSkills.REPAIR, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 3)));
|
xpBarStateMap.put(PrimarySkillType.REPAIR, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 3)));
|
||||||
xpBarStateMap.put(CoreSkills.WOODCUTTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 4)));
|
xpBarStateMap.put(PrimarySkillType.WOODCUTTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 4)));
|
||||||
xpBarStateMap.put(CoreSkills.UNARMED, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 5)));
|
xpBarStateMap.put(PrimarySkillType.UNARMED, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 5)));
|
||||||
xpBarStateMap.put(CoreSkills.HERBALISM, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 6)));
|
xpBarStateMap.put(PrimarySkillType.HERBALISM, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 6)));
|
||||||
xpBarStateMap.put(CoreSkills.EXCAVATION, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 7)));
|
xpBarStateMap.put(PrimarySkillType.EXCAVATION, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 7)));
|
||||||
xpBarStateMap.put(CoreSkills.ARCHERY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 8)));
|
xpBarStateMap.put(PrimarySkillType.ARCHERY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 8)));
|
||||||
xpBarStateMap.put(CoreSkills.SWORDS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 9)));
|
xpBarStateMap.put(PrimarySkillType.SWORDS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 9)));
|
||||||
xpBarStateMap.put(CoreSkills.AXES, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 10)));
|
xpBarStateMap.put(PrimarySkillType.AXES, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 10)));
|
||||||
xpBarStateMap.put(CoreSkills.ACROBATICS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 11)));
|
xpBarStateMap.put(PrimarySkillType.ACROBATICS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 11)));
|
||||||
xpBarStateMap.put(CoreSkills.FISHING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 12)));
|
xpBarStateMap.put(PrimarySkillType.FISHING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 12)));
|
||||||
xpBarStateMap.put(CoreSkills.ALCHEMY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 13)));
|
xpBarStateMap.put(PrimarySkillType.ALCHEMY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 13)));
|
||||||
xpBarStateMap.put(CoreSkills.SALVAGE, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 14)));
|
xpBarStateMap.put(PrimarySkillType.SALVAGE, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 14)));
|
||||||
xpBarStateMap.put(CoreSkills.SMELTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 15)));
|
xpBarStateMap.put(PrimarySkillType.SMELTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 15)));
|
||||||
xpBarStateMap.put(CoreSkills.TRIDENTS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 16)));
|
xpBarStateMap.put(PrimarySkillType.TRIDENTS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 16)));
|
||||||
xpBarStateMap.put(CoreSkills.CROSSBOWS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 17)));
|
xpBarStateMap.put(PrimarySkillType.CROSSBOWS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 17)));
|
||||||
|
|
||||||
//TOGGLE
|
//TOGGLE
|
||||||
boolean chatSpy = result.getBoolean(OFFSET_TOGGLE+1);
|
boolean chatSpy = result.getBoolean(OFFSET_TOGGLE+1);
|
||||||
@ -1496,10 +1497,10 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
|
|||||||
resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
|
resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
|
||||||
resultSet.last();
|
resultSet.last();
|
||||||
|
|
||||||
if (resultSet.getRow() != CoreSkills.getNonChildSkills().size()) {
|
if (resultSet.getRow() != PrimarySkillType.getNonChildSkills().size()) {
|
||||||
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
|
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
|
||||||
|
|
||||||
for (RootSkill rootSkill : CoreSkills.getNonChildSkills()) {
|
for (RootSkill rootSkill : PrimarySkillType.getNonChildSkills()) {
|
||||||
String skill_name = rootSkill.getRawSkillName().toLowerCase(Locale.ENGLISH);
|
String skill_name = rootSkill.getRawSkillName().toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -47,7 +47,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
public int getPowerLevel() {
|
public int getPowerLevel() {
|
||||||
int powerLevel = 0;
|
int powerLevel = 0;
|
||||||
|
|
||||||
Map<RootSkill, Integer> rootSkillLevelMap = mmoPlayerData.getDirtySkillLevelMap().unwrapMap();
|
Map<PrimarySkillType, Integer> rootSkillLevelMap = mmoPlayerData.getDirtySkillLevelMap().unwrapMap();
|
||||||
|
|
||||||
for (RootSkill rootSkill : rootSkillLevelMap.keySet()) {
|
for (RootSkill rootSkill : rootSkillLevelMap.keySet()) {
|
||||||
powerLevel += rootSkillLevelMap.get(rootSkill);
|
powerLevel += rootSkillLevelMap.get(rootSkill);
|
||||||
@ -63,7 +63,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSkillXpValue(@NotNull RootSkill rootSkill) {
|
public int getSkillXpValue(@NotNull RootSkill rootSkill) {
|
||||||
if(CoreSkills.isChildSkill(rootSkill)) {
|
if(PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSkillXpValue(@NotNull RootSkill rootSkill, float xpLevel) {
|
public void setSkillXpValue(@NotNull RootSkill rootSkill, float xpLevel) {
|
||||||
if (CoreSkills.isChildSkill(rootSkill)) {
|
if (PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoreSkills.isChildSkill(rootSkill)) {
|
if (PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
Set<RootSkill> parentSkills = FamilyTree.getParentSkills(rootSkill);
|
Set<RootSkill> parentSkills = FamilyTree.getParentSkills(rootSkill);
|
||||||
float splitXp = xp / parentSkills.size();
|
float splitXp = xp / parentSkills.size();
|
||||||
|
|
||||||
@ -147,12 +147,12 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSkillLevel(@NotNull RootSkill rootSkill) {
|
public int getSkillLevel(@NotNull RootSkill rootSkill) {
|
||||||
return CoreSkills.isChildSkill(rootSkill) ? getChildSkillLevel(rootSkill) : getSkillLevel(rootSkill);
|
return PrimarySkillType.isChildSkill(rootSkill) ? getChildSkillLevel(rootSkill) : getSkillLevel(rootSkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getExperienceToNextLevel(@NotNull RootSkill rootSkill) {
|
public int getExperienceToNextLevel(@NotNull RootSkill rootSkill) {
|
||||||
if(CoreSkills.isChildSkill(rootSkill)) {
|
if(PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
@Override
|
@Override
|
||||||
public double getProgressInCurrentSkillLevel(@NotNull RootSkill rootSkill) throws UnknownSkillException
|
public double getProgressInCurrentSkillLevel(@NotNull RootSkill rootSkill) throws UnknownSkillException
|
||||||
{
|
{
|
||||||
if(CoreSkills.isChildSkill(rootSkill)) {
|
if(PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
return 1.0D;
|
return 1.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,11 +283,11 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void applyXpGain(@NotNull RootSkill rootSkill, float xp, @NotNull XPGainReason xpGainReason, @NotNull XPGainSource xpGainSource) {
|
public void applyXpGain(@NotNull RootSkill rootSkill, float xp, @NotNull XPGainReason xpGainReason, @NotNull XPGainSource xpGainSource) {
|
||||||
//Only check for permissions if the player is online, otherwise just assume a command is being executed by an admin or some other means and add the XP
|
//Only check for permissions if the player is online, otherwise just assume a command is being executed by an admin or some other means and add the XP
|
||||||
if (!Permissions.skillEnabled(mmoPlayer.getPlayer(), CoreSkills.getSkill(rootSkill))) {
|
if (!Permissions.skillEnabled(mmoPlayer.getPlayer(), PrimarySkillType.getSkill(rootSkill))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoreSkills.isChildSkill(rootSkill)) {
|
if (PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
Set<RootSkill> parentSkills = FamilyTree.getParentSkills(rootSkill);
|
Set<RootSkill> parentSkills = FamilyTree.getParentSkills(rootSkill);
|
||||||
|
|
||||||
for (RootSkill parentSkill : parentSkills) {
|
for (RootSkill parentSkill : parentSkills) {
|
||||||
@ -301,7 +301,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setUsingUnarmed(rootSkill == CoreSkills.UNARMED);
|
setUsingUnarmed(rootSkill == PrimarySkillType.UNARMED);
|
||||||
updateLevelStats(rootSkill, xpGainReason, xpGainSource);
|
updateLevelStats(rootSkill, xpGainReason, xpGainSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ public class MMODataBuilder {
|
|||||||
private long lastLogin;
|
private long lastLogin;
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private @Nullable Map<RootSkill, Integer> skillLevelValues;
|
private @Nullable Map<PrimarySkillType, Integer> skillLevelValues;
|
||||||
private @Nullable Map<RootSkill, Float> skillExperienceValues;
|
private @Nullable Map<PrimarySkillType, Float> skillExperienceValues;
|
||||||
private @Nullable Map<SuperSkill, Integer> abilityDeactivationTimestamps; // Ability & Cooldown
|
private @Nullable Map<SuperSkill, Integer> abilityDeactivationTimestamps; // Ability & Cooldown
|
||||||
private @Nullable Map<UniqueDataType, Integer> uniquePlayerData; //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
private @Nullable Map<UniqueDataType, Integer> uniquePlayerData; //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||||
private @Nullable Map<RootSkill, SkillBossBarState> barStateMap;
|
private @Nullable Map<RootSkill, SkillBossBarState> barStateMap;
|
||||||
@ -107,7 +107,7 @@ public class MMODataBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateExperienceValueMapEntries(@NotNull Map<RootSkill, Float> map) {
|
private void validateExperienceValueMapEntries(@NotNull Map<PrimarySkillType, Float> map) {
|
||||||
for(RootSkill key : mcMMO.p.getSkillRegister().getRootSkills()) {
|
for(RootSkill key : mcMMO.p.getSkillRegister().getRootSkills()) {
|
||||||
map.putIfAbsent(key, 0F);
|
map.putIfAbsent(key, 0F);
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ public class MMODataBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateSkillLevelMapEntries(@NotNull Map<RootSkill, Integer> map) {
|
private void validateSkillLevelMapEntries(@NotNull Map<PrimarySkillType, Integer> map) {
|
||||||
for(RootSkill key : mcMMO.p.getSkillRegister().getRootSkills()) {
|
for(RootSkill key : mcMMO.p.getSkillRegister().getRootSkills()) {
|
||||||
map.putIfAbsent(key, 0);
|
map.putIfAbsent(key, 0);
|
||||||
|
|
||||||
@ -178,20 +178,20 @@ public class MMODataBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable Map<RootSkill, Integer> getSkillLevelValues() {
|
public @Nullable Map<PrimarySkillType, Integer> getSkillLevelValues() {
|
||||||
return skillLevelValues;
|
return skillLevelValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull MMODataBuilder setSkillLevelValues(@NotNull Map<RootSkill, Integer> skillLevelValues) {
|
public @NotNull MMODataBuilder setSkillLevelValues(@NotNull Map<PrimarySkillType, Integer> skillLevelValues) {
|
||||||
this.skillLevelValues = skillLevelValues;
|
this.skillLevelValues = skillLevelValues;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable Map<RootSkill, Float> getSkillExperienceValues() {
|
public @Nullable Map<PrimarySkillType, Float> getSkillExperienceValues() {
|
||||||
return skillExperienceValues;
|
return skillExperienceValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull MMODataBuilder setSkillExperienceValues(@NotNull Map<RootSkill, Float> skillExperienceValues) {
|
public @NotNull MMODataBuilder setSkillExperienceValues(@NotNull Map<PrimarySkillType, Float> skillExperienceValues) {
|
||||||
this.skillExperienceValues = skillExperienceValues;
|
this.skillExperienceValues = skillExperienceValues;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,11 @@ public class MMODataSnapshot {
|
|||||||
private final long lastLogin;
|
private final long lastLogin;
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final @NotNull ImmutableMap<RootSkill, Integer> skillLevelValues;
|
private final @NotNull ImmutableMap<PrimarySkillType, Integer> skillLevelValues;
|
||||||
private final @NotNull ImmutableMap<RootSkill, Float> skillExperienceValues;
|
private final @NotNull ImmutableMap<PrimarySkillType, Float> skillExperienceValues;
|
||||||
private final @NotNull ImmutableMap<SuperSkill, Integer> abilityDeactivationTimestamps; // Ability & Cooldown
|
private final @NotNull ImmutableMap<SuperAbilityType, Integer> abilityDeactivationTimestamps; // Ability & Cooldown
|
||||||
private final @NotNull ImmutableMap<UniqueDataType, Integer> uniquePlayerData; //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
private final @NotNull ImmutableMap<UniqueDataType, Integer> uniquePlayerData; //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||||
private final @NotNull ImmutableMap<RootSkill, SkillBossBarState> barStateMap;
|
private final @NotNull ImmutableMap<PrimarySkillType, SkillBossBarState> barStateMap;
|
||||||
|
|
||||||
/* Special Flags */
|
/* Special Flags */
|
||||||
private final boolean partyChatSpying;
|
private final boolean partyChatSpying;
|
||||||
@ -66,15 +66,15 @@ public class MMODataSnapshot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public @NotNull ImmutableMap<RootSkill, Integer> getSkillLevelValues() {
|
public @NotNull ImmutableMap<PrimarySkillType, Integer> getSkillLevelValues() {
|
||||||
return skillLevelValues;
|
return skillLevelValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull ImmutableMap<RootSkill, Float> getSkillExperienceValues() {
|
public @NotNull ImmutableMap<PrimarySkillType, Float> getSkillExperienceValues() {
|
||||||
return skillExperienceValues;
|
return skillExperienceValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull ImmutableMap<SuperSkill, Integer> getAbilityDeactivationTimestamps() {
|
public @NotNull ImmutableMap<SuperAbilityType, Integer> getAbilityDeactivationTimestamps() {
|
||||||
return abilityDeactivationTimestamps;
|
return abilityDeactivationTimestamps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public class MMODataSnapshot {
|
|||||||
return uniquePlayerData;
|
return uniquePlayerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull ImmutableMap<RootSkill, SkillBossBarState> getBarStateMap() {
|
public @NotNull ImmutableMap<PrimarySkillType, SkillBossBarState> getBarStateMap() {
|
||||||
return barStateMap;
|
return barStateMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ public class MMODataSnapshot {
|
|||||||
return (skillExperienceValues.getOrDefault(rootSkill, 0F)).intValue();
|
return (skillExperienceValues.getOrDefault(rootSkill, 0F)).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAbilityDATS(@NotNull SuperSkill superAbilityType) {
|
public long getAbilityDATS(@NotNull SuperAbilityType superAbilityType) {
|
||||||
return abilityDeactivationTimestamps.getOrDefault(superAbilityType, 0);
|
return abilityDeactivationTimestamps.getOrDefault(superAbilityType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
|
|||||||
* If in the future someone wants to remove this, don't forget to also remove what is in the PrimarySkillType enum. - bm01
|
* If in the future someone wants to remove this, don't forget to also remove what is in the PrimarySkillType enum. - bm01
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
for (CoreRootSkill coreRootSkill : CoreSkills.getCoreRootSkills()) {
|
for (CoreRootSkill coreRootSkill : PrimarySkillType.getCoreRootSkills()) {
|
||||||
skillManagers.put(coreRootSkill, coreRootSkill.getSkillManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
skillManagers.put(coreRootSkill, coreRootSkill.getSkillManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ public class PersistentPlayerData implements MMOPlayerData {
|
|||||||
private final DirtyData<MutableLong> lastLogin;
|
private final DirtyData<MutableLong> lastLogin;
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final @NotNull DirtyMap<RootSkill, Integer> skillLevelValues;
|
private final @NotNull DirtyMap<PrimarySkillType, Integer> skillLevelValues;
|
||||||
private final @NotNull DirtyMap<RootSkill, Float> skillExperienceValues;
|
private final @NotNull DirtyMap<PrimarySkillType, Float> skillExperienceValues;
|
||||||
private final @NotNull DirtyMap<SuperSkill, Integer> abilityDeactivationTimestamps; // Ability & Cooldown
|
private final @NotNull DirtyMap<SuperSkill, Integer> abilityDeactivationTimestamps; // Ability & Cooldown
|
||||||
private final @NotNull DirtyMap<UniqueDataType, Integer> uniquePlayerData; //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
private final @NotNull DirtyMap<UniqueDataType, Integer> uniquePlayerData; //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||||
private final @NotNull DirtyMap<RootSkill, SkillBossBarState> barStateMap;
|
private final @NotNull DirtyMap<RootSkill, SkillBossBarState> barStateMap;
|
||||||
@ -79,7 +79,7 @@ public class PersistentPlayerData implements MMOPlayerData {
|
|||||||
|
|
||||||
//Core skills
|
//Core skills
|
||||||
//TODO: Don't store values for disabled skills
|
//TODO: Don't store values for disabled skills
|
||||||
for(RootSkill rootSkill : CoreSkills.getCoreRootSkills()) {
|
for(RootSkill rootSkill : PrimarySkillType.getCoreRootSkills()) {
|
||||||
skillLevelValues.put(rootSkill, AdvancedConfig.getInstance().getStartingLevel());
|
skillLevelValues.put(rootSkill, AdvancedConfig.getInstance().getStartingLevel());
|
||||||
skillExperienceValues.put(rootSkill, 0F);
|
skillExperienceValues.put(rootSkill, 0F);
|
||||||
}
|
}
|
||||||
@ -112,8 +112,8 @@ public class PersistentPlayerData implements MMOPlayerData {
|
|||||||
public PersistentPlayerData(@NotNull UUID playerUUID,
|
public PersistentPlayerData(@NotNull UUID playerUUID,
|
||||||
@NotNull String playerName,
|
@NotNull String playerName,
|
||||||
boolean partyChatSpying,
|
boolean partyChatSpying,
|
||||||
@NotNull Map<RootSkill, Integer> skillLevelValues,
|
@NotNull Map<PrimarySkillType, Integer> skillLevelValues,
|
||||||
@NotNull Map<RootSkill, Float> skillExperienceValues,
|
@NotNull Map<PrimarySkillType, Float> skillExperienceValues,
|
||||||
@NotNull Map<SuperSkill, Integer> abilityDeactivationTimestamps,
|
@NotNull Map<SuperSkill, Integer> abilityDeactivationTimestamps,
|
||||||
@NotNull Map<UniqueDataType, Integer> uniquePlayerData,
|
@NotNull Map<UniqueDataType, Integer> uniquePlayerData,
|
||||||
@NotNull Map<RootSkill, SkillBossBarState> barStateMap,
|
@NotNull Map<RootSkill, SkillBossBarState> barStateMap,
|
||||||
@ -286,12 +286,12 @@ public class PersistentPlayerData implements MMOPlayerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull DirtyMap<RootSkill, Integer> getDirtySkillLevelMap() {
|
public @NotNull DirtyMap<PrimarySkillType, Integer> getDirtySkillLevelMap() {
|
||||||
return skillLevelValues;
|
return skillLevelValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull DirtyMap<RootSkill, Float> getDirtyExperienceValueMap() {
|
public @NotNull DirtyMap<PrimarySkillType, Float> getDirtyExperienceValueMap() {
|
||||||
return skillExperienceValues;
|
return skillExperienceValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,12 +301,12 @@ public class PersistentPlayerData implements MMOPlayerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Map<RootSkill, Integer> getSkillLevelsMap() {
|
public @NotNull Map<PrimarySkillType, Integer> getSkillLevelsMap() {
|
||||||
return skillLevelValues;
|
return skillLevelValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Map<RootSkill, Float> getSkillsExperienceMap() {
|
public @NotNull Map<PrimarySkillType, Float> getSkillsExperienceMap() {
|
||||||
return skillExperienceValues;
|
return skillExperienceValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,12 +346,12 @@ public class PersistentPlayerData implements MMOPlayerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ImmutableMap<RootSkill, Integer> copyPrimarySkillLevelsMap() {
|
public @NotNull ImmutableMap<PrimarySkillType, Integer> copyPrimarySkillLevelsMap() {
|
||||||
return ImmutableMap.copyOf(getSkillLevelsMap());
|
return ImmutableMap.copyOf(getSkillLevelsMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ImmutableMap<RootSkill, Float> copyPrimarySkillExperienceValuesMap() {
|
public @NotNull ImmutableMap<PrimarySkillType, Float> copyPrimarySkillExperienceValuesMap() {
|
||||||
return ImmutableMap.copyOf(getSkillsExperienceMap());
|
return ImmutableMap.copyOf(getSkillsExperienceMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,12 @@
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// private void registerCoreSkills() {
|
// private void registerCoreSkills() {
|
||||||
// for(CoreRootSkill coreRootSkill : CoreSkills.getCoreRootSkills()) {
|
// for(CoreRootSkill coreRootSkill : PrimarySkillType.getCoreRootSkills()) {
|
||||||
// mcMMO.p.getLogger().info("Registering core skill: " + coreRootSkill.getRawSkillName());
|
// mcMMO.p.getLogger().info("Registering core skill: " + coreRootSkill.getRawSkillName());
|
||||||
// registerSkill(coreRootSkill);
|
// registerSkill(coreRootSkill);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// for(CoreSkill coreSkill : CoreSkills.)
|
// for(CoreSkill coreSkill : PrimarySkillType.)
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -92,7 +92,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
|||||||
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
|
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ScoreboardManager.showTopScoreboard((Player) sender, CoreSkills.getSkill(rootSkill), page, userStats);
|
ScoreboardManager.showTopScoreboard((Player) sender, PrimarySkillType.getSkill(rootSkill), page, userStats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,21 @@ public class FamilyTree {
|
|||||||
private static @Nullable Set<RootSkill> salvageParents;
|
private static @Nullable Set<RootSkill> salvageParents;
|
||||||
|
|
||||||
public static @NotNull Set<RootSkill> getParentSkills(@NotNull RootSkill rootSkill) throws UnknownSkillException {
|
public static @NotNull Set<RootSkill> getParentSkills(@NotNull RootSkill rootSkill) throws UnknownSkillException {
|
||||||
if(CoreSkills.isChildSkill(rootSkill)) {
|
if(PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
if(smeltingParents == null || salvageParents == null) {
|
if(smeltingParents == null || salvageParents == null) {
|
||||||
smeltingParents = new HashSet<>();
|
smeltingParents = new HashSet<>();
|
||||||
salvageParents = new HashSet<>();
|
salvageParents = new HashSet<>();
|
||||||
|
|
||||||
smeltingParents.add(CoreSkills.MINING);
|
smeltingParents.add(PrimarySkillType.MINING);
|
||||||
smeltingParents.add(CoreSkills.REPAIR);
|
smeltingParents.add(PrimarySkillType.REPAIR);
|
||||||
|
|
||||||
salvageParents.add(CoreSkills.FISHING);
|
salvageParents.add(PrimarySkillType.FISHING);
|
||||||
salvageParents.add(CoreSkills.REPAIR);
|
salvageParents.add(PrimarySkillType.REPAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rootSkill.equals(CoreSkills.SALVAGE)) {
|
if(rootSkill.equals(PrimarySkillType.SALVAGE)) {
|
||||||
return salvageParents;
|
return salvageParents;
|
||||||
} else if (rootSkill.equals(CoreSkills.SMELTING)) {
|
} else if (rootSkill.equals(PrimarySkillType.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());
|
||||||
|
@ -182,9 +182,9 @@ public class MMOExperienceBarManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setBarStateDefaults(@NotNull Map<RootSkill, SkillBossBarState> barStateHashMap) {
|
public static void setBarStateDefaults(@NotNull Map<RootSkill, SkillBossBarState> barStateHashMap) {
|
||||||
for(RootSkill rootSkill : CoreSkills.getCoreRootSkills()) {
|
for(RootSkill rootSkill : PrimarySkillType.getCoreRootSkills()) {
|
||||||
|
|
||||||
if(CoreSkills.isChildSkill(rootSkill)) {
|
if(PrimarySkillType.isChildSkill(rootSkill)) {
|
||||||
barStateHashMap.put(rootSkill, SkillBossBarState.DISABLED);
|
barStateHashMap.put(rootSkill, SkillBossBarState.DISABLED);
|
||||||
} else {
|
} else {
|
||||||
barStateHashMap.put(rootSkill, SkillBossBarState.NORMAL);
|
barStateHashMap.put(rootSkill, SkillBossBarState.NORMAL);
|
||||||
|
@ -170,7 +170,7 @@ public class NotificationManager {
|
|||||||
|
|
||||||
McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
||||||
|
|
||||||
Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(CoreSkills.getSkill(rootSkill), levelsGained, newLevel);
|
Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(PrimarySkillType.getSkill(rootSkill), levelsGained, newLevel);
|
||||||
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(Misc.adaptPlayer(mmoPlayer), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(Misc.adaptPlayer(mmoPlayer), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
|
||||||
|
|
||||||
sendNotification(Misc.adaptPlayer(mmoPlayer), customEvent);
|
sendNotification(Misc.adaptPlayer(mmoPlayer), customEvent);
|
||||||
|
@ -489,7 +489,7 @@ public class TextComponentFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull RootSkill rootSkill) {
|
public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull RootSkill rootSkill) {
|
||||||
return getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.getSkill(rootSkill));
|
return getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user