Added amount to /boosters give
This commit is contained in:
@@ -51,7 +51,7 @@ class Booster(
|
||||
return ItemStackBuilder(Items.lookup(config.getString("gui.item")))
|
||||
.setDisplayName(config.getFormattedString("gui.name"))
|
||||
.addLoreLines(
|
||||
config.getFormattedStrings("gui.lore", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
|
||||
config.getStrings("gui.lore")
|
||||
.map { it.replace("%amount%", player.getAmountOfBooster(this).toString()) }
|
||||
.formatEco(player)
|
||||
)
|
||||
|
||||
@@ -36,6 +36,12 @@ class CommandGive(plugin: EcoPlugin) :
|
||||
return
|
||||
}
|
||||
|
||||
var amount = 1
|
||||
|
||||
if (args.size >= 3) {
|
||||
amount = args[2].toIntOrNull() ?: amount
|
||||
}
|
||||
|
||||
this.plugin.scheduler.runAsync {
|
||||
@Suppress("DEPRECATION")
|
||||
val player = Bukkit.getOfflinePlayer(args[0])
|
||||
@@ -45,13 +51,14 @@ class CommandGive(plugin: EcoPlugin) :
|
||||
}
|
||||
|
||||
this.plugin.scheduler.run {
|
||||
player.setAmountOfBooster(booster, player.getAmountOfBooster(booster) + 1)
|
||||
player.setAmountOfBooster(booster, player.getAmountOfBooster(booster) + amount)
|
||||
}
|
||||
|
||||
sender.sendMessage(
|
||||
plugin.langYml.getMessage("gave-booster", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
|
||||
.replace("%player%", player.name ?: return@runAsync)
|
||||
.replace("%booster%", booster.id)
|
||||
.replace("%amount%", amount.toString())
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -77,6 +84,22 @@ class CommandGive(plugin: EcoPlugin) :
|
||||
return completions
|
||||
}
|
||||
|
||||
if (args.size == 3) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[1],
|
||||
listOf(
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"10"
|
||||
),
|
||||
completions
|
||||
)
|
||||
return completions
|
||||
}
|
||||
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user