mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-25 15:35:11 +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")
|
@Suppress("UNCHECKED_CAST")
|
||||||
object LegacyEnchantmentRegisterer : EnchantmentRegisterer {
|
object LegacyEnchantmentRegisterer : EnchantmentRegisterer {
|
||||||
init {
|
/**
|
||||||
|
* Register an enchantment to bukkit (for replacing vanilla CraftEnchantments)
|
||||||
|
*/
|
||||||
|
fun registerToBukkit(enchantment: Enchantment) {
|
||||||
// Allow registering new enchantments
|
// Allow registering new enchantments
|
||||||
Enchantment::class.java.getDeclaredField("acceptingNew")
|
Enchantment::class.java.getDeclaredField("acceptingNew")
|
||||||
.apply {
|
.apply {
|
||||||
isAccessible = true
|
isAccessible = true
|
||||||
set(null, true)
|
set(null, true)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register an enchantment to bukkit (for replacing vanilla CraftEnchantments)
|
|
||||||
*/
|
|
||||||
fun registerToBukkit(enchantment: Enchantment) {
|
|
||||||
Enchantment::class.java.getDeclaredField("byKey")
|
Enchantment::class.java.getDeclaredField("byKey")
|
||||||
.apply {
|
.apply {
|
||||||
isAccessible = true
|
isAccessible = true
|
||||||
|
Loading…
Reference in New Issue
Block a user