From ada2832839b81001e0a2ec2a62b96e96d1526169 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 28 Mar 2022 21:24:34 +0100 Subject: [PATCH] Fixed data.yml --- .../willfp/eco/internal/spigot/data/EcoProfile.kt | 4 ++-- .../internal/spigot/data/storage/YamlDataHandler.kt | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt index 648e82b4..ef47db56 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt @@ -36,11 +36,11 @@ abstract class EcoProfile( return false } - return this.data == other.data && this.uuid == other.uuid + return this.uuid == other.uuid } override fun hashCode(): Int { - return this.data.hashCode() + return this.uuid.hashCode() } companion object { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/storage/YamlDataHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/storage/YamlDataHandler.kt index a72946ba..8ee6acf6 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/storage/YamlDataHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/storage/YamlDataHandler.kt @@ -39,12 +39,14 @@ class YamlDataHandler( } override fun read(uuid: UUID, key: PersistentDataKey): T? { - return when (key.type) { - PersistentDataKeyType.INT -> dataYml.getInt("player.$uuid.$key") - PersistentDataKeyType.DOUBLE -> dataYml.getDouble("player.$uuid.$key") - PersistentDataKeyType.STRING -> dataYml.getString("player.$uuid.$key") - PersistentDataKeyType.BOOLEAN -> dataYml.getBool("player.$uuid.$key") + val value = when (key.type) { + PersistentDataKeyType.INT -> dataYml.getInt("player.$uuid.${key.key}") + PersistentDataKeyType.DOUBLE -> dataYml.getDouble("player.$uuid.${key.key}") + PersistentDataKeyType.STRING -> dataYml.getString("player.$uuid.${key.key}") + PersistentDataKeyType.BOOLEAN -> dataYml.getBool("player.$uuid.${key.key}") else -> null } as? T? + + return value } }