diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 62f9341e..f81374b0 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -190,7 +190,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public int getPointSpent(SkillTree skillTree) { - return pointSpent.get(skillTree); + return pointSpent.getOrDefault(skillTree,0); } @@ -199,7 +199,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public void giveSkillTreePoints(String id, int val) { - skillTreePoints.put(id, skillTreePoints.get(id) + val); + skillTreePoints.put(id, skillTreePoints.getOrDefault(id,0) + val); } public int countSkillTreePoints(SkillTree skillTree) { @@ -296,7 +296,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public int getNodeLevel(SkillTreeNode node) { - return nodeLevels.get(node); + return nodeLevels.getOrDefault(node,0); } public void setNodeLevel(SkillTreeNode node, int nodeLevel) { diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 801ed968..4f748ca2 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -101,7 +101,8 @@ public class PlayerProfessions { playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt()); for (Profession profession : MMOCore.plugin.professionManager.getAll()) { - profession.getExperienceTable().claimStatTriggers(playerData, profession); + if (profession.hasExperienceTable()) + profession.getExperienceTable().claimStatTriggers(playerData, profession); } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 2e42af1b..73802d23 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.manager.data.mysql; +import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -110,7 +111,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { if (!isEmpty(result.getString("friends"))) MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); if (!isEmpty(result.getString("skills"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); + JsonObject object=new Gson().fromJson(result.getString("skills"), JsonObject.class); for (Entry entry : object.entrySet()) data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); }