9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-02 22:02:19 +00:00
This commit is contained in:
Auxilor
2021-09-27 12:50:45 +01:00
parent a65d19999c
commit ca838fc950
3 changed files with 9 additions and 8 deletions

View File

@@ -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<UUID, Double>()
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]!!

View File

@@ -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

View File

@@ -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<UUID, PlayerProfile>()
private val keys = mutableMapOf<String, Type>()
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