Skip to content

Commit

Permalink
Fixed ExtendedPersistentDataContainerFactory on 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Mar 10, 2024
1 parent 1908d9a commit 446e7a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eco-core/core-nms/v1_20_R3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = rootProject.version

dependencies {
implementation(project(":eco-core:core-nms:nms-common"))
paperweight.paperDevBundle("1.20.3-R0.1-SNAPSHOT")
paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT")

implementation("net.kyori:adventure-text-minimessage:4.11.0") {
version {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFa

override fun <T : Any, Z : Any> set(key: String, dataType: PersistentDataType<T, Z>, value: Z) {
customDataTags[key] =
registry.wrap(dataType.primitiveType, dataType.toPrimitive(value, handle.adapterContext))
registry.wrap(dataType, dataType.toPrimitive(value, handle.adapterContext))
}

override fun <T : Any, Z : Any> has(key: String, dataType: PersistentDataType<T, Z>): Boolean {
val value = customDataTags[key] ?: return false
return registry.isInstanceOf(dataType.primitiveType, value)
return registry.isInstanceOf(dataType, value)
}

override fun <T : Any, Z : Any> get(key: String, dataType: PersistentDataType<T, Z>): Z? {
val value = customDataTags[key] ?: return null
return dataType.fromPrimitive(registry.extract(dataType.primitiveType, value), handle.adapterContext)
return dataType.fromPrimitive(registry.extract<T, Tag>(dataType, value), handle.adapterContext)
}

override fun <T : Any, Z : Any> getOrDefault(
Expand Down

0 comments on commit 446e7a9

Please sign in to comment.