mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-05 22:07:34 +01:00
Updated EssentialsX to use proper API (several months after it was introduced)
This commit is contained in:
parent
0bd73ea2ec
commit
67ed1f8294
@ -24,6 +24,7 @@ allprojects {
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
|
||||
maven { url 'https://oss.sonatype.org/content/groups/public/' }
|
||||
maven { url 'https://maven.enginehub.org/repo/' }
|
||||
maven { url 'https://repo.essentialsx.net/releases/' }
|
||||
maven { url 'https://ci.ender.zone/plugin/repository/project/' }
|
||||
maven { url 'https://ci.ender.zone/plugin/repository/everything/' }
|
||||
maven { url 'https://repo.md-5.net/content/repositories/snapshots/' }
|
||||
|
@ -6,7 +6,7 @@ dependencies {
|
||||
compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT'
|
||||
compileOnly 'commons-io:commons-io:2.8.0'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.0-SNAPSHOT'
|
||||
compileOnly 'net.ess3:EssentialsX:2.18.1'
|
||||
compileOnly 'net.essentialsx:EssentialsX:2.19.0'
|
||||
compileOnly 'com.destroystokyo.paper:paper-api:1.16.3-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT'
|
||||
}
|
@ -9,17 +9,12 @@ import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class IntegrationEssentials implements RegistrationWrapper {
|
||||
@Override
|
||||
public void registerAllEnchantments() {
|
||||
try {
|
||||
for (EcoEnchant enchantment : EcoEnchants.values()) {
|
||||
((Map<String, Enchantment>) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(enchantment.getKey().getKey(), enchantment);
|
||||
((Map<String, Enchantment>) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true)).put(enchantment.getPermissionName(), enchantment);
|
||||
}
|
||||
} catch (IllegalAccessException ignored) {
|
||||
// Ignore reflective errors that won't happen.
|
||||
for (EcoEnchant enchantment : EcoEnchants.values()) {
|
||||
Enchantments.registerEnchantment(enchantment.getKey().getKey(), enchantment);
|
||||
Enchantments.registerAlias(enchantment.getPermissionName(), enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user