add Gold
Adds gold currency to the player's balance.
This method provides a safe way to modify player gold with automatic dirty tracking. Only modifies the gold and dirty flag if the amount is non-zero, avoiding unnecessary database operations.
Usage Examples:
playerData.addGold(500) // Adds 500 gold
playerData.addGold(-100) // Removes 100 gold
playerData.addGold(0) // No change, no dirty flag setContent copied to clipboard
Important Notes:
Does not perform balance validation (negative balances are possible)
Calling code should validate sufficient funds before subtracting
Consider using economy plugins for complex transaction logic
Parameters
amount
The amount of gold to add (can be negative to subtract)