New static attempt

This commit is contained in:
NotAlexNoyle committed 2024-04-05 17:12:32 +00:00
1 parent b1f2db6ec6
commit 6f42106630
1 file changed
+4 -16
@@ -32,6 +32,10 @@ class DiamondBankOG : JavaPlugin() {
val blockCommandsWithInventoryActionsFor = mutableListOf<UUID>()
var sentryEnabled: Boolean = false
var economyDisabled: Boolean = false
@JvmStatic
public fun getPlayerBalance(uuid: UUID, type: BalanceType): CompletableFuture<Double?> {
return GlobalScope.future { postgreSQL.getPlayerBalanceWrapper(uuid, type) }
}
}
override fun onEnable() {
@@ -136,20 +140,4 @@ class DiamondBankOG : JavaPlugin() {
}
}
companion object {
@JvmStatic
@OptIn(DelicateCoroutinesApi::class)
fun getPlayerBalance(uuid: UUID, type: BalanceType, scope: CoroutineScope): CompletableFuture<Result<Double>> {
return scope.future {
try {
Result.success(postgreSQL.getPlayerBalanceWrapper(uuid, type))
}
catch (error: Exception) {
Result.failure(error)
}
}
}
}
}