From bbab36ca1bca6e49176f98f81994751489bfcc71 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Tue, 21 Mar 2023 20:58:14 +0100 Subject: [PATCH] Added unlockedItems in ClassDataContainer. --- .../net/Indyuce/mmocore/api/player/PlayerData.java | 10 ++++++++++ .../net/Indyuce/mmocore/player/ClassDataContainer.java | 3 +++ .../net/Indyuce/mmocore/player/DefaultPlayerData.java | 10 ++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) 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 9e6b1671..68eba7e4 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 @@ -374,6 +374,16 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc return result; } + @Override + public Set getUnlockedItems() { + return new HashSet<>(unlockedItems); + } + + public void setUnlockedItems(Set unlockedItems) { + this.unlockedItems.clear(); + this.unlockedItems.addAll(unlockedItems); + } + public void resetTimesClaimed() { tableItemClaims.clear(); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java index f1198b19..5d6a7e1e 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java @@ -7,6 +7,7 @@ import net.Indyuce.mmocore.skilltree.SkillTreeNode; import java.util.List; import java.util.Map; +import java.util.Set; /** * All the class-specific information i.e information being saved @@ -48,4 +49,6 @@ public interface ClassDataContainer { Map getNodeLevels(); Map getNodeTimesClaimed(); + + Set getUnlockedItems(); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java index 48c54d08..1a46af5e 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java @@ -6,10 +6,7 @@ import net.Indyuce.mmocore.skilltree.SkillTreeNode; import org.bukkit.attribute.Attribute; import org.bukkit.configuration.ConfigurationSection; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class DefaultPlayerData implements ClassDataContainer { private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints, skillReallocPoints, skillTreeReallocPoints; @@ -122,6 +119,11 @@ public class DefaultPlayerData implements ClassDataContainer { return new HashMap<>(); } + @Override + public Set getUnlockedItems() { + return new HashSet<>(); + } + @Override public Map mapAttributeLevels() { return new HashMap<>();