From f44da7456a563613aacb9fe0d5dce58c101cd994 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 28 Apr 2020 18:28:53 +0200 Subject: [PATCH] Fixed a loading issue --- .../java/net/Indyuce/mmocore/api/player/PlayerData.java | 6 ++++-- .../net/Indyuce/mmocore/api/player/stats/PlayerStats.java | 6 ++++++ .../java/net/Indyuce/mmocore/api/quest/PlayerQuests.java | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 11c65105..a064eae5 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -52,6 +52,8 @@ import net.Indyuce.mmocore.listener.SpellCast.SkillCasting; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import net.mmogroup.mmolib.MMOLib; +import net.mmogroup.mmolib.api.player.MMOData; +import net.mmogroup.mmolib.api.stat.StatMap; import net.mmogroup.mmolib.version.VersionSound; public class PlayerData extends OfflinePlayerData { @@ -112,8 +114,8 @@ public class PlayerData extends OfflinePlayerData { private PlayerData() { super(UUID.randomUUID()); - playerStats = new PlayerStats(this); - questData = new PlayerQuests(this); + playerStats = new PlayerStats(this, new StatMap(new MMOData().setMMOCore(this))); + questData = new PlayerQuests(this, null); } /* diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java index 5b503f25..d131f0ca 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java @@ -19,6 +19,12 @@ public class PlayerStats { map = MMOData.get(data.getPlayer()).setMMOCore(data).getStatMap(); } + @Deprecated + public PlayerStats(PlayerData data, StatMap map) { + this.data = data; + this.map = map; + } + public PlayerData getData() { return data; } diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java b/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java index fb548339..6459dc99 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java +++ b/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java @@ -31,10 +31,17 @@ public class PlayerQuests { public PlayerQuests(PlayerData playerData) { this.playerData = playerData; + bossbar = MMOLib.plugin.getVersion().getWrapper().createBossBar(new NamespacedKey(MMOCore.plugin, "quest_bar_" + playerData.getUniqueId().toString()), "", BarColor.PURPLE, BarStyle.SEGMENTED_20, new BarFlag[0]); bossbar.addPlayer(playerData.getPlayer()); } + @Deprecated + public PlayerQuests(PlayerData playerData, BossBar bar) { + this.playerData = playerData; + this.bossbar = bar; + } + public PlayerQuests load(ConfigurationSection config) { if (config.contains("current")) try {