From ca838fc950afd51872c8f055cbd8f6c81224130d Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 27 Sep 2021 12:50:45 +0100 Subject: [PATCH] Changes --- .../main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt | 7 +------ .../com/willfp/ecoskills/data/SavedPlayerNameListener.kt | 2 +- .../com/willfp/ecoskills/data/storage/PlayerProfile.kt | 8 +++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt index 38b373a..dfde9d7 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt @@ -2,7 +2,7 @@ package com.willfp.ecoskills import com.willfp.ecoskills.api.PlayerSkillExpGainEvent import com.willfp.ecoskills.api.PlayerSkillLevelUpEvent -import com.willfp.ecoskills.data.storage.PlayerProfile +import com.willfp.ecoskills.data.storage.PlayerProfile.Companion.profile import com.willfp.ecoskills.effects.Effect import com.willfp.ecoskills.skills.Skill import com.willfp.ecoskills.skills.Skills @@ -17,11 +17,6 @@ import java.util.* val expMultiplierCache = mutableMapOf() val plugin: EcoSkillsPlugin = EcoSkillsPlugin.getInstance() -val OfflinePlayer.profile: PlayerProfile - get() { - return PlayerProfile.load(this.uniqueId) - } - fun Player.getSkillExperienceMultiplier(): Double { if (expMultiplierCache.containsKey(this.uniqueId)) { return expMultiplierCache[this.uniqueId]!! diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/SavedPlayerNameListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/SavedPlayerNameListener.kt index 5f98ce4..44324b5 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/SavedPlayerNameListener.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/SavedPlayerNameListener.kt @@ -1,7 +1,7 @@ package com.willfp.ecoskills.data import com.willfp.eco.core.EcoPlugin -import com.willfp.ecoskills.profile +import com.willfp.ecoskills.data.storage.PlayerProfile.Companion.profile import org.bukkit.OfflinePlayer import org.bukkit.entity.Player import org.bukkit.event.EventHandler diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/storage/PlayerProfile.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/storage/PlayerProfile.kt index 7564b39..8dca06f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/storage/PlayerProfile.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/storage/PlayerProfile.kt @@ -4,6 +4,7 @@ import com.willfp.ecoskills.EcoSkillsPlugin import com.willfp.ecoskills.effects.Effects import com.willfp.ecoskills.skills.Skills import com.willfp.ecoskills.stats.Stats +import org.bukkit.OfflinePlayer import java.util.* class PlayerProfile private constructor( @@ -30,7 +31,7 @@ class PlayerProfile private constructor( private val loaded = mutableMapOf() private val keys = mutableMapOf() - fun load(uuid: UUID): PlayerProfile { + private fun load(uuid: UUID): PlayerProfile { val found = loaded[uuid] if (found != null) { return found @@ -64,6 +65,11 @@ class PlayerProfile private constructor( handler.save() } + val OfflinePlayer.profile: PlayerProfile + get() { + return PlayerProfile.load(this.uniqueId) + } + init { keys["name"] = Type.STRING