Мелкие доработки
This commit is contained in:
parent
8d8c527110
commit
870e5534fa
@ -113,7 +113,7 @@ class Vp_server_integration() : JavaPlugin(), CommandExecutor {
|
|||||||
COMMAND_REMOVE_MODE = properties.getProperty("command_remove_mode", DEFAULT_COMMAND_REMOVE_MODE).replace("'", "")
|
COMMAND_REMOVE_MODE = properties.getProperty("command_remove_mode", DEFAULT_COMMAND_REMOVE_MODE).replace("'", "")
|
||||||
COMMAND_REMOVE_COINS = properties.getProperty("command_remove_coins", DEFAULT_COMMAND_REMOVE_COINS).replace("'", "")
|
COMMAND_REMOVE_COINS = properties.getProperty("command_remove_coins", DEFAULT_COMMAND_REMOVE_COINS).replace("'", "")
|
||||||
COMMAND_REMOVE_ERROR = properties.getProperty("command_remove_error", DEFAULT_COMMAND_REMOVE_ERROR).replace("'", "")
|
COMMAND_REMOVE_ERROR = properties.getProperty("command_remove_error", DEFAULT_COMMAND_REMOVE_ERROR).replace("'", "")
|
||||||
LOCAL_CURRENCY_MINIMUM = properties.getProperty("command_remove_error", DEFAULT_LOCAL_CURRENCY_MINIMUM.toString()).replace("'", "").toDouble()
|
LOCAL_CURRENCY_MINIMUM = properties.getProperty("local_currency_minimum", DEFAULT_LOCAL_CURRENCY_MINIMUM.toString()).replace("'", "").toDouble()
|
||||||
COURSE_MODE = properties.getProperty("course_mode", DEFAULT_COURSE_MODE).replace("'", "")
|
COURSE_MODE = properties.getProperty("course_mode", DEFAULT_COURSE_MODE).replace("'", "")
|
||||||
COURSE_STATIC_VALUE = properties.getProperty("course_static_value", DEFAULT_COURSE_STATIC_VALUE.toString()).replace("'", "").toDouble()
|
COURSE_STATIC_VALUE = properties.getProperty("course_static_value", DEFAULT_COURSE_STATIC_VALUE.toString()).replace("'", "").toDouble()
|
||||||
COURSE_DYNAMIC_COMMAND = properties.getProperty("course_dynamic_command", DEFAULT_COURSE_DYNAMIC_COMMAND).replace("'", "")
|
COURSE_DYNAMIC_COMMAND = properties.getProperty("course_dynamic_command", DEFAULT_COURSE_DYNAMIC_COMMAND).replace("'", "")
|
||||||
@ -313,8 +313,8 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
when (direction) {
|
when (direction) {
|
||||||
"vpc" -> handleVpcConversion(sender, amount, course, args)
|
"vpc" -> handleVpcConversion(sender, Utils.round(amount, NUM_AFTER_DOT), course, args)
|
||||||
"lc" -> handleLcConversion(sender, amount, course, args)
|
"lc" -> handleLcConversion(sender, Utils.round(amount, NUM_AFTER_DOT), course, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +373,10 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amountVPC < 0.0001 || amount < 1)
|
if (amountVPC < 0.0001 || amount < LOCAL_CURRENCY_MINIMUM) {
|
||||||
|
Utils.send(sender, "&cСлишком маленькая входная или выходная сумма.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (args.size == 4) {
|
if (args.size == 4) {
|
||||||
// Execute confirmed conversion
|
// Execute confirmed conversion
|
||||||
@ -415,9 +418,14 @@ invoice_timeout_seconds=$DEFAULT_INVOICE_TIMEOUT_SECONDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Amount: $amount, Course: $course")
|
LOGGER.info("Amount: $amount, Course: $course")
|
||||||
val amountLC = amount * course * (1 + COURSE_COMMISSION / 100)
|
val amountLC = Utils.round(amount * course * (1 + COURSE_COMMISSION / 100), NUM_AFTER_DOT)
|
||||||
LOGGER.info("Converted amount: $amountLC")
|
LOGGER.info("Converted amount: $amountLC")
|
||||||
|
|
||||||
|
if (amount < 0.0001 || amountLC < LOCAL_CURRENCY_MINIMUM) {
|
||||||
|
Utils.send(sender, "&cСлишком маленькая входная или выходная сумма.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Create new invoice
|
// Create new invoice
|
||||||
val invoiceId = VpcApi.create_invoice(amount).toString()
|
val invoiceId = VpcApi.create_invoice(amount).toString()
|
||||||
TO_PAY_INVOICES[sender.name] = invoiceId
|
TO_PAY_INVOICES[sender.name] = invoiceId
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user