Merge pull request #10 from SKBotNL/master

Improve getPlayerBalanceWrapper code
This commit is contained in:
NotAlexNoyle authored and GitHub committed 2024-03-06 09:35:29 -05:00
commit 5009f29eb2
1 file changed
+1 -10
@@ -73,20 +73,11 @@ class PostgreSQL {
private suspend fun getPlayerBalanceWrapper(uuid: UUID, type: BalanceType): Long? {
val playerBalance = getPlayerBalance(uuid, type)
when (type) {
BalanceType.BANK_BALANCE -> if (playerBalance.bankBalance == null) return null
BalanceType.INVENTORY_BALANCE -> if (playerBalance.inventoryBalance == null) return null
BalanceType.ENDER_CHEST_BALANCE -> if (playerBalance.enderChestBalance == null) return null
else -> return null
}
return when (type) {
BalanceType.BANK_BALANCE -> playerBalance.bankBalance
BalanceType.INVENTORY_BALANCE -> playerBalance.inventoryBalance
BalanceType.ENDER_CHEST_BALANCE -> playerBalance.enderChestBalance
// Shouldn't be called anyway
else -> 0
else -> return null
}
}