mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
warn and cancel on datapack setEnchantAsAll enchantment not found
This commit is contained in:
parent
dff35bcc00
commit
58c9fa129a
1 changed files with 5 additions and 1 deletions
|
|
@ -223,7 +223,11 @@ object DataPackDependency {
|
|||
|
||||
private fun setEnchantAsAll(ench: String) {
|
||||
// We assume current is not null and of type CABukkitEnchantment
|
||||
val current = EnchantmentApi.getByKey(NamespacedKey.fromString(ench)!!) as CABukkitEnchantment
|
||||
val current = EnchantmentApi.getByKey(NamespacedKey.fromString(ench)!!) as? CABukkitEnchantment
|
||||
if(current == null) {
|
||||
CustomAnvil.instance.logger.warning("Could not find enchant $ench")
|
||||
return
|
||||
}
|
||||
|
||||
// We need to replace current wrapped enchantment with the all conflict wrapper
|
||||
EnchantmentApi.unregisterEnchantment(current)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue