Fixed data.yml

This commit is contained in:
Auxilor
2022-03-28 21:24:34 +01:00
parent 4d92cbb7ff
commit ada2832839
2 changed files with 9 additions and 7 deletions

View File

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

View File

@@ -39,12 +39,14 @@ class YamlDataHandler(
}
override fun <T> read(uuid: UUID, key: PersistentDataKey<T>): 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
}
}