mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
update from v1.x.x
This commit is contained in:
parent
b56782b234
commit
eeff628da6
3 changed files with 9 additions and 14 deletions
|
|
@ -23,7 +23,7 @@ interface CASubCommand {
|
|||
|
||||
fun description(): String
|
||||
|
||||
protected fun allEnchantmentsByName(): Collection<String> {
|
||||
fun allEnchantmentsByName(): Collection<String> {
|
||||
val names = mutableSetOf<String>()
|
||||
for (enchantment in CAEnchantmentRegistry.getInstance().values()) {
|
||||
names.add(enchantment.name)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ class EditConfigExecutor : CASubCommand {
|
|||
return sender.hasPermission(CustomAnvil.editConfigPermission)
|
||||
}
|
||||
|
||||
override fun description(): String {
|
||||
return "Gui to edit the plugin's config"
|
||||
}
|
||||
|
||||
override fun executeCommand(
|
||||
sender: CommandSender,
|
||||
cmd: Command,
|
||||
|
|
@ -68,7 +72,7 @@ class EditConfigExecutor : CASubCommand {
|
|||
return
|
||||
}
|
||||
} else {
|
||||
enchantToFilter = HashSet(EnchantmentApi.getListByName(args[1].lowercase()))
|
||||
enchantToFilter = HashSet(EnchantmentApi.getByName(args[1].lowercase()))
|
||||
|
||||
if (enchantToFilter.isEmpty()) {
|
||||
sender.sendMessage("No enchantment found with the name \"${args[1]}\"")
|
||||
|
|
@ -112,15 +116,6 @@ class EditConfigExecutor : CASubCommand {
|
|||
else -> listOf()
|
||||
}
|
||||
)
|
||||
override fun tabCompleter(
|
||||
sender: CommandSender,
|
||||
args: Array<out String>,
|
||||
list: MutableList<String>
|
||||
) {
|
||||
}
|
||||
|
||||
override fun description(): String {
|
||||
return "Gui to edit the plugin's config"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import org.bukkit.entity.HumanEntity
|
|||
import xyz.alexcrea.cuanvil.api.EnchantmentApi
|
||||
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
|
||||
|
||||
class EnchantExecutor : CASubCommand() {
|
||||
class EnchantExecutor : CASubCommand {
|
||||
|
||||
|
||||
override fun allowed(sender: CommandSender): Boolean {
|
||||
|
|
@ -44,7 +44,7 @@ class EnchantExecutor : CASubCommand() {
|
|||
}
|
||||
}
|
||||
|
||||
val enchants = EnchantmentApi.getListByName(args[0].lowercase())
|
||||
val enchants = EnchantmentApi.getByName(args[0].lowercase())
|
||||
if (enchants.isEmpty()) {
|
||||
sender.sendMessage("Enchantment not found: ${args[0]}")
|
||||
return true
|
||||
|
|
@ -92,7 +92,7 @@ class EnchantExecutor : CASubCommand() {
|
|||
sender: HumanEntity,
|
||||
name: String
|
||||
): Collection<String> {
|
||||
val enchants = EnchantmentApi.getListByName(name.lowercase())
|
||||
val enchants = EnchantmentApi.getByName(name.lowercase())
|
||||
if (enchants.isEmpty()) return listOf()
|
||||
|
||||
val enchant = enchants.iterator().next()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue