Skip to content

Commit daa8ad9

Browse files
committed
integration (vaultunlocked): update to and implement v2.10.0
1 parent 5decc59 commit daa8ad9

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/hook/impl/vault/unlocked/VaultUnlockedEconomyProvider.kt

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class VaultUnlockedEconomyProvider(
6565

6666
return if (try {
6767
Bukkit.getOfflinePlayer(accountId).hasPlayedBefore()
68-
} catch (ignored: Exception) {
68+
} catch (_: Exception) {
6969
false
7070
}
7171
) {
@@ -637,4 +637,47 @@ class VaultUnlockedEconomyProvider(
637637
}
638638
}
639639

640+
override fun set(
641+
pluginName: String,
642+
accountID: UUID,
643+
amount: BigDecimal,
644+
): EconomyResponse? {
645+
return set(pluginName, accountID, "", getDefaultCurrency(pluginName), amount)
646+
}
647+
648+
override fun set(
649+
pluginName: String,
650+
accountID: UUID,
651+
worldName: String,
652+
amount: BigDecimal,
653+
): EconomyResponse? {
654+
return set(pluginName, accountID, worldName, getDefaultCurrency(pluginName), amount)
655+
}
656+
657+
override fun set(
658+
pluginName: String,
659+
accountID: UUID,
660+
worldName: String,
661+
currency: String,
662+
amount: BigDecimal
663+
): EconomyResponse? {
664+
return runBlocking {
665+
getAccountByUuid(null, accountID).setBalance(
666+
amount,
667+
storageHandler().getCurrency(currency)
668+
?: throw IllegalArgumentException("Currency does not exist: '$currency'"),
669+
vaultUnlockedCause,
670+
TransactionImportance.MEDIUM,
671+
null
672+
)
673+
674+
EconomyResponse(
675+
amount,
676+
getBalance(pluginName, accountID, worldName, currency),
677+
EconomyResponse.ResponseType.SUCCESS,
678+
""
679+
)
680+
}
681+
}
682+
640683
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<configurate.version>4.1.2</configurate.version>
3131
<treasury-api.version>2.0.1</treasury-api.version>
3232
<bstats.version>3.0.2</bstats.version>
33-
<vaultunlocked.version>2.9</vaultunlocked.version>
33+
<vaultunlocked.version>2.10</vaultunlocked.version>
3434
<sqlite.version>3.43.0.0</sqlite.version>
3535
<h2.version>2.2.220</h2.version>
3636
<mariadb.version>3.2.0</mariadb.version>

0 commit comments

Comments
 (0)