Skip to content

Commit

Permalink
Store data version
Browse files Browse the repository at this point in the history
  • Loading branch information
Gutin1 committed Dec 26, 2024
1 parent e72907c commit 568b37a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,8 @@ object DataMigrators : IonServerComponent() {
migrateInventory(state.inventory, toApply)
}
}

chunk.persistentDataContainer.set(NamespacedKeys.DATA_VERSION, PersistentDataType.INTEGER, lastDataVersion)
}

fun migrate(player: Player) {
Expand All @@ -777,6 +779,8 @@ object DataMigrators : IonServerComponent() {

log.info("Migrating ${player.name}'s inventory from $playerVersion to $lastDataVersion")
migrateInventory(player.inventory, getVersions(playerVersion).apply { log.info("Applying $size versions") })

player.persistentDataContainer.set(NamespacedKeys.DATA_VERSION, PersistentDataType.INTEGER, lastDataVersion)
}

private fun getVersions(dataVersion: Int): List<DataVersion> {
Expand Down

0 comments on commit 568b37a

Please sign in to comment.