addGems

fun addGems(amount: Int)

Adds gems currency to the player's balance.

This method provides a safe way to modify player gems with automatic dirty tracking. Only modifies the gems and dirty flag if the amount is non-zero, avoiding unnecessary database operations.

Usage Examples:

playerData.addGems(10)   // Adds 10 gems
playerData.addGems(-5) // Removes 5 gems
playerData.addGems(0) // No change, no dirty flag set

Important Notes:

  • Does not perform balance validation (negative balances are possible)

  • Premium currency should have additional validation in calling code

  • Consider transaction logging for gem operations

Parameters

amount

The amount of gems to add (can be negative to subtract)