Minimum charge

This commit is contained in:
TomTom 2024-03-20 14:38:33 +01:00
parent 7dcbb3ae64
commit 2d6b05090e
5 changed files with 10 additions and 4 deletions

View File

@ -48,6 +48,8 @@ class Config(file: File, stream: InputStream) {
@JvmStatic
fun CHARGE_PRICE() = AxMinionsAPI.INSTANCE.getConfig().get("charge.price", 10000.0)
@JvmStatic
fun MINIMUM_CHARGE() = AxMinionsAPI.INSTANCE.getConfig().get("charge.minimum-charge", 30)
@JvmStatic
fun TIMER_FORMAT() = AxMinionsAPI.INSTANCE.getConfig().get("timer-format", 1)
@JvmStatic
fun GUI_SIZE() = AxMinionsAPI.INSTANCE.getConfig().get<Int>("gui.size")

View File

@ -60,6 +60,8 @@ class Messages(file: File, stream: InputStream) {
@JvmStatic
fun CHARGE_FAIL() = AxMinionsAPI.INSTANCE.getMessages().get<String>("charge.not-enough-money")
@JvmStatic
fun CHARGE_NOT_ENOUGH_TIME_PASSED() = AxMinionsAPI.INSTANCE.getMessages().get<String>("charge.not-enough-time-passed")
@JvmStatic
fun WRONG_TOOL() = AxMinionsAPI.INSTANCE.getMessages().get<String>("tools.wrong-tool")
@JvmStatic
fun ERROR_INVENTORY_FULL() = AxMinionsAPI.INSTANCE.getMessages().get<String>("errors.inventory-full")

View File

@ -183,8 +183,8 @@ class MinionInventoryListener : Listener {
val chargeSeconds = (minion.getCharge() - System.currentTimeMillis()) / 1000
if ((Config.MAX_CHARGE() * 60) - chargeSeconds < 10) {
println("Not enough time has passed!")
if ((Config.MAX_CHARGE() * 60) - chargeSeconds < Config.MINIMUM_CHARGE()) {
player.sendMessage(StringUtils.formatToString(Messages.PREFIX() + Messages.CHARGE_NOT_ENOUGH_TIME_PASSED()))
return
}

View File

@ -72,6 +72,7 @@ charge:
amount: 1800 # in seconds
max-charge: 1440 # in minutes
price: 10000
minimum-charge: 30 # in seconds
# 1 - HH:MM:SS, for example 01:25:35
# 2 - short format, for example 20m
@ -125,4 +126,4 @@ gui:
debug: false
# Do not change!
config-version: 7
config-version: 8

View File

@ -68,9 +68,10 @@ directions:
charge:
charge: "<green>You have added <white>30 minutes</white> of charge to your minion!"
not-enough-money: "<red>You don't have enough money to charge this minion!"
not-enough-time-passed: "<red>Your minion is nearly fully charged! Wait a bit before charging it again!"
tools:
wrong-tool: "<red>You can't place this item as the tool if this minion!"
# Do not change!
config-version: 3
config-version: 4