API migration on DBs

This commit is contained in:
nossr50 2020-12-23 11:08:57 -08:00
parent 8a507de8d6
commit 843e3ace99
5 changed files with 160 additions and 163 deletions

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.database; package com.gmail.nossr50.database;
import com.gmail.nossr50.datatypes.player.PersistentPlayerDataBuilder; import com.gmail.nossr50.datatypes.player.MMODataBuilder;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.exceptions.ProfileRetrievalException; import com.neetgames.mcmmo.exceptions.ProfileRetrievalException;
@ -25,9 +25,9 @@ public abstract class AbstractDatabaseManager implements DatabaseManager {
//TODO: have this use the PersistentPlayerData object created below to initialize defaults //TODO: have this use the PersistentPlayerData object created below to initialize defaults
insertNewUser(player.getName(), player.getUniqueId()); insertNewUser(player.getName(), player.getUniqueId());
//Construct player data object //Construct player data object
PersistentPlayerDataBuilder persistentPlayerDataBuilder = new PersistentPlayerDataBuilder(); MMODataBuilder MMODataBuilder = new MMODataBuilder();
//Return player profile //Return player profile
return new PlayerProfile(persistentPlayerDataBuilder.buildNewPlayerData(player.getUniqueId(), player.getName())); return new PlayerProfile(MMODataBuilder.buildNewPlayerData(player.getUniqueId(), player.getName()));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -6,6 +6,7 @@ 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;
@ -18,7 +19,11 @@ import com.google.common.collect.ImmutableMap;
import com.neetgames.mcmmo.MobHealthBarType; import com.neetgames.mcmmo.MobHealthBarType;
import com.neetgames.mcmmo.UniqueDataType; import com.neetgames.mcmmo.UniqueDataType;
import com.neetgames.mcmmo.exceptions.ProfileRetrievalException; import com.neetgames.mcmmo.exceptions.ProfileRetrievalException;
import com.neetgames.mcmmo.player.MMOPlayerData;
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;
@ -66,7 +71,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<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); Map<RootSkill, Integer> skills = getSkillMapFromLine(character);
boolean powerless = true; boolean powerless = true;
for (int skill : skills.values()) { for (int skill : skills.values()) {
@ -325,32 +330,32 @@ 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<PrimarySkillType, Integer> primarySkillLevelMap = mmoDataSnapshot.getSkillLevelValues(); ImmutableMap<RootSkill, Integer> primarySkillLevelMap = mmoDataSnapshot.getSkillLevelValues();
ImmutableMap<PrimarySkillType, Float> primarySkillExperienceValueMap = mmoDataSnapshot.getSkillExperienceValues(); ImmutableMap<RootSkill, Float> primarySkillExperienceValueMap = mmoDataSnapshot.getSkillExperienceValues();
writer.append(playerName).append(":"); writer.append(playerName).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.MINING)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.MINING_CS)).append(":");
writer.append(":"); writer.append(":");
writer.append(":"); writer.append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.MINING)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.MINING_CS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.WOODCUTTING)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.WOODCUTTING_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.WOODCUTTING)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.WOODCUTTING_CS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.REPAIR)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.REPAIR_CS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.UNARMED)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.UNARMED_CS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.HERBALISM)).append(":"); writer.append(primarySkillLevelMap.get(PrimarySkillType.HERBALISM)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.EXCAVATION)).append(":"); writer.append(primarySkillLevelMap.get(PrimarySkillType.EXCAVATION)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.ARCHERY)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.ARCHERY_CS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.SWORDS)).append(":"); writer.append(primarySkillLevelMap.get(PrimarySkillType.SWORDS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.AXES)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.AXES_CS)).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.ACROBATICS)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.ACROBATICS_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.REPAIR)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.REPAIR_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.UNARMED)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.UNARMED_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.HERBALISM)).append(":"); writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.HERBALISM)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.EXCAVATION)).append(":"); writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.EXCAVATION)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.ARCHERY)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.ARCHERY_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.SWORDS)).append(":"); writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.SWORDS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.AXES)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.AXES_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.ACROBATICS)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.ACROBATICS_CS)).append(":");
writer.append(":"); writer.append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.TAMING)).append(":"); writer.append(primarySkillLevelMap.get(PrimarySkillType.TAMING)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.TAMING)).append(":"); writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.TAMING)).append(":");
@ -362,16 +367,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(PrimarySkillType.FISHING)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.FISHING_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.FISHING)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.FISHING_CS)).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(); MobHealthBarType mobHealthbarType = mmoDataSnapshot.getMobHealthBarType();
writer.append(mobHealthbarType.toString()).append(":"); writer.append(mobHealthbarType.toString()).append(":");
writer.append(primarySkillLevelMap.get(PrimarySkillType.ALCHEMY)).append(":"); writer.append(primarySkillLevelMap.get(CoreSkills.ALCHEMY_CS)).append(":");
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.ALCHEMY)).append(":"); writer.append(primarySkillExperienceValueMap.get(CoreSkills.ALCHEMY_CS)).append(":");
writer.append(uuid != null ? uuid.toString() : "NULL").append(":"); writer.append(uuid != null ? uuid.toString() : "NULL").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(":");
@ -406,21 +411,21 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.CROSSBOWS)).append(":"); writer.append(primarySkillExperienceValueMap.get(PrimarySkillType.CROSSBOWS)).append(":");
//XPBar States //XPBar States
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.ACROBATICS).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.ACROBATICS_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.ALCHEMY).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.ALCHEMY_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.ARCHERY).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.ARCHERY_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.AXES).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.AXES_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.EXCAVATION).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.EXCAVATION).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.FISHING).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.FISHING_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.HERBALISM).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.HERBALISM).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.MINING).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.MINING_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.REPAIR).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.REPAIR_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SALVAGE).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SALVAGE).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SMELTING).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SMELTING).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SWORDS).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.SWORDS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.TAMING).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.TAMING).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.UNARMED).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.UNARMED_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.WOODCUTTING).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(CoreSkills.WOODCUTTING_CS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.TRIDENTS).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.TRIDENTS).toString()).append(":");
writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.CROSSBOWS).toString()).append(":"); writer.append(mmoDataSnapshot.getBarStateMap().get(PrimarySkillType.CROSSBOWS).toString()).append(":");
@ -562,7 +567,8 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
} }
} }
public @Nullable PlayerProfile queryPlayerDataByName(@NotNull String playerName) { @Override
public @Nullable MMOPlayerData queryPlayerByName(@NotNull String playerName) throws ProfileRetrievalException {
BufferedReader bufferedReader = null; BufferedReader bufferedReader = null;
String usersFilePath = mcMMO.getUsersFilePath(); String usersFilePath = mcMMO.getUsersFilePath();
@ -610,7 +616,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
return null; return null;
} }
public @Nullable PlayerProfile queryPlayerDataByPlayer(@NotNull Player player) throws ProfileRetrievalException, NullArgumentException { public @Nullable MMOPlayerData queryPlayerDataByPlayer(@NotNull Player player) throws ProfileRetrievalException, NullArgumentException {
return queryPlayerDataByUUID(player.getUniqueId(), player.getName()); return queryPlayerDataByUUID(player.getUniqueId(), player.getName());
} }
@ -624,7 +630,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
* @throws ProfileRetrievalException * @throws ProfileRetrievalException
* @throws NullArgumentException * @throws NullArgumentException
*/ */
public @Nullable PlayerProfile queryPlayerDataByUUID(@NotNull UUID uuid, @NotNull String playerName) throws ProfileRetrievalException, NullArgumentException { public @Nullable MMOPlayerData queryPlayerDataByUUID(@NotNull UUID uuid, @NotNull String playerName) throws ProfileRetrievalException, NullArgumentException {
BufferedReader bufferedReader = null; BufferedReader bufferedReader = null;
String usersFilePath = mcMMO.getUsersFilePath(); String usersFilePath = mcMMO.getUsersFilePath();
@ -800,19 +806,19 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(data); Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(data);
powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkillType.ACROBATICS)); powerLevel += putStat(acrobatics, playerName, skills.get(CoreSkills.ACROBATICS_CS));
powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkillType.ALCHEMY)); powerLevel += putStat(alchemy, playerName, skills.get(CoreSkills.ALCHEMY_CS));
powerLevel += putStat(archery, playerName, skills.get(PrimarySkillType.ARCHERY)); powerLevel += putStat(archery, playerName, skills.get(CoreSkills.ARCHERY_CS));
powerLevel += putStat(axes, playerName, skills.get(PrimarySkillType.AXES)); powerLevel += putStat(axes, playerName, skills.get(CoreSkills.AXES_CS));
powerLevel += putStat(excavation, playerName, skills.get(PrimarySkillType.EXCAVATION)); powerLevel += putStat(excavation, playerName, skills.get(PrimarySkillType.EXCAVATION));
powerLevel += putStat(fishing, playerName, skills.get(PrimarySkillType.FISHING)); powerLevel += putStat(fishing, playerName, skills.get(CoreSkills.FISHING_CS));
powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkillType.HERBALISM)); powerLevel += putStat(herbalism, playerName, skills.get(PrimarySkillType.HERBALISM));
powerLevel += putStat(mining, playerName, skills.get(PrimarySkillType.MINING)); powerLevel += putStat(mining, playerName, skills.get(CoreSkills.MINING_CS));
powerLevel += putStat(repair, playerName, skills.get(PrimarySkillType.REPAIR)); powerLevel += putStat(repair, playerName, skills.get(CoreSkills.REPAIR_CS));
powerLevel += putStat(swords, playerName, skills.get(PrimarySkillType.SWORDS)); powerLevel += putStat(swords, playerName, skills.get(PrimarySkillType.SWORDS));
powerLevel += putStat(taming, playerName, skills.get(PrimarySkillType.TAMING)); powerLevel += putStat(taming, playerName, skills.get(PrimarySkillType.TAMING));
powerLevel += putStat(unarmed, playerName, skills.get(PrimarySkillType.UNARMED)); powerLevel += putStat(unarmed, playerName, skills.get(CoreSkills.UNARMED_CS));
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.WOODCUTTING)); powerLevel += putStat(woodcutting, playerName, skills.get(CoreSkills.WOODCUTTING_CS));
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.CROSSBOWS)); powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.CROSSBOWS));
powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.TRIDENTS)); powerLevel += putStat(woodcutting, playerName, skills.get(PrimarySkillType.TRIDENTS));
@ -851,19 +857,19 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
alchemy.sort(c); alchemy.sort(c);
powerLevels.sort(c); powerLevels.sort(c);
playerStatHash.put(PrimarySkillType.MINING, mining); playerStatHash.put(CoreSkills.MINING_CS, mining);
playerStatHash.put(PrimarySkillType.WOODCUTTING, woodcutting); playerStatHash.put(CoreSkills.WOODCUTTING_CS, woodcutting);
playerStatHash.put(PrimarySkillType.REPAIR, repair); playerStatHash.put(CoreSkills.REPAIR_CS, repair);
playerStatHash.put(PrimarySkillType.UNARMED, unarmed); playerStatHash.put(CoreSkills.UNARMED_CS, unarmed);
playerStatHash.put(PrimarySkillType.HERBALISM, herbalism); playerStatHash.put(PrimarySkillType.HERBALISM, herbalism);
playerStatHash.put(PrimarySkillType.EXCAVATION, excavation); playerStatHash.put(PrimarySkillType.EXCAVATION, excavation);
playerStatHash.put(PrimarySkillType.ARCHERY, archery); playerStatHash.put(CoreSkills.ARCHERY_CS, archery);
playerStatHash.put(PrimarySkillType.SWORDS, swords); playerStatHash.put(PrimarySkillType.SWORDS, swords);
playerStatHash.put(PrimarySkillType.AXES, axes); playerStatHash.put(CoreSkills.AXES_CS, axes);
playerStatHash.put(PrimarySkillType.ACROBATICS, acrobatics); playerStatHash.put(CoreSkills.ACROBATICS_CS, acrobatics);
playerStatHash.put(PrimarySkillType.TAMING, taming); playerStatHash.put(PrimarySkillType.TAMING, taming);
playerStatHash.put(PrimarySkillType.FISHING, fishing); playerStatHash.put(CoreSkills.FISHING_CS, fishing);
playerStatHash.put(PrimarySkillType.ALCHEMY, alchemy); playerStatHash.put(CoreSkills.ALCHEMY_CS, alchemy);
} }
/** /**
@ -1263,30 +1269,30 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
} }
} }
private @Nullable PlayerProfile loadFromLine(@NotNull String[] dataStrSplit) { private @Nullable MMOPlayerData loadFromLine(@NotNull String[] dataStrSplit) {
PersistentPlayerDataBuilder playerDataBuilder = new PersistentPlayerDataBuilder(); MMODataBuilder playerDataBuilder = new MMODataBuilder();
EnumMap<PrimarySkillType, Integer> skillLevelMap = getSkillMapFromLine(dataStrSplit); // Skill levels HashMap<RootSkill, Integer> skillLevelMap = getSkillMapFromLine(dataStrSplit); // Skill levels
EnumMap<PrimarySkillType, Float> skillExperienceValueMap = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP HashMap<RootSkill, Float> skillExperienceValueMap = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
EnumMap<SuperAbilityType, Integer> skillAbilityDeactivationTimeStamp = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown HashMap<SuperSkill, Integer> skillAbilityDeactivationTimeStamp = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
EnumMap<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); EnumMap<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class);
EnumMap<PrimarySkillType, SkillBossBarState> xpBarStateMap = new EnumMap<PrimarySkillType, SkillBossBarState>(PrimarySkillType.class); HashMap<RootSkill, SkillBossBarState> xpBarStateMap = new EnumMap<PrimarySkillType, SkillBossBarState>(PrimarySkillType.class);
// MobHealthBarType mobHealthbarType; // MobHealthBarType mobHealthbarType;
int scoreboardTipsShown; int scoreboardTipsShown;
skillExperienceValueMap.put(PrimarySkillType.TAMING, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_TAMING])); skillExperienceValueMap.put(PrimarySkillType.TAMING, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_TAMING]));
skillExperienceValueMap.put(PrimarySkillType.MINING, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_MINING])); skillExperienceValueMap.put(CoreSkills.MINING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_MINING]));
skillExperienceValueMap.put(PrimarySkillType.REPAIR, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_REPAIR])); skillExperienceValueMap.put(CoreSkills.REPAIR_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_REPAIR]));
skillExperienceValueMap.put(PrimarySkillType.WOODCUTTING, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_WOODCUTTING])); skillExperienceValueMap.put(CoreSkills.WOODCUTTING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_WOODCUTTING]));
skillExperienceValueMap.put(PrimarySkillType.UNARMED, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_UNARMED])); skillExperienceValueMap.put(CoreSkills.UNARMED_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_UNARMED]));
skillExperienceValueMap.put(PrimarySkillType.HERBALISM, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_HERBALISM])); skillExperienceValueMap.put(PrimarySkillType.HERBALISM, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_HERBALISM]));
skillExperienceValueMap.put(PrimarySkillType.EXCAVATION, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_EXCAVATION])); skillExperienceValueMap.put(PrimarySkillType.EXCAVATION, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_EXCAVATION]));
skillExperienceValueMap.put(PrimarySkillType.ARCHERY, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ARCHERY])); skillExperienceValueMap.put(CoreSkills.ARCHERY_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ARCHERY]));
skillExperienceValueMap.put(PrimarySkillType.SWORDS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_SWORDS])); skillExperienceValueMap.put(PrimarySkillType.SWORDS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_SWORDS]));
skillExperienceValueMap.put(PrimarySkillType.AXES, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_AXES])); skillExperienceValueMap.put(CoreSkills.AXES_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_AXES]));
skillExperienceValueMap.put(PrimarySkillType.ACROBATICS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ACROBATICS])); skillExperienceValueMap.put(CoreSkills.ACROBATICS_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ACROBATICS]));
skillExperienceValueMap.put(PrimarySkillType.FISHING, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_FISHING])); skillExperienceValueMap.put(CoreSkills.FISHING_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_FISHING]));
skillExperienceValueMap.put(PrimarySkillType.ALCHEMY, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ALCHEMY])); skillExperienceValueMap.put(CoreSkills.ALCHEMY_CS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_ALCHEMY]));
skillExperienceValueMap.put(PrimarySkillType.TRIDENTS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_TRIDENTS])); skillExperienceValueMap.put(PrimarySkillType.TRIDENTS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_TRIDENTS]));
skillExperienceValueMap.put(PrimarySkillType.CROSSBOWS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_CROSSBOWS])); skillExperienceValueMap.put(PrimarySkillType.CROSSBOWS, (float) Integer.parseInt(dataStrSplit[FlatFileMappings.EXP_CROSSBOWS]));
@ -1343,31 +1349,28 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
} }
try { try {
xpBarStateMap.put(PrimarySkillType.ACROBATICS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ACROBATICS])); xpBarStateMap.put(CoreSkills.ACROBATICS_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ACROBATICS]));
xpBarStateMap.put(PrimarySkillType.ALCHEMY, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ALCHEMY])); xpBarStateMap.put(CoreSkills.ALCHEMY_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ALCHEMY]));
xpBarStateMap.put(PrimarySkillType.ARCHERY, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ARCHERY])); xpBarStateMap.put(CoreSkills.ARCHERY_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_ARCHERY]));
xpBarStateMap.put(PrimarySkillType.AXES, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_AXES])); xpBarStateMap.put(CoreSkills.AXES_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_AXES]));
xpBarStateMap.put(PrimarySkillType.EXCAVATION, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_EXCAVATION])); xpBarStateMap.put(PrimarySkillType.EXCAVATION, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_EXCAVATION]));
xpBarStateMap.put(PrimarySkillType.FISHING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_FISHING])); xpBarStateMap.put(CoreSkills.FISHING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_FISHING]));
xpBarStateMap.put(PrimarySkillType.HERBALISM, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_HERBALISM])); xpBarStateMap.put(PrimarySkillType.HERBALISM, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_HERBALISM]));
xpBarStateMap.put(PrimarySkillType.MINING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_MINING])); xpBarStateMap.put(CoreSkills.MINING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_MINING]));
xpBarStateMap.put(PrimarySkillType.REPAIR, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_REPAIR])); xpBarStateMap.put(CoreSkills.REPAIR_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_REPAIR]));
xpBarStateMap.put(PrimarySkillType.SALVAGE, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SALVAGE])); xpBarStateMap.put(PrimarySkillType.SALVAGE, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SALVAGE]));
xpBarStateMap.put(PrimarySkillType.SMELTING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SMELTING])); xpBarStateMap.put(PrimarySkillType.SMELTING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SMELTING]));
xpBarStateMap.put(PrimarySkillType.SWORDS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SWORDS])); xpBarStateMap.put(PrimarySkillType.SWORDS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_SWORDS]));
xpBarStateMap.put(PrimarySkillType.TAMING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TAMING])); xpBarStateMap.put(PrimarySkillType.TAMING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TAMING]));
xpBarStateMap.put(PrimarySkillType.UNARMED, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_UNARMED])); xpBarStateMap.put(CoreSkills.UNARMED_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_UNARMED]));
xpBarStateMap.put(PrimarySkillType.WOODCUTTING, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_WOODCUTTING])); xpBarStateMap.put(CoreSkills.WOODCUTTING_CS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_WOODCUTTING]));
xpBarStateMap.put(PrimarySkillType.TRIDENTS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TRIDENTS])); xpBarStateMap.put(PrimarySkillType.TRIDENTS, SkillUtils.asBarState(dataStrSplit[FlatFileMappings.BARSTATE_TRIDENTS]));
xpBarStateMap.put(PrimarySkillType.CROSSBOWS, 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;
PersistentPlayerData persistentPlayerData;
try { try {
//Set Player Data //Set Player Data
@ -1381,8 +1384,7 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
.setBarStateMap(xpBarStateMap); .setBarStateMap(xpBarStateMap);
//Build Data //Build Data
persistentPlayerData = playerDataBuilder.build(); return playerDataBuilder.build();
return new PlayerProfile(persistentPlayerData);
} catch (Exception e) { } catch (Exception e) {
mcMMO.p.getLogger().severe("Critical failure when trying to construct persistent player data!"); mcMMO.p.getLogger().severe("Critical failure when trying to construct persistent player data!");
e.printStackTrace(); e.printStackTrace();
@ -1390,24 +1392,25 @@ public final class FlatFileDatabaseManager extends AbstractDatabaseManager {
} }
} }
private EnumMap<PrimarySkillType, Integer> getSkillMapFromLine(String[] stringDataArray) { //TODO: Add tests
EnumMap<PrimarySkillType, Integer> skillLevelsMap = new EnumMap<>(PrimarySkillType.class); // Skill & Level private @NotNull Map<RootSkill, Integer> getSkillMapFromLine(@NotNull String[] stringDataArray) {
HashMap<RootSkill, Integer> skillLevelsMap = new HashMap<>(); // Skill & Level
skillLevelsMap.put(PrimarySkillType.TAMING, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_TAMING])); skillLevelsMap.put(CoreSkills.TAMING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_TAMING]));
skillLevelsMap.put(PrimarySkillType.MINING, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_MINING])); skillLevelsMap.put(CoreSkills.MINING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_MINING]));
skillLevelsMap.put(PrimarySkillType.REPAIR, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_REPAIR])); skillLevelsMap.put(CoreSkills.REPAIR_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_REPAIR]));
skillLevelsMap.put(PrimarySkillType.WOODCUTTING, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_WOODCUTTING])); skillLevelsMap.put(CoreSkills.WOODCUTTING_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_WOODCUTTING]));
skillLevelsMap.put(PrimarySkillType.UNARMED, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_UNARMED])); skillLevelsMap.put(CoreSkills.UNARMED_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_UNARMED]));
skillLevelsMap.put(PrimarySkillType.HERBALISM, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_HERBALISM])); skillLevelsMap.put(CoreSkills.HERBALISM_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_HERBALISM]));
skillLevelsMap.put(PrimarySkillType.EXCAVATION, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_EXCAVATION])); skillLevelsMap.put(CoreSkills.EXCAVATION_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_EXCAVATION]));
skillLevelsMap.put(PrimarySkillType.ARCHERY, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ARCHERY])); skillLevelsMap.put(CoreSkills.ARCHERY_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ARCHERY]));
skillLevelsMap.put(PrimarySkillType.SWORDS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_SWORDS])); skillLevelsMap.put(CoreSkills.SWORDS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_SWORDS]));
skillLevelsMap.put(PrimarySkillType.AXES, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_AXES])); skillLevelsMap.put(CoreSkills.AXES_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_AXES]));
skillLevelsMap.put(PrimarySkillType.ACROBATICS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ACROBATICS])); skillLevelsMap.put(CoreSkills.ACROBATICS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ACROBATICS]));
skillLevelsMap.put(PrimarySkillType.FISHING, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_FISHING])); skillLevelsMap.put(CoreSkills.FISHING_CS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_FISHING]));
skillLevelsMap.put(PrimarySkillType.ALCHEMY, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ALCHEMY])); skillLevelsMap.put(CoreSkills.ALCHEMY_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_ALCHEMY]));
skillLevelsMap.put(PrimarySkillType.TRIDENTS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_TRIDENTS])); skillLevelsMap.put(CoreSkills.TRIDENTS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_TRIDENTS]));
skillLevelsMap.put(PrimarySkillType.CROSSBOWS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_CROSSBOWS])); skillLevelsMap.put(CoreSkills.CROSSBOWS_CS, Integer.valueOf(stringDataArray[FlatFileMappings.SKILLS_CROSSBOWS]));
return skillLevelsMap; return skillLevelsMap;
} }

View File

@ -5,6 +5,7 @@ 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;
@ -258,17 +259,17 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
+ ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, total = ? WHERE user_id = ?"); + ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, total = ? WHERE user_id = ?");
statement.setInt(1, dataSnapshot.getSkillLevel(PrimarySkillType.TAMING)); statement.setInt(1, dataSnapshot.getSkillLevel(PrimarySkillType.TAMING));
statement.setInt(2, dataSnapshot.getSkillLevel(PrimarySkillType.MINING)); statement.setInt(2, dataSnapshot.getSkillLevel(PrimarySkillType.MINING));
statement.setInt(3, dataSnapshot.getSkillLevel(PrimarySkillType.REPAIR)); statement.setInt(3, dataSnapshot.getSkillLevel(CoreSkills.REPAIR_CS));
statement.setInt(4, dataSnapshot.getSkillLevel(PrimarySkillType.WOODCUTTING)); statement.setInt(4, dataSnapshot.getSkillLevel(CoreSkills.WOODCUTTING_CS));
statement.setInt(5, dataSnapshot.getSkillLevel(PrimarySkillType.UNARMED)); statement.setInt(5, dataSnapshot.getSkillLevel(CoreSkills.UNARMED_CS));
statement.setInt(6, dataSnapshot.getSkillLevel(PrimarySkillType.HERBALISM)); statement.setInt(6, dataSnapshot.getSkillLevel(PrimarySkillType.HERBALISM));
statement.setInt(7, dataSnapshot.getSkillLevel(PrimarySkillType.EXCAVATION)); statement.setInt(7, dataSnapshot.getSkillLevel(PrimarySkillType.EXCAVATION));
statement.setInt(8, dataSnapshot.getSkillLevel(PrimarySkillType.ARCHERY)); statement.setInt(8, dataSnapshot.getSkillLevel(PrimarySkillType.ARCHERY));
statement.setInt(9, dataSnapshot.getSkillLevel(PrimarySkillType.SWORDS)); statement.setInt(9, dataSnapshot.getSkillLevel(PrimarySkillType.SWORDS));
statement.setInt(10, dataSnapshot.getSkillLevel(PrimarySkillType.AXES)); statement.setInt(10, dataSnapshot.getSkillLevel(CoreSkills.AXES_CS));
statement.setInt(11, dataSnapshot.getSkillLevel(PrimarySkillType.ACROBATICS)); statement.setInt(11, dataSnapshot.getSkillLevel(CoreSkills.ACROBATICS_CS));
statement.setInt(12, dataSnapshot.getSkillLevel(PrimarySkillType.FISHING)); statement.setInt(12, dataSnapshot.getSkillLevel(PrimarySkillType.FISHING));
statement.setInt(13, dataSnapshot.getSkillLevel(PrimarySkillType.ALCHEMY)); statement.setInt(13, dataSnapshot.getSkillLevel(CoreSkills.ALCHEMY_CS));
statement.setInt(14, dataSnapshot.getSkillLevel(PrimarySkillType.TRIDENTS)); statement.setInt(14, dataSnapshot.getSkillLevel(PrimarySkillType.TRIDENTS));
statement.setInt(15, dataSnapshot.getSkillLevel(PrimarySkillType.CROSSBOWS)); statement.setInt(15, dataSnapshot.getSkillLevel(PrimarySkillType.CROSSBOWS));
int total = 0; int total = 0;
@ -290,17 +291,17 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
+ ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, WHERE user_id = ?"); + ", fishing = ?, alchemy = ?, tridents = ?, crossbows = ?, WHERE user_id = ?");
statement.setInt(1, dataSnapshot.getSkillXpLevel(PrimarySkillType.TAMING)); statement.setInt(1, dataSnapshot.getSkillXpLevel(PrimarySkillType.TAMING));
statement.setInt(2, dataSnapshot.getSkillXpLevel(PrimarySkillType.MINING)); statement.setInt(2, dataSnapshot.getSkillXpLevel(PrimarySkillType.MINING));
statement.setInt(3, dataSnapshot.getSkillXpLevel(PrimarySkillType.REPAIR)); statement.setInt(3, dataSnapshot.getSkillXpLevel(CoreSkills.REPAIR_CS));
statement.setInt(4, dataSnapshot.getSkillXpLevel(PrimarySkillType.WOODCUTTING)); statement.setInt(4, dataSnapshot.getSkillXpLevel(CoreSkills.WOODCUTTING_CS));
statement.setInt(5, dataSnapshot.getSkillXpLevel(PrimarySkillType.UNARMED)); statement.setInt(5, dataSnapshot.getSkillXpLevel(CoreSkills.UNARMED_CS));
statement.setInt(6, dataSnapshot.getSkillXpLevel(PrimarySkillType.HERBALISM)); statement.setInt(6, dataSnapshot.getSkillXpLevel(PrimarySkillType.HERBALISM));
statement.setInt(7, dataSnapshot.getSkillXpLevel(PrimarySkillType.EXCAVATION)); statement.setInt(7, dataSnapshot.getSkillXpLevel(PrimarySkillType.EXCAVATION));
statement.setInt(8, dataSnapshot.getSkillXpLevel(PrimarySkillType.ARCHERY)); statement.setInt(8, dataSnapshot.getSkillXpLevel(PrimarySkillType.ARCHERY));
statement.setInt(9, dataSnapshot.getSkillXpLevel(PrimarySkillType.SWORDS)); statement.setInt(9, dataSnapshot.getSkillXpLevel(PrimarySkillType.SWORDS));
statement.setInt(10, dataSnapshot.getSkillXpLevel(PrimarySkillType.AXES)); statement.setInt(10, dataSnapshot.getSkillXpLevel(CoreSkills.AXES_CS));
statement.setInt(11, dataSnapshot.getSkillXpLevel(PrimarySkillType.ACROBATICS)); statement.setInt(11, dataSnapshot.getSkillXpLevel(CoreSkills.ACROBATICS_CS));
statement.setInt(12, dataSnapshot.getSkillXpLevel(PrimarySkillType.FISHING)); statement.setInt(12, dataSnapshot.getSkillXpLevel(PrimarySkillType.FISHING));
statement.setInt(13, dataSnapshot.getSkillXpLevel(PrimarySkillType.ALCHEMY)); statement.setInt(13, dataSnapshot.getSkillXpLevel(CoreSkills.ALCHEMY_CS));
statement.setInt(14, dataSnapshot.getSkillXpLevel(PrimarySkillType.TRIDENTS)); statement.setInt(14, dataSnapshot.getSkillXpLevel(PrimarySkillType.TRIDENTS));
statement.setInt(15, dataSnapshot.getSkillXpLevel(PrimarySkillType.CROSSBOWS)); statement.setInt(15, dataSnapshot.getSkillXpLevel(PrimarySkillType.CROSSBOWS));
statement.setInt(16, id); statement.setInt(16, id);
@ -355,17 +356,17 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
+ ", 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(PrimarySkillType.TAMING).toString()); statement.setString(1, dataSnapshot.getBarStateMap().get(PrimarySkillType.TAMING).toString());
statement.setString(2, dataSnapshot.getBarStateMap().get(PrimarySkillType.MINING).toString()); statement.setString(2, dataSnapshot.getBarStateMap().get(PrimarySkillType.MINING).toString());
statement.setString(3, dataSnapshot.getBarStateMap().get(PrimarySkillType.REPAIR).toString()); statement.setString(3, dataSnapshot.getBarStateMap().get(CoreSkills.REPAIR_CS).toString());
statement.setString(4, dataSnapshot.getBarStateMap().get(PrimarySkillType.WOODCUTTING).toString()); statement.setString(4, dataSnapshot.getBarStateMap().get(CoreSkills.WOODCUTTING_CS).toString());
statement.setString(5, dataSnapshot.getBarStateMap().get(PrimarySkillType.UNARMED).toString()); statement.setString(5, dataSnapshot.getBarStateMap().get(CoreSkills.UNARMED_CS).toString());
statement.setString(6, dataSnapshot.getBarStateMap().get(PrimarySkillType.HERBALISM).toString()); statement.setString(6, dataSnapshot.getBarStateMap().get(PrimarySkillType.HERBALISM).toString());
statement.setString(7, dataSnapshot.getBarStateMap().get(PrimarySkillType.EXCAVATION).toString()); statement.setString(7, dataSnapshot.getBarStateMap().get(PrimarySkillType.EXCAVATION).toString());
statement.setString(8, dataSnapshot.getBarStateMap().get(PrimarySkillType.ARCHERY).toString()); statement.setString(8, dataSnapshot.getBarStateMap().get(PrimarySkillType.ARCHERY).toString());
statement.setString(9, dataSnapshot.getBarStateMap().get(PrimarySkillType.SWORDS).toString()); statement.setString(9, dataSnapshot.getBarStateMap().get(PrimarySkillType.SWORDS).toString());
statement.setString(10, dataSnapshot.getBarStateMap().get(PrimarySkillType.AXES).toString()); statement.setString(10, dataSnapshot.getBarStateMap().get(CoreSkills.AXES_CS).toString());
statement.setString(11, dataSnapshot.getBarStateMap().get(PrimarySkillType.ACROBATICS).toString()); statement.setString(11, dataSnapshot.getBarStateMap().get(CoreSkills.ACROBATICS_CS).toString());
statement.setString(12, dataSnapshot.getBarStateMap().get(PrimarySkillType.FISHING).toString()); statement.setString(12, dataSnapshot.getBarStateMap().get(PrimarySkillType.FISHING).toString());
statement.setString(13, dataSnapshot.getBarStateMap().get(PrimarySkillType.ALCHEMY).toString()); statement.setString(13, dataSnapshot.getBarStateMap().get(CoreSkills.ALCHEMY_CS).toString());
statement.setString(14, dataSnapshot.getBarStateMap().get(PrimarySkillType.SALVAGE).toString()); statement.setString(14, dataSnapshot.getBarStateMap().get(PrimarySkillType.SALVAGE).toString());
statement.setString(15, dataSnapshot.getBarStateMap().get(PrimarySkillType.SMELTING).toString()); statement.setString(15, dataSnapshot.getBarStateMap().get(PrimarySkillType.SMELTING).toString());
statement.setString(16, dataSnapshot.getBarStateMap().get(PrimarySkillType.TRIDENTS).toString()); statement.setString(16, dataSnapshot.getBarStateMap().get(PrimarySkillType.TRIDENTS).toString());
@ -1188,7 +1189,7 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
} }
private @Nullable PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException { private @Nullable PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
PersistentPlayerDataBuilder persistentPlayerDataBuilder = new PersistentPlayerDataBuilder(); MMODataBuilder MMODataBuilder = new MMODataBuilder();
EnumMap<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level EnumMap<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level
EnumMap<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP EnumMap<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
EnumMap<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown EnumMap<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
@ -1210,33 +1211,33 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
skills.put(PrimarySkillType.TAMING, result.getInt(OFFSET_SKILLS + 1)); skills.put(PrimarySkillType.TAMING, result.getInt(OFFSET_SKILLS + 1));
skills.put(PrimarySkillType.MINING, result.getInt(OFFSET_SKILLS + 2)); skills.put(PrimarySkillType.MINING, result.getInt(OFFSET_SKILLS + 2));
skills.put(PrimarySkillType.REPAIR, result.getInt(OFFSET_SKILLS + 3)); skills.put(CoreSkills.REPAIR_CS, result.getInt(OFFSET_SKILLS + 3));
skills.put(PrimarySkillType.WOODCUTTING, result.getInt(OFFSET_SKILLS + 4)); skills.put(CoreSkills.WOODCUTTING_CS, result.getInt(OFFSET_SKILLS + 4));
skills.put(PrimarySkillType.UNARMED, result.getInt(OFFSET_SKILLS + 5)); skills.put(CoreSkills.UNARMED_CS, result.getInt(OFFSET_SKILLS + 5));
skills.put(PrimarySkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6)); skills.put(PrimarySkillType.HERBALISM, result.getInt(OFFSET_SKILLS + 6));
skills.put(PrimarySkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7)); skills.put(PrimarySkillType.EXCAVATION, result.getInt(OFFSET_SKILLS + 7));
skills.put(PrimarySkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8)); skills.put(PrimarySkillType.ARCHERY, result.getInt(OFFSET_SKILLS + 8));
skills.put(PrimarySkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9)); skills.put(PrimarySkillType.SWORDS, result.getInt(OFFSET_SKILLS + 9));
skills.put(PrimarySkillType.AXES, result.getInt(OFFSET_SKILLS + 10)); skills.put(CoreSkills.AXES_CS, result.getInt(OFFSET_SKILLS + 10));
skills.put(PrimarySkillType.ACROBATICS, result.getInt(OFFSET_SKILLS + 11)); skills.put(CoreSkills.ACROBATICS_CS, result.getInt(OFFSET_SKILLS + 11));
skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12)); skills.put(PrimarySkillType.FISHING, result.getInt(OFFSET_SKILLS + 12));
skills.put(PrimarySkillType.ALCHEMY, result.getInt(OFFSET_SKILLS + 13)); skills.put(CoreSkills.ALCHEMY_CS, result.getInt(OFFSET_SKILLS + 13));
skills.put(PrimarySkillType.TRIDENTS, result.getInt(OFFSET_SKILLS + 14)); skills.put(PrimarySkillType.TRIDENTS, result.getInt(OFFSET_SKILLS + 14));
skills.put(PrimarySkillType.CROSSBOWS, result.getInt(OFFSET_SKILLS + 15)); skills.put(PrimarySkillType.CROSSBOWS, result.getInt(OFFSET_SKILLS + 15));
skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_EXPERIENCE + 1)); skillsXp.put(PrimarySkillType.TAMING, result.getFloat(OFFSET_EXPERIENCE + 1));
skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_EXPERIENCE + 2)); skillsXp.put(PrimarySkillType.MINING, result.getFloat(OFFSET_EXPERIENCE + 2));
skillsXp.put(PrimarySkillType.REPAIR, result.getFloat(OFFSET_EXPERIENCE + 3)); skillsXp.put(CoreSkills.REPAIR_CS, result.getFloat(OFFSET_EXPERIENCE + 3));
skillsXp.put(PrimarySkillType.WOODCUTTING, result.getFloat(OFFSET_EXPERIENCE + 4)); skillsXp.put(CoreSkills.WOODCUTTING_CS, result.getFloat(OFFSET_EXPERIENCE + 4));
skillsXp.put(PrimarySkillType.UNARMED, result.getFloat(OFFSET_EXPERIENCE + 5)); skillsXp.put(CoreSkills.UNARMED_CS, result.getFloat(OFFSET_EXPERIENCE + 5));
skillsXp.put(PrimarySkillType.HERBALISM, result.getFloat(OFFSET_EXPERIENCE + 6)); skillsXp.put(PrimarySkillType.HERBALISM, result.getFloat(OFFSET_EXPERIENCE + 6));
skillsXp.put(PrimarySkillType.EXCAVATION, result.getFloat(OFFSET_EXPERIENCE + 7)); skillsXp.put(PrimarySkillType.EXCAVATION, result.getFloat(OFFSET_EXPERIENCE + 7));
skillsXp.put(PrimarySkillType.ARCHERY, result.getFloat(OFFSET_EXPERIENCE + 8)); skillsXp.put(PrimarySkillType.ARCHERY, result.getFloat(OFFSET_EXPERIENCE + 8));
skillsXp.put(PrimarySkillType.SWORDS, result.getFloat(OFFSET_EXPERIENCE + 9)); skillsXp.put(PrimarySkillType.SWORDS, result.getFloat(OFFSET_EXPERIENCE + 9));
skillsXp.put(PrimarySkillType.AXES, result.getFloat(OFFSET_EXPERIENCE + 10)); skillsXp.put(CoreSkills.AXES_CS, result.getFloat(OFFSET_EXPERIENCE + 10));
skillsXp.put(PrimarySkillType.ACROBATICS, result.getFloat(OFFSET_EXPERIENCE + 11)); skillsXp.put(CoreSkills.ACROBATICS_CS, result.getFloat(OFFSET_EXPERIENCE + 11));
skillsXp.put(PrimarySkillType.FISHING, result.getFloat(OFFSET_EXPERIENCE + 12)); skillsXp.put(PrimarySkillType.FISHING, result.getFloat(OFFSET_EXPERIENCE + 12));
skillsXp.put(PrimarySkillType.ALCHEMY, result.getFloat(OFFSET_EXPERIENCE + 13)); skillsXp.put(CoreSkills.ALCHEMY_CS, result.getFloat(OFFSET_EXPERIENCE + 13));
skillsXp.put(PrimarySkillType.TRIDENTS, result.getFloat(OFFSET_EXPERIENCE + 14)); skillsXp.put(PrimarySkillType.TRIDENTS, result.getFloat(OFFSET_EXPERIENCE + 14));
skillsXp.put(PrimarySkillType.CROSSBOWS, result.getFloat(OFFSET_EXPERIENCE + 15)); skillsXp.put(PrimarySkillType.CROSSBOWS, result.getFloat(OFFSET_EXPERIENCE + 15));
@ -1283,17 +1284,17 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
//XPBAR //XPBAR
xpBarStateMap.put(PrimarySkillType.TAMING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 1))); xpBarStateMap.put(PrimarySkillType.TAMING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 1)));
xpBarStateMap.put(PrimarySkillType.MINING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 2))); xpBarStateMap.put(PrimarySkillType.MINING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 2)));
xpBarStateMap.put(PrimarySkillType.REPAIR, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 3))); xpBarStateMap.put(CoreSkills.REPAIR_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 3)));
xpBarStateMap.put(PrimarySkillType.WOODCUTTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 4))); xpBarStateMap.put(CoreSkills.WOODCUTTING_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 4)));
xpBarStateMap.put(PrimarySkillType.UNARMED, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 5))); xpBarStateMap.put(CoreSkills.UNARMED_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 5)));
xpBarStateMap.put(PrimarySkillType.HERBALISM, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 6))); xpBarStateMap.put(PrimarySkillType.HERBALISM, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 6)));
xpBarStateMap.put(PrimarySkillType.EXCAVATION, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 7))); xpBarStateMap.put(PrimarySkillType.EXCAVATION, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 7)));
xpBarStateMap.put(PrimarySkillType.ARCHERY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 8))); xpBarStateMap.put(PrimarySkillType.ARCHERY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 8)));
xpBarStateMap.put(PrimarySkillType.SWORDS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 9))); xpBarStateMap.put(PrimarySkillType.SWORDS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 9)));
xpBarStateMap.put(PrimarySkillType.AXES, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 10))); xpBarStateMap.put(CoreSkills.AXES_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 10)));
xpBarStateMap.put(PrimarySkillType.ACROBATICS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 11))); xpBarStateMap.put(CoreSkills.ACROBATICS_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 11)));
xpBarStateMap.put(PrimarySkillType.FISHING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 12))); xpBarStateMap.put(PrimarySkillType.FISHING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 12)));
xpBarStateMap.put(PrimarySkillType.ALCHEMY, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 13))); xpBarStateMap.put(CoreSkills.ALCHEMY_CS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 13)));
xpBarStateMap.put(PrimarySkillType.SALVAGE, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 14))); xpBarStateMap.put(PrimarySkillType.SALVAGE, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 14)));
xpBarStateMap.put(PrimarySkillType.SMELTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 15))); xpBarStateMap.put(PrimarySkillType.SMELTING, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 15)));
xpBarStateMap.put(PrimarySkillType.TRIDENTS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 16))); xpBarStateMap.put(PrimarySkillType.TRIDENTS, SkillUtils.asBarState(result.getString(OFFSET_XPBAR + 16)));
@ -1304,7 +1305,7 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
boolean rankLess = result.getBoolean(OFFSET_TOGGLE+2); boolean rankLess = result.getBoolean(OFFSET_TOGGLE+2);
//Build //Build
persistentPlayerDataBuilder.setSkillLevelValues(skills) MMODataBuilder.setSkillLevelValues(skills)
.setSkillExperienceValues(skillsXp) .setSkillExperienceValues(skillsXp)
.setAbilityDeactivationTimestamps(skillsDATS) .setAbilityDeactivationTimestamps(skillsDATS)
.setUniquePlayerData(uniqueData) .setUniquePlayerData(uniqueData)
@ -1320,7 +1321,7 @@ public final class SQLDatabaseManager extends AbstractDatabaseManager {
PersistentPlayerData persistentPlayerData; PersistentPlayerData persistentPlayerData;
try { try {
persistentPlayerData = persistentPlayerDataBuilder.build(); persistentPlayerData = MMODataBuilder.build();
return new PlayerProfile(persistentPlayerData); return new PlayerProfile(persistentPlayerData);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -1,17 +1,14 @@
package com.gmail.nossr50.datatypes.player; package com.gmail.nossr50.datatypes.player;
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.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.experience.MMOExperienceBarManager; import com.gmail.nossr50.util.experience.MMOExperienceBarManager;
import com.neetgames.mcmmo.MobHealthBarType; import com.neetgames.mcmmo.MobHealthBarType;
import com.neetgames.mcmmo.UniqueDataType; import com.neetgames.mcmmo.UniqueDataType;
import com.neetgames.mcmmo.api.SkillRegister; 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.SkillIdentity;
import com.neetgames.mcmmo.skill.SuperSkill; 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;
@ -23,7 +20,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
public class PersistentPlayerDataBuilder { public class MMODataBuilder {
/* Player Stuff */ /* Player Stuff */
private @Nullable String playerName; private @Nullable String playerName;
@ -49,28 +46,28 @@ public class PersistentPlayerDataBuilder {
/* Scoreboards */ /* Scoreboards */
private int scoreboardTipsShown; private int scoreboardTipsShown;
public @NotNull PersistentPlayerData buildNewPlayerData(@NotNull Player player) { public @NotNull MMOPlayerData buildNewPlayerData(@NotNull Player player) {
/* /*
* New Profile with default values * New Profile with default values
*/ */
return buildNewPlayerData(player.getUniqueId(), player.getName()); return buildNewPlayerData(player.getUniqueId(), player.getName());
} }
public @Nullable PersistentPlayerData buildNewPlayerData(@NotNull OfflinePlayer offlinePlayer) { public @Nullable MMOPlayerData buildNewPlayerData(@NotNull OfflinePlayer offlinePlayer) {
if(offlinePlayer.getName() != null) if(offlinePlayer.getName() != null)
return buildNewPlayerData(offlinePlayer.getUniqueId(), offlinePlayer.getName()); return buildNewPlayerData(offlinePlayer.getUniqueId(), offlinePlayer.getName());
else else
return null; return null;
} }
public @NotNull PersistentPlayerData buildNewPlayerData(@NotNull UUID playerUUID, @NotNull String playerName) { public @NotNull MMOPlayerData buildNewPlayerData(@NotNull UUID playerUUID, @NotNull String playerName) {
/* /*
* New Profile with default values * New Profile with default values
*/ */
return new PersistentPlayerData(playerUUID, playerName); return new PersistentPlayerData(playerUUID, playerName);
} }
public @NotNull PersistentPlayerData build() throws Exception { public @NotNull MMOPlayerData build() throws Exception {
if(playerUUID == null) if(playerUUID == null)
throw new NullArgumentException("playerUUID"); throw new NullArgumentException("playerUUID");
@ -165,7 +162,7 @@ public class PersistentPlayerDataBuilder {
return playerName; return playerName;
} }
public @NotNull PersistentPlayerDataBuilder setPlayerName(@NotNull String playerName) { public @NotNull MMODataBuilder setPlayerName(@NotNull String playerName) {
this.playerName = playerName; this.playerName = playerName;
return this; return this;
} }
@ -174,7 +171,7 @@ public class PersistentPlayerDataBuilder {
return playerUUID; return playerUUID;
} }
public @NotNull PersistentPlayerDataBuilder setPlayerUUID(@NotNull UUID playerUUID) { public @NotNull MMODataBuilder setPlayerUUID(@NotNull UUID playerUUID) {
this.playerUUID = playerUUID; this.playerUUID = playerUUID;
return this; return this;
} }
@ -183,7 +180,7 @@ public class PersistentPlayerDataBuilder {
return lastLogin; return lastLogin;
} }
public @NotNull PersistentPlayerDataBuilder setLastLogin(long lastLogin) { public @NotNull MMODataBuilder setLastLogin(long lastLogin) {
this.lastLogin = lastLogin; this.lastLogin = lastLogin;
return this; return this;
} }
@ -192,7 +189,7 @@ public class PersistentPlayerDataBuilder {
return skillLevelValues; return skillLevelValues;
} }
public @NotNull PersistentPlayerDataBuilder setSkillLevelValues(@NotNull HashMap<RootSkill, Integer> skillLevelValues) { public @NotNull MMODataBuilder setSkillLevelValues(@NotNull HashMap<RootSkill, Integer> skillLevelValues) {
this.skillLevelValues = skillLevelValues; this.skillLevelValues = skillLevelValues;
return this; return this;
} }
@ -201,7 +198,7 @@ public class PersistentPlayerDataBuilder {
return skillExperienceValues; return skillExperienceValues;
} }
public @NotNull PersistentPlayerDataBuilder setSkillExperienceValues(@NotNull HashMap<RootSkill, Float> skillExperienceValues) { public @NotNull MMODataBuilder setSkillExperienceValues(@NotNull HashMap<RootSkill, Float> skillExperienceValues) {
this.skillExperienceValues = skillExperienceValues; this.skillExperienceValues = skillExperienceValues;
return this; return this;
} }
@ -210,7 +207,7 @@ public class PersistentPlayerDataBuilder {
return abilityDeactivationTimestamps; return abilityDeactivationTimestamps;
} }
public @NotNull PersistentPlayerDataBuilder setAbilityDeactivationTimestamps(@NotNull HashMap<SuperSkill, Integer> abilityDeactivationTimestamps) { public @NotNull MMODataBuilder setAbilityDeactivationTimestamps(@NotNull HashMap<SuperSkill, Integer> abilityDeactivationTimestamps) {
this.abilityDeactivationTimestamps = abilityDeactivationTimestamps; this.abilityDeactivationTimestamps = abilityDeactivationTimestamps;
return this; return this;
} }
@ -219,7 +216,7 @@ public class PersistentPlayerDataBuilder {
return uniquePlayerData; return uniquePlayerData;
} }
public @NotNull PersistentPlayerDataBuilder setUniquePlayerData(@NotNull EnumMap<UniqueDataType, Integer> uniquePlayerData) { public @NotNull MMODataBuilder setUniquePlayerData(@NotNull EnumMap<UniqueDataType, Integer> uniquePlayerData) {
this.uniquePlayerData = uniquePlayerData; this.uniquePlayerData = uniquePlayerData;
return this; return this;
} }
@ -228,12 +225,12 @@ public class PersistentPlayerDataBuilder {
return barStateMap; return barStateMap;
} }
public @NotNull PersistentPlayerDataBuilder setBarStateMap(@NotNull Map<RootSkill, SkillBossBarState> barStateMap) { public @NotNull MMODataBuilder setBarStateMap(@NotNull Map<RootSkill, SkillBossBarState> barStateMap) {
this.barStateMap = barStateMap; this.barStateMap = barStateMap;
return this; return this;
} }
public @NotNull PersistentPlayerDataBuilder setPartyChatSpying(boolean partyChatSpying) { public @NotNull MMODataBuilder setPartyChatSpying(boolean partyChatSpying) {
this.partyChatSpying = partyChatSpying; this.partyChatSpying = partyChatSpying;
return this; return this;
} }
@ -242,7 +239,7 @@ public class PersistentPlayerDataBuilder {
return scoreboardTipsShown; return scoreboardTipsShown;
} }
public @NotNull PersistentPlayerDataBuilder setScoreboardTipsShown(int scoreboardTipsShown) { public @NotNull MMODataBuilder setScoreboardTipsShown(int scoreboardTipsShown) {
this.scoreboardTipsShown = scoreboardTipsShown; this.scoreboardTipsShown = scoreboardTipsShown;
return this; return this;
} }

View File

@ -2,11 +2,7 @@ package com.gmail.nossr50.runnables.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PersistentPlayerData;
import com.gmail.nossr50.datatypes.player.PersistentPlayerDataBuilder;
import com.neetgames.mcmmo.player.MMOPlayerData; import com.neetgames.mcmmo.player.MMOPlayerData;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask; import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask;