mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Fixed legacy registration
This commit is contained in:
parent
bf012dff02
commit
5d5a80286b
@ -8,19 +8,17 @@ import org.bukkit.enchantments.Enchantment
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
object LegacyEnchantmentRegisterer : EnchantmentRegisterer {
|
||||
init {
|
||||
/**
|
||||
* Register an enchantment to bukkit (for replacing vanilla CraftEnchantments)
|
||||
*/
|
||||
fun registerToBukkit(enchantment: Enchantment) {
|
||||
// Allow registering new enchantments
|
||||
Enchantment::class.java.getDeclaredField("acceptingNew")
|
||||
.apply {
|
||||
isAccessible = true
|
||||
set(null, true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an enchantment to bukkit (for replacing vanilla CraftEnchantments)
|
||||
*/
|
||||
fun registerToBukkit(enchantment: Enchantment) {
|
||||
Enchantment::class.java.getDeclaredField("byKey")
|
||||
.apply {
|
||||
isAccessible = true
|
||||
|
Loading…
Reference in New Issue
Block a user