From be9a394c7fa95578baab9e95ad3b8a94b3a9261c Mon Sep 17 00:00:00 2001 From: justuser-31 Date: Tue, 25 Nov 2025 07:32:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8,=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B5=D1=89=D1=91=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/vp_server_integration/TotalBalanceModules.kt | 4 ++++ .../main/vp_server_integration/Vp_server_integration.kt | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/main/vp_server_integration/TotalBalanceModules.kt b/src/main/kotlin/main/vp_server_integration/TotalBalanceModules.kt index 9b41c0a..1aa7c11 100644 --- a/src/main/kotlin/main/vp_server_integration/TotalBalanceModules.kt +++ b/src/main/kotlin/main/vp_server_integration/TotalBalanceModules.kt @@ -9,6 +9,10 @@ import main.vp_server_integration.Vp_server_integration.Companion.LOGGER class TotalBalanceModules { companion object { fun getEssentialsBalance(): Float { + LOGGER.info("Calculating dynamic rate using baltop") + // Force update balance top and delay to avoid empty string + CommandCapture.execute("baltop force") + Thread.sleep(300) val output = CommandCapture.execute("baltop") LOGGER.info("Balance top command output: $output") diff --git a/src/main/kotlin/main/vp_server_integration/Vp_server_integration.kt b/src/main/kotlin/main/vp_server_integration/Vp_server_integration.kt index 847fe24..7ef6847 100644 --- a/src/main/kotlin/main/vp_server_integration/Vp_server_integration.kt +++ b/src/main/kotlin/main/vp_server_integration/Vp_server_integration.kt @@ -306,8 +306,6 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS */ private fun calculateDynamicRate(): Double { return if (COURSE_DYNAMIC_COMMAND == "baltop force") { - LOGGER.info("Calculating dynamic rate using baltop - Step 4.1") - CommandCapture.execute("baltop force") val globalBalance = TotalBalanceModules.getEssentialsBalance() LOGGER.info("Global balance: $globalBalance") @@ -418,7 +416,7 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS */ private fun sendPaymentPrompt(sender: Player, amount: Double, amountLC: Double, invoiceId: String?) { val colored = ChatColor.translateAlternateColorCodes('&', - "${PREFIX}Нажмите здесь, чтобы конвертировать &6$amount VPC &3d &6${String.format("%.4f", amountLC)}") + "${PREFIX}Нажмите здесь, чтобы конвертировать &6$amount VPC &3в &6${String.format("%.4f", amountLC)}") val message = TextComponent(colored) message.clickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/vpc pay $USERNAME $amount $invoiceId") message.hoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, @@ -629,6 +627,7 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS val entry = authIterator.next() val invoiceId = entry.value val creationTime = INVOICE_CREATION_TIMES[invoiceId] ?: continue + LOGGER.info("invoice ( $invoiceId ) left to live: ${timeoutMillis - (currentTime - creationTime)}") if (currentTime - creationTime > timeoutMillis) { LOGGER.info("Deleting expired auth invoice: $invoiceId") @@ -659,6 +658,7 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS val entry = paymentIterator.next() val invoiceId = entry.value val creationTime = INVOICE_CREATION_TIMES[invoiceId] ?: continue + LOGGER.info("invoice ( $invoiceId ) left to live: ${timeoutMillis - (currentTime - creationTime)}") if (currentTime - creationTime > timeoutMillis) { LOGGER.info("Deleting expired payment invoice: $invoiceId")