mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-16 04:31:22 +01:00
Added essentials integration
This commit is contained in:
parent
6fb18325f1
commit
e785c9350c
@ -116,5 +116,10 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:EssentialsX:2.18.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:BaseProviders:2.18.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:NMSReflectionProvider:2.18.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:PaperProvider:2.18.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8Provider:2.18.1" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -226,5 +226,11 @@
|
||||
<version>4.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -35,6 +35,11 @@ public class Main extends JavaPlugin {
|
||||
*/
|
||||
public static boolean hasAE;
|
||||
|
||||
/**
|
||||
* Has Essentials?
|
||||
*/
|
||||
public static boolean hasEssentials;
|
||||
|
||||
/**
|
||||
* ProtocolLib
|
||||
*/
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.willfp.ecoenchants.enchantments;
|
||||
|
||||
import com.earth2me.essentials.Enchantments;
|
||||
import com.willfp.ecoenchants.Main;
|
||||
import com.willfp.ecoenchants.config.ConfigManager;
|
||||
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.apache.commons.lang.reflect.FieldUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -14,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class EcoEnchant extends Enchantment implements Listener {
|
||||
private String name;
|
||||
private String description;
|
||||
@ -96,6 +100,12 @@ public abstract class EcoEnchant extends Enchantment implements Listener {
|
||||
f.setAccessible(false);
|
||||
|
||||
Enchantment.registerEnchantment(this);
|
||||
|
||||
if(Main.hasEssentials) {
|
||||
Map<String, Enchantment> essentialsMap = (Map<String, Enchantment>) FieldUtils.readDeclaredStaticField(Enchantments.class, "ENCHANTMENTS", true);
|
||||
essentialsMap.remove(this.getName());
|
||||
essentialsMap.put(this.getName(), this);
|
||||
}
|
||||
} catch (NoSuchFieldException | IllegalAccessException ignored) {}
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,10 @@ public class Loader {
|
||||
if(Main.hasAE) Bukkit.getLogger().info("AdvancedEnchantments: §aENABLED");
|
||||
else Bukkit.getLogger().info("AdvancedEnchantments: §9DISABLED");
|
||||
|
||||
Main.hasEssentials = Bukkit.getPluginManager().isPluginEnabled("Essentials");
|
||||
if(Main.hasEssentials) Bukkit.getLogger().info("Essentials: §aENABLED");
|
||||
else Bukkit.getLogger().info("Essentials: §9DISABLED");
|
||||
|
||||
Bukkit.getLogger().info("");
|
||||
Bukkit.getLogger().info("Loading Anticheat Integrations...");
|
||||
|
||||
|
@ -18,6 +18,7 @@ softdepend:
|
||||
- AAC
|
||||
- Matrix
|
||||
- Spartan
|
||||
- Essentials
|
||||
|
||||
commands:
|
||||
ecoreload:
|
||||
|
Loading…
Reference in New Issue
Block a user