update from v1.x.x

This commit is contained in:
alexcrea 2026-07-08 03:58:03 +02:00
parent b56782b234
commit eeff628da6
Signed by: alexcrea
GPG key ID: E59DF23EE2A2266C
3 changed files with 9 additions and 14 deletions

View file

@ -23,7 +23,7 @@ interface CASubCommand {
fun description(): String fun description(): String
protected fun allEnchantmentsByName(): Collection<String> { fun allEnchantmentsByName(): Collection<String> {
val names = mutableSetOf<String>() val names = mutableSetOf<String>()
for (enchantment in CAEnchantmentRegistry.getInstance().values()) { for (enchantment in CAEnchantmentRegistry.getInstance().values()) {
names.add(enchantment.name) names.add(enchantment.name)

View file

@ -20,6 +20,10 @@ class EditConfigExecutor : CASubCommand {
return sender.hasPermission(CustomAnvil.editConfigPermission) return sender.hasPermission(CustomAnvil.editConfigPermission)
} }
override fun description(): String {
return "Gui to edit the plugin's config"
}
override fun executeCommand( override fun executeCommand(
sender: CommandSender, sender: CommandSender,
cmd: Command, cmd: Command,
@ -68,7 +72,7 @@ class EditConfigExecutor : CASubCommand {
return return
} }
} else { } else {
enchantToFilter = HashSet(EnchantmentApi.getListByName(args[1].lowercase())) enchantToFilter = HashSet(EnchantmentApi.getByName(args[1].lowercase()))
if (enchantToFilter.isEmpty()) { if (enchantToFilter.isEmpty()) {
sender.sendMessage("No enchantment found with the name \"${args[1]}\"") sender.sendMessage("No enchantment found with the name \"${args[1]}\"")
@ -112,15 +116,6 @@ class EditConfigExecutor : CASubCommand {
else -> listOf() 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"
} }
} }

View file

@ -8,7 +8,7 @@ import org.bukkit.entity.HumanEntity
import xyz.alexcrea.cuanvil.api.EnchantmentApi import xyz.alexcrea.cuanvil.api.EnchantmentApi
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
class EnchantExecutor : CASubCommand() { class EnchantExecutor : CASubCommand {
override fun allowed(sender: CommandSender): Boolean { 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()) { if (enchants.isEmpty()) {
sender.sendMessage("Enchantment not found: ${args[0]}") sender.sendMessage("Enchantment not found: ${args[0]}")
return true return true
@ -92,7 +92,7 @@ class EnchantExecutor : CASubCommand() {
sender: HumanEntity, sender: HumanEntity,
name: String name: String
): Collection<String> { ): Collection<String> {
val enchants = EnchantmentApi.getListByName(name.lowercase()) val enchants = EnchantmentApi.getByName(name.lowercase())
if (enchants.isEmpty()) return listOf() if (enchants.isEmpty()) return listOf()
val enchant = enchants.iterator().next() val enchant = enchants.iterator().next()