markDirty

fun markDirty()

Manually marks this PlayerData instance as dirty.

This method allows external code to explicitly mark the data as dirty, ensuring it will be saved during the next database operation. This is useful when making changes that don't go through the standard property setters or when you want to force a save operation.

Use Cases:

  • After direct manipulation of nested collections

  • When implementing custom data modification logic

  • To force a save operation regardless of actual changes

  • After bulk operations that bypass individual setters

Usage Examples:

// After direct manipulation of collections
playerData.persistentPlayerFlags.clear()
playerData.markDirty()

// After custom logic that may or may not change data
if (performCustomOperation(playerData)) {
playerData.markDirty()
}