Skip to content

Commit 5decc59

Browse files
committed
all: auto code fmt
1 parent 2373d21 commit 5decc59

File tree

21 files changed

+322
-173
lines changed

21 files changed

+322
-173
lines changed

api/src/main/kotlin/io/github/arcaneplugins/polyconomy/api/currency/Currency.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ abstract class Currency(
6060

6161
abstract suspend fun setPresentationFormat(new: String)
6262

63-
abstract suspend fun registerLocale(locale: Locale, dispNameSingular: String, dispNamePlural: String, decimal: String)
63+
abstract suspend fun registerLocale(
64+
locale: Locale,
65+
dispNameSingular: String,
66+
dispNamePlural: String,
67+
decimal: String,
68+
)
6469

6570
abstract suspend fun unregisterLocale(locale: Locale)
6671

docs/brainstorming/SQL_Planner_1.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Every time a player joins, it updates their username here.
2323
CREATE TABLE IF NOT EXISTS ArcEco_PlayerCache
2424
(
2525
/* PlayerUUID, PlayerUsername, Timestamp */
26-
player_uuid VARCHAR
26+
player_uuid
27+
VARCHAR
2728
(
2829
32
2930
) PRIMARY KEY,
@@ -216,7 +217,8 @@ CREATE TABLE IF NOT EXISTS ArcEco_NonPlayerAccountTransactions
216217
CREATE TABLE IF NOT EXISTS ArcEco_CurrentIds
217218
(
218219
/* TableNamesEnum, Value */
219-
table_name VARCHAR
220+
table_name
221+
VARCHAR
220222
(
221223
64
222224
) PRIMARY KEY,

docs/brainstorming/SQL_Planner_2.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/
44
CREATE TABLE IF NOT EXISTS arceco_player_usernames
55
(
6-
uuid CHAR
6+
uuid
7+
CHAR
78
(
89
36
910
) NOT NULL PRIMARY KEY,

plugin-bukkit/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@
242242
</relocation>
243243
<relocation>
244244
<pattern>dev.jorel.commandapi</pattern>
245-
<shadedPattern>io.github.arcaneplugins.polyconomy.plugin.bukkit.lib.commandapi</shadedPattern>
245+
<shadedPattern>io.github.arcaneplugins.polyconomy.plugin.bukkit.lib.commandapi
246+
</shadedPattern>
246247
</relocation>
247248
<relocation>
248249
<pattern>de.themoep.minedown</pattern>

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/command/balance/BalanceCommand.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ object BalanceCommand : InternalCmd {
3838
throw plugin.translations.commandApiFailure()
3939
}
4040

41-
val currency: Currency = args.getOptional("currency").orElseGet { runBlocking {
42-
plugin.storageManager.handler.getPrimaryCurrency()
43-
} } as Currency
41+
val currency: Currency = args.getOptional("currency").orElseGet {
42+
runBlocking {
43+
plugin.storageManager.handler.getPrimaryCurrency()
44+
}
45+
} as Currency
4446

4547
val balance = runBlocking {
4648
plugin.storageManager.handler.getOrCreatePlayerAccount(
@@ -53,11 +55,13 @@ object BalanceCommand : InternalCmd {
5355
currency.format(balance, plugin.settingsCfg.defaultLocale())
5456
}
5557

56-
plugin.translations.commandBalanceView.sendTo(sender, placeholders = mapOf(
57-
"target-name" to Supplier { targetPlayer.name ?: targetPlayer.uniqueId.toString() },
58-
"balance" to Supplier { balanceFmt },
59-
"currency" to Supplier { currency.name },
60-
))
58+
plugin.translations.commandBalanceView.sendTo(
59+
sender, placeholders = mapOf(
60+
"target-name" to Supplier { targetPlayer.name ?: targetPlayer.uniqueId.toString() },
61+
"balance" to Supplier { balanceFmt },
62+
"currency" to Supplier { currency.name },
63+
)
64+
)
6165
})
6266
}
6367

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/command/balancetop/BalancetopCommand.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ object BalancetopCommand : InternalCmd {
2929
val page = args.getOptional("page").orElse(1) as Int
3030

3131
if (page < 1) {
32-
plugin.translations.commandBalancetopErrorPageTooLow.sendTo(sender, placeholders = mapOf(
33-
"%page%" to Supplier { page.toString()}
32+
plugin.translations.commandBalancetopErrorPageTooLow.sendTo(
33+
sender, placeholders = mapOf(
34+
"%page%" to Supplier { page.toString() }
3435
))
3536
throw plugin.translations.commandApiFailure()
3637
}
@@ -64,7 +65,8 @@ object BalancetopCommand : InternalCmd {
6465
currency.getDisplayName(true, locale)
6566
}
6667

67-
plugin.translations.commandBalancetopHeader.sendTo(sender, placeholders = mapOf(
68+
plugin.translations.commandBalancetopHeader.sendTo(
69+
sender, placeholders = mapOf(
6870
"page" to Supplier { page.toString() },
6971
"currency" to Supplier { currencyName }
7072
))
@@ -73,7 +75,8 @@ object BalancetopCommand : InternalCmd {
7375
plugin.translations.commandBalancetopNoEntriesOnPage.sendTo(sender)
7476
} else {
7577
baltop.onEachIndexed { index, (username, balance) ->
76-
plugin.translations.commandBalancetopEntry.sendTo(sender, placeholders = mapOf(
78+
plugin.translations.commandBalancetopEntry.sendTo(
79+
sender, placeholders = mapOf(
7780
"rank" to Supplier { (((page - 1) * PAGE_SIZE) + index + 1).toString() },
7881
"target-name" to Supplier { username },
7982
"balance" to Supplier { runBlocking { currency.format(balance, locale) } }

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/command/pay/PayCommand.kt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ object PayCommand : InternalCmd {
4444
val amountBd = amount.toBigDecimal()
4545

4646
if (amount <= 0) {
47-
plugin.translations.commandGenericAmountZeroOrLess.sendTo(sender, placeholders = mapOf(
47+
plugin.translations.commandGenericAmountZeroOrLess.sendTo(
48+
sender, placeholders = mapOf(
4849
"amount" to Supplier { amount.toString() }
4950
))
5051
throw plugin.translations.commandApiFailure()
@@ -68,7 +69,8 @@ object PayCommand : InternalCmd {
6869
}
6970

7071
if (!canAfford) {
71-
plugin.translations.commandPayErrorCantAfford.sendTo(sender, placeholders = mapOf(
72+
plugin.translations.commandPayErrorCantAfford.sendTo(
73+
sender, placeholders = mapOf(
7274
"amount" to Supplier { amount.toString() },
7375
"balance" to Supplier { runBlocking { senderAccount.getBalance(currency).toString() } },
7476
"currency" to Supplier { currency.name }
@@ -111,13 +113,15 @@ object PayCommand : InternalCmd {
111113
currency.format(senderAccount.getBalance(currency), plugin.settingsCfg.defaultLocale())
112114
}
113115

114-
plugin.translations.commandPaySuccess.sendTo(sender, placeholders = mapOf(
115-
"amount" to Supplier { amountFmt },
116-
"balance" to Supplier { newBalance },
117-
"currency" to Supplier { currency.name },
118-
"target-name" to Supplier { targetPlayer.name ?: targetPlayer.uniqueId.toString() },
119-
"target-balance" to Supplier { runBlocking { targetAccount.getBalance(currency).toString() } },
120-
))
116+
plugin.translations.commandPaySuccess.sendTo(
117+
sender, placeholders = mapOf(
118+
"amount" to Supplier { amountFmt },
119+
"balance" to Supplier { newBalance },
120+
"currency" to Supplier { currency.name },
121+
"target-name" to Supplier { targetPlayer.name ?: targetPlayer.uniqueId.toString() },
122+
"target-balance" to Supplier { runBlocking { targetAccount.getBalance(currency).toString() } },
123+
)
124+
)
121125
})
122126
}
123127

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/command/polyconomy/subcommand/CurrencySubcommand.kt

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ object CurrencySubcommand : InternalCmd {
3636
.withPermission(PolyconomyPerm.COMMAND_POLYCONOMY_CURRENCY_SET.toString())
3737
.withArguments(
3838
CustomArguments.currencyArgument(plugin, "currency"),
39-
CustomArguments.identityStringArgument(plugin, "new"))
39+
CustomArguments.identityStringArgument(plugin, "new")
40+
)
4041
.executes(CommandExecutor { sender, args ->
4142
val currency = args.get("currency") as Currency
4243
val new = args.get("new") as String
@@ -55,7 +56,8 @@ object CurrencySubcommand : InternalCmd {
5556
.withPermission(PolyconomyPerm.COMMAND_POLYCONOMY_CURRENCY_SET.toString())
5657
.withArguments(
5758
CustomArguments.currencyArgument(plugin, "currency"),
58-
DoubleArgument("newValue"))
59+
DoubleArgument("newValue")
60+
)
5961
.executes(CommandExecutor { sender, args ->
6062
val currency = args.get("currency") as Currency
6163
val newValue = args.get("newValue") as Double
@@ -75,7 +77,8 @@ object CurrencySubcommand : InternalCmd {
7577
.withPermission(PolyconomyPerm.COMMAND_POLYCONOMY_CURRENCY_SET.toString())
7678
.withArguments(
7779
CustomArguments.currencyArgument(plugin, "currency"),
78-
TextArgument("newValue"))
80+
TextArgument("newValue")
81+
)
7982
.executes(CommandExecutor { sender, args ->
8083
val currency = args.get("currency") as Currency
8184
val newValue = args.get("newValue") as String
@@ -92,8 +95,10 @@ object CurrencySubcommand : InternalCmd {
9295
}),
9396
CommandAPICommand("amountFormat")
9497
.withPermission(PolyconomyPerm.COMMAND_POLYCONOMY_CURRENCY_SET.toString())
95-
.withArguments(CustomArguments.currencyArgument(plugin, "currency"),
96-
TextArgument("newValue"))
98+
.withArguments(
99+
CustomArguments.currencyArgument(plugin, "currency"),
100+
TextArgument("newValue")
101+
)
97102
.executes(CommandExecutor { sender, args ->
98103
val currency = args.get("currency") as Currency
99104
val newValue = args.get("newValue") as String
@@ -127,8 +132,10 @@ object CurrencySubcommand : InternalCmd {
127132
}),
128133
CommandAPICommand("conversionRate")
129134
.withPermission(PolyconomyPerm.COMMAND_POLYCONOMY_CURRENCY_SET.toString())
130-
.withArguments(CustomArguments.currencyArgument(plugin, "currency"),
131-
DoubleArgument("newValue"))
135+
.withArguments(
136+
CustomArguments.currencyArgument(plugin, "currency"),
137+
DoubleArgument("newValue")
138+
)
132139
.executes(CommandExecutor { sender, args ->
133140
val currency = args.get("currency") as Currency
134141
val newValue = args.get("newValue") as Double
@@ -269,7 +276,7 @@ object CurrencySubcommand : InternalCmd {
269276
sender.sendMessage("${ChatColor.YELLOW}${operation}: Processing...")
270277

271278
// if they are trying to unregister the last locale left, stop
272-
if (runBlocking { currency.getLocaleDecimalMap().size < 2}) {
279+
if (runBlocking { currency.getLocaleDecimalMap().size < 2 }) {
273280
// todo translatable message
274281
sender.sendMessage("${RED}${operation} Error: There must be 2 or more locales in this currency so the currency has another locale to fallback one. Try creating the new locale first with `register`, or adjust the values of this existing one with `set`.")
275282
throw plugin.translations.commandApiFailure()
@@ -311,23 +318,28 @@ object CurrencySubcommand : InternalCmd {
311318
val dispNameSingular = args.get("dispNameSingular") as String
312319
val dispNamePlural = args.get("dispNamePlural") as String
313320
val dispDecimal = args.get("dispDecimal") as String
314-
val presentationFormat: String = args.getOptional("presentationFormat").orElse(Currency.DEFAULT_PRESENTATION_FORMAT) as String
315-
val amountFormat: String = args.getOptional("amountFormat").orElse(Currency.DEFAULT_AMOUNT_FORMAT) as String
321+
val presentationFormat: String =
322+
args.getOptional("presentationFormat").orElse(Currency.DEFAULT_PRESENTATION_FORMAT) as String
323+
val amountFormat: String =
324+
args.getOptional("amountFormat").orElse(Currency.DEFAULT_AMOUNT_FORMAT) as String
316325

317326
val currencyAlreadyExists = runBlocking {
318327
plugin.storageManager.handler.hasCurrency(name)
319328
}
320329

321330
if (currencyAlreadyExists) {
322-
plugin.translations.commandPolyconomyCurrencyRegisterErrorAlreadyExists.sendTo(sender, mapOf(
331+
plugin.translations.commandPolyconomyCurrencyRegisterErrorAlreadyExists.sendTo(
332+
sender, mapOf(
323333
"currency" to Supplier { name }
324334
))
325335
throw plugin.translations.commandApiFailure()
326336
}
327337

328-
plugin.translations.commandPolyconomyCurrencyRegisterStarted.sendTo(sender, placeholders = mapOf(
329-
"currency" to Supplier { name },
330-
))
338+
plugin.translations.commandPolyconomyCurrencyRegisterStarted.sendTo(
339+
sender, placeholders = mapOf(
340+
"currency" to Supplier { name },
341+
)
342+
)
331343

332344
Bukkit.getServer().scheduler.runTaskAsynchronously(plugin) { ->
333345
runBlocking {
@@ -344,7 +356,8 @@ object CurrencySubcommand : InternalCmd {
344356
)
345357
}
346358

347-
plugin.translations.commandPolyconomyCurrencyRegisterSuccess.sendTo(sender, placeholders = mapOf(
359+
plugin.translations.commandPolyconomyCurrencyRegisterSuccess.sendTo(
360+
sender, placeholders = mapOf(
348361
"currency" to Supplier { name }
349362
))
350363
}
@@ -360,13 +373,15 @@ object CurrencySubcommand : InternalCmd {
360373
.executes(CommandExecutor { sender, args ->
361374
val currency = args.get("currency") as Currency
362375

363-
plugin.translations.commandPolyconomyCurrencyUnregisterStarted.sendTo(sender, mapOf(
376+
plugin.translations.commandPolyconomyCurrencyUnregisterStarted.sendTo(
377+
sender, mapOf(
364378
"currency" to Supplier { currency.name }
365379
))
366380

367381
runBlocking {
368382
if (currency.isPrimary()) {
369-
plugin.translations.commandPolyconomyCurrencyUnregisterErrorIsPrimary.sendTo(sender, mapOf(
383+
plugin.translations.commandPolyconomyCurrencyUnregisterErrorIsPrimary.sendTo(
384+
sender, mapOf(
370385
"currency" to Supplier { currency.name }
371386
))
372387
throw plugin.translations.commandApiFailure()
@@ -377,7 +392,8 @@ object CurrencySubcommand : InternalCmd {
377392
runBlocking {
378393
plugin.storageManager.handler.unregisterCurrency(currency)
379394

380-
plugin.translations.commandPolyconomyCurrencyUnregisterCompleted.sendTo(sender, mapOf(
395+
plugin.translations.commandPolyconomyCurrencyUnregisterCompleted.sendTo(
396+
sender, mapOf(
381397
"currency" to Supplier { currency.name }
382398
))
383399
}

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/command/polyconomy/subcommand/DepositSubcommand.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ object DepositSubcommand : InternalCmd {
3737
}
3838

3939
if (amount <= 0) {
40-
plugin.translations.commandGenericAmountZeroOrLess.sendTo(sender, placeholders = mapOf(
40+
plugin.translations.commandGenericAmountZeroOrLess.sendTo(
41+
sender, placeholders = mapOf(
4142
"amount" to Supplier { amount.toString() }
4243
))
4344
throw plugin.translations.commandApiFailure()
@@ -71,11 +72,13 @@ object DepositSubcommand : InternalCmd {
7172
}
7273
val targetName = targetPlayer.name ?: targetPlayer.uniqueId.toString()
7374

74-
plugin.translations.commandPolyconomyDepositCompleted.sendTo(sender, placeholders = mapOf(
75-
"amount" to Supplier { amountFormatted },
76-
"target-name" to Supplier { targetName },
77-
"currency" to Supplier { currency.name },
78-
))
75+
plugin.translations.commandPolyconomyDepositCompleted.sendTo(
76+
sender, placeholders = mapOf(
77+
"amount" to Supplier { amountFormatted },
78+
"target-name" to Supplier { targetName },
79+
"currency" to Supplier { currency.name },
80+
)
81+
)
7982
})
8083
}
8184
}

plugin-bukkit/src/main/kotlin/io/github/arcaneplugins/polyconomy/plugin/bukkit/command/polyconomy/subcommand/ReloadSubcommand.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ object ReloadSubcommand : InternalCmd {
2121
plugin.softReload()
2222
plugin.translations.commandPolyconomyReloadCompleted.sendTo(sender)
2323
} catch (ex: Throwable) {
24-
plugin.translations.commandPolyconomyReloadErrorGeneric.sendTo(sender, placeholders = mapOf(
25-
"message" to Supplier { ex.message ?: ex::class.java.canonicalName },
26-
))
24+
plugin.translations.commandPolyconomyReloadErrorGeneric.sendTo(
25+
sender, placeholders = mapOf(
26+
"message" to Supplier { ex.message ?: ex::class.java.canonicalName },
27+
)
28+
)
2729
if (ex !is DescribedThrowable) {
2830
plugin.nativeLogger.severe("An error occurred whilst reloading Polyconomy via the `reload` subcommand. Stack trace:")
2931
ex.printStackTrace()

0 commit comments

Comments
 (0)