Use CommonOperations.shardsToDiamondsFull everywhere #29
No files matched your search
@@ -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}<reset>: <green>${
|
||||
@@ -91,10 +87,10 @@ internal class Balance : CommandExecutor {
|
||||
)
|
||||
}${balancePlayer.name}"
|
||||
}<reset><green>:\n" +
|
||||
"Bank: <yellow>$bankDiamonds <aqua>Diamond${if (bankDiamonds != "1.0") "s" else ""}\n" +
|
||||
"<green>Inventory: <yellow>$inventoryDiamonds <aqua>Diamond${if (inventoryDiamonds != "1.0") "s" else ""}\n" +
|
||||
"<green>Ender Chest: <yellow>$enderChestDiamonds <aqua>Diamond${if (enderChestDiamonds != "1.0") "s" else ""}\n" +
|
||||
"<bold><green>Total: <yellow>$totalDiamonds <aqua>Diamond${if (totalDiamonds != "1.0") "s" else ""}"
|
||||
"Bank: ${CommonOperations.shardsToDiamondsFull(balance.bank)}\n" +
|
||||
"<green>Inventory: ${CommonOperations.shardsToDiamondsFull(balance.inventory)}\n" +
|
||||
"<green>Ender Chest: ${CommonOperations.shardsToDiamondsFull(balance.enderChest)}\n" +
|
||||
"<bold><green>Total: ${CommonOperations.shardsToDiamondsFull(totalBalance)}"
|
||||
)
|
||||
)
|
||||
return@launch
|
||||
|
||||
@@ -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}<reset>: <red>You do not have <yellow>$shardsInDiamonds <aqua>Diamond${if (shardsInDiamonds != "1.0") "s" else ""} <red>to deposit."
|
||||
"${config.prefix}<reset>: <red>You do not have ${CommonOperations.shardsToDiamondsFull(shards)} <red>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}<reset>: <green>Successfully deposited <yellow>$diamondsDeposited <aqua>Diamond${if (diamondsDeposited != "1.0") "s" else ""} <green>into your bank account."
|
||||
"${config.prefix}<reset>: <green>Successfully deposited ${CommonOperations.shardsToDiamondsFull(removedInShards)} <green>into your bank account."
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -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}<reset>: <red>You are <yellow>$shortInDiamonds <aqua>Diamond${if (shortInDiamonds != "1.0") "s" else ""} <red>short for that payment."
|
||||
"${config.prefix}<reset>: <red>You are ${CommonOperations.shardsToDiamondsFull(it.short)} <red>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}<reset>: <green>Successfully paid <yellow>$diamondsPaid <aqua>Diamond${if (diamondsPaid != "1.0") "s" else ""} <green>to ${
|
||||
"${config.prefix}<reset>: <green>Successfully paid ${CommonOperations.shardsToDiamondsFull(shards)} <green>to ${
|
||||
getPrefix(
|
||||
receiver.uniqueId
|
||||
)
|
||||
@@ -151,7 +148,7 @@ internal class Pay : CommandExecutor {
|
||||
getPrefix(
|
||||
sender.uniqueId
|
||||
)
|
||||
} ${sender.name}<reset> <green>has paid you <yellow>$diamondsPaid <aqua>Diamond${if (diamondsPaid != "1.0") "s" else ""}<green>."
|
||||
} ${sender.name}<reset> <green>has paid you ${CommonOperations.shardsToDiamondsFull(shards)}<green>."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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}<reset>: <red>Cannot withdraw <yellow>$diamonds <aqua>Diamond${if (diamonds != "1.0") "s" else ""} <red>because your bank only contains <yellow>$bankDiamonds <aqua>Diamond${if (bankDiamonds != "1.0") "s" else ""}<red>."
|
||||
"${config.prefix}<reset>: <red>Cannot withdraw ${CommonOperations.shardsToDiamondsFull(shardsToWithdraw)} <red>because your bank only contains <yellow>${CommonOperations.shardsToDiamondsFull(bankShards)}<red>."
|
||||
)
|
||||
)
|
||||
return@tryWithLockSuspend
|
||||
@@ -119,7 +116,7 @@ internal class Withdraw : CommandExecutor {
|
||||
sender.inventory.unlock()
|
||||
sender.sendMessage(
|
||||
mm.deserialize(
|
||||
"${config.prefix}<reset>: <red>You don't have enough inventory space to withdraw <yellow>$diamonds <aqua>Diamond${if (diamonds != "1.0") "s" else ""}<red>."
|
||||
"${config.prefix}<reset>: <red>You don't have enough inventory space to withdraw ${CommonOperations.shardsToDiamondsFull(shardsToWithdraw)}<red>."
|
||||
)
|
||||
)
|
||||
return@tryWithLockSuspend
|
||||
@@ -143,7 +140,7 @@ internal class Withdraw : CommandExecutor {
|
||||
|
||||
sender.sendMessage(
|
||||
mm.deserialize(
|
||||
"${config.prefix}<reset>: <green>Successfully withdrew <yellow>$diamonds <aqua>Diamond${if (diamonds != "1.0") "s" else ""} <green>from your bank account."
|
||||
"${config.prefix}<reset>: <green>Successfully withdrew ${CommonOperations.shardsToDiamondsFull(shardsToWithdraw)} <green>from your bank account."
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user