diff --git a/src/main/kotlin/net/trueog/diamondbankog/commands/Balance.kt b/src/main/kotlin/net/trueog/diamondbankog/commands/Balance.kt index 0202b41..39d3078 100644 --- a/src/main/kotlin/net/trueog/diamondbankog/commands/Balance.kt +++ b/src/main/kotlin/net/trueog/diamondbankog/commands/Balance.kt @@ -78,10 +78,6 @@ internal class Balance : CommandExecutor { } val totalBalance = balance.bank + balance.inventory + balance.enderChest - val totalDiamonds = CommonOperations.shardsToDiamonds(totalBalance) - val bankDiamonds = CommonOperations.shardsToDiamonds(balance.bank) - val inventoryDiamonds = CommonOperations.shardsToDiamonds(balance.inventory) - val enderChestDiamonds = CommonOperations.shardsToDiamonds(balance.enderChest) sender.sendMessage( mm.deserialize( "${config.prefix}: ${ @@ -91,10 +87,10 @@ internal class Balance : CommandExecutor { ) }${balancePlayer.name}" }:\n" + - "Bank: $bankDiamonds Diamond${if (bankDiamonds != "1.0") "s" else ""}\n" + - "Inventory: $inventoryDiamonds Diamond${if (inventoryDiamonds != "1.0") "s" else ""}\n" + - "Ender Chest: $enderChestDiamonds Diamond${if (enderChestDiamonds != "1.0") "s" else ""}\n" + - "Total: $totalDiamonds Diamond${if (totalDiamonds != "1.0") "s" else ""}" + "Bank: ${CommonOperations.shardsToDiamondsFull(balance.bank)}\n" + + "Inventory: ${CommonOperations.shardsToDiamondsFull(balance.inventory)}\n" + + "Ender Chest: ${CommonOperations.shardsToDiamondsFull(balance.enderChest)}\n" + + "Total: ${CommonOperations.shardsToDiamondsFull(totalBalance)}" ) ) return@launch diff --git a/src/main/kotlin/net/trueog/diamondbankog/commands/Deposit.kt b/src/main/kotlin/net/trueog/diamondbankog/commands/Deposit.kt index 0423547..7ee83e6 100644 --- a/src/main/kotlin/net/trueog/diamondbankog/commands/Deposit.kt +++ b/src/main/kotlin/net/trueog/diamondbankog/commands/Deposit.kt @@ -94,10 +94,9 @@ internal class Deposit : CommandExecutor { .toLong() } if (shards != -1L && removedInShards != shards) { - val shardsInDiamonds = CommonOperations.shardsToDiamonds(shards) sender.sendMessage( mm.deserialize( - "${config.prefix}: You do not have $shardsInDiamonds Diamond${if (shardsInDiamonds != "1.0") "s" else ""} to deposit." + "${config.prefix}: You do not have ${CommonOperations.shardsToDiamondsFull(shards)} to deposit." ) ) sender.inventory.unlock() @@ -119,10 +118,9 @@ internal class Deposit : CommandExecutor { sender.inventory.unlock() } - val diamondsDeposited = CommonOperations.shardsToDiamonds(removedInShards) sender.sendMessage( mm.deserialize( - "${config.prefix}: Successfully deposited $diamondsDeposited Diamond${if (diamondsDeposited != "1.0") "s" else ""} into your bank account." + "${config.prefix}: Successfully deposited ${CommonOperations.shardsToDiamondsFull(removedInShards)} into your bank account." ) ) diff --git a/src/main/kotlin/net/trueog/diamondbankog/commands/Pay.kt b/src/main/kotlin/net/trueog/diamondbankog/commands/Pay.kt index b3fc157..e874918 100644 --- a/src/main/kotlin/net/trueog/diamondbankog/commands/Pay.kt +++ b/src/main/kotlin/net/trueog/diamondbankog/commands/Pay.kt @@ -93,10 +93,9 @@ internal class Pay : CommandExecutor { CommonOperations.consume(sender.uniqueId, shards, inventorySnapshot).getOrElse { when (it) { is DiamondBankException.InsufficientFundsException -> { - val shortInDiamonds = CommonOperations.shardsToDiamonds(it.short) sender.sendMessage( mm.deserialize( - "${config.prefix}: You are $shortInDiamonds Diamond${if (shortInDiamonds != "1.0") "s" else ""} short for that payment." + "${config.prefix}: You are ${CommonOperations.shardsToDiamondsFull(it.short)} short for that payment." ) ) sender.inventory.unlock() @@ -126,8 +125,6 @@ internal class Pay : CommandExecutor { return@tryWithLockSuspend } - val diamondsPaid = CommonOperations.shardsToDiamonds(shards) - runOnMainThread { inventorySnapshot.restoreTo(sender.inventory) sender.inventory.unlock() @@ -135,7 +132,7 @@ internal class Pay : CommandExecutor { sender.sendMessage( mm.deserialize( - "${config.prefix}: Successfully paid $diamondsPaid Diamond${if (diamondsPaid != "1.0") "s" else ""} to ${ + "${config.prefix}: Successfully paid ${CommonOperations.shardsToDiamondsFull(shards)} to ${ getPrefix( receiver.uniqueId ) @@ -151,7 +148,7 @@ internal class Pay : CommandExecutor { getPrefix( sender.uniqueId ) - } ${sender.name} has paid you $diamondsPaid Diamond${if (diamondsPaid != "1.0") "s" else ""}." + } ${sender.name} has paid you ${CommonOperations.shardsToDiamondsFull(shards)}." ) ) } diff --git a/src/main/kotlin/net/trueog/diamondbankog/commands/Withdraw.kt b/src/main/kotlin/net/trueog/diamondbankog/commands/Withdraw.kt index 7c63858..c59f319 100644 --- a/src/main/kotlin/net/trueog/diamondbankog/commands/Withdraw.kt +++ b/src/main/kotlin/net/trueog/diamondbankog/commands/Withdraw.kt @@ -96,14 +96,11 @@ internal class Withdraw : CommandExecutor { shards } - val diamonds = CommonOperations.shardsToDiamonds(shardsToWithdraw) - val bankDiamonds = CommonOperations.shardsToDiamonds(bankShards) - if (shards != -1L && shards > bankShards) { sender.inventory.unlock() sender.sendMessage( mm.deserialize( - "${config.prefix}: Cannot withdraw $diamonds Diamond${if (diamonds != "1.0") "s" else ""} because your bank only contains $bankDiamonds Diamond${if (bankDiamonds != "1.0") "s" else ""}." + "${config.prefix}: Cannot withdraw ${CommonOperations.shardsToDiamondsFull(shardsToWithdraw)} because your bank only contains ${CommonOperations.shardsToDiamondsFull(bankShards)}." ) ) return@tryWithLockSuspend @@ -119,7 +116,7 @@ internal class Withdraw : CommandExecutor { sender.inventory.unlock() sender.sendMessage( mm.deserialize( - "${config.prefix}: You don't have enough inventory space to withdraw $diamonds Diamond${if (diamonds != "1.0") "s" else ""}." + "${config.prefix}: You don't have enough inventory space to withdraw ${CommonOperations.shardsToDiamondsFull(shardsToWithdraw)}." ) ) return@tryWithLockSuspend @@ -143,7 +140,7 @@ internal class Withdraw : CommandExecutor { sender.sendMessage( mm.deserialize( - "${config.prefix}: Successfully withdrew $diamonds Diamond${if (diamonds != "1.0") "s" else ""} from your bank account." + "${config.prefix}: Successfully withdrew ${CommonOperations.shardsToDiamondsFull(shardsToWithdraw)} from your bank account." ) )