mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-25 15:35:11 +01:00
Fixed hardcoded enchantments not working
This commit is contained in:
parent
046895fbf6
commit
1e690c8eac
@ -22,6 +22,14 @@ class EcoEnchantsCraftEnchantment(
|
|||||||
enchant.enchantment = this
|
enchant.enchantment = this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onRegister() {
|
||||||
|
enchant.onRegister()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRemove() {
|
||||||
|
enchant.onRemove()
|
||||||
|
}
|
||||||
|
|
||||||
override fun canEnchantItem(item: ItemStack): Boolean {
|
override fun canEnchantItem(item: ItemStack): Boolean {
|
||||||
return enchant.canEnchantItem(item)
|
return enchant.canEnchantItem(item)
|
||||||
}
|
}
|
||||||
@ -105,12 +113,11 @@ class EcoEnchantsCraftEnchantment(
|
|||||||
override fun getActiveSlots() = emptySet<EquipmentSlot>()
|
override fun getActiveSlots() = emptySet<EquipmentSlot>()
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return other is EcoEnchantsCraftEnchantment &&
|
return other is EcoEnchant && this.enchantmentKey == other.enchantmentKey
|
||||||
other.key == this.key
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return Objects.hash(this.key)
|
return this.enchantmentKey.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
|
@ -95,7 +95,8 @@ object EcoEnchants : RegistrableCategory<EcoEnchant>("enchant", "enchants") {
|
|||||||
)
|
)
|
||||||
|
|
||||||
for (enchantment in hardcodedEnchantments) {
|
for (enchantment in hardcodedEnchantments) {
|
||||||
if (enchantment.isPresent) {
|
// Only register if not already registered (so hardcode can be overridden)
|
||||||
|
if (enchantment.isPresent && registry[enchantment.id] == null) {
|
||||||
doRegister(plugin, enchantment)
|
doRegister(plugin, enchantment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,4 +126,12 @@ abstract class EcoEnchantBase(
|
|||||||
override fun conflictsWithDirectly(other: Enchantment): Boolean {
|
override fun conflictsWithDirectly(other: Enchantment): Boolean {
|
||||||
return other.key.key in conflictIds
|
return other.key.key in conflictIds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final override fun equals(other: Any?): Boolean {
|
||||||
|
return other is EcoEnchant && this.enchantmentKey == other.enchantmentKey
|
||||||
|
}
|
||||||
|
|
||||||
|
final override fun hashCode(): Int {
|
||||||
|
return this.enchantmentKey.hashCode()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,14 @@ class LegacyDelegatedEnchantment(
|
|||||||
enchant.enchantment = this
|
enchant.enchantment = this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onRegister() {
|
||||||
|
enchant.onRegister()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRemove() {
|
||||||
|
enchant.onRemove()
|
||||||
|
}
|
||||||
|
|
||||||
override fun translationKey(): String {
|
override fun translationKey(): String {
|
||||||
return "ecoenchants:enchantment.$id"
|
return "ecoenchants:enchantment.$id"
|
||||||
}
|
}
|
||||||
@ -89,4 +97,12 @@ class LegacyDelegatedEnchantment(
|
|||||||
replaceWith = ReplaceWith("this.slots")
|
replaceWith = ReplaceWith("this.slots")
|
||||||
)
|
)
|
||||||
override fun getActiveSlots() = emptySet<EquipmentSlot>()
|
override fun getActiveSlots() = emptySet<EquipmentSlot>()
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
return other is EcoEnchant && this.enchantmentKey == other.enchantmentKey
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return this.enchantmentKey.hashCode()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user