From 6ac32670591b53043406eb7edd8f5b59bec60d1d Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Thu, 2 Mar 2023 21:31:42 +0100 Subject: [PATCH] Fixed bug that occured w/ perm stats when changing to a new class. --- .../java/net/Indyuce/mmocore/api/player/PlayerData.java | 7 +++++++ .../mmocore/api/player/profess/SavedClassInformation.java | 2 ++ 2 files changed, 9 insertions(+) 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 74aedaa5..db412801 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 @@ -222,6 +222,13 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public void clearSkillTreePoints() { skillTreePoints.clear(); } + public void clearNodeTimesClaimed() { + Map copy= new HashMap<>(tableItemClaims); + copy.forEach((str, val) -> { + if (str.startsWith(SkillTreeNode.KEY_PREFIX)) + tableItemClaims.remove(str); + }); + } public Set> getNodeLevelsEntrySet() { HashMap nodeLevelsString = new HashMap<>(); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java index 08b58661..76eafa7e 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java @@ -213,6 +213,8 @@ public class SavedClassInformation { while (player.hasSkillBound(0)) player.unbindSkill(0); + player.clearNodeTimesClaimed(); + /* * Reads this class info, applies it to the player. set class after