Moved fake enchantment to Spigot

This commit is contained in:
Dan Mulloy 2018-07-15 15:13:37 -04:00 committed by Alexander Meech
parent 469b3816cc
commit d2636afb48

View File

@ -1,14 +1,11 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentWrapper;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryAction;
@ -20,25 +17,7 @@ import org.bukkit.inventory.PlayerInventory;
public class UtilInv public class UtilInv
{ {
private static Field _enchantmentNew; private static DullEnchantment DULL_ENCHANTMENT = new DullEnchantment();
private static DullEnchantment DULL_ENCHANTMENT;
static
{
try
{
_enchantmentNew = Enchantment.class.getDeclaredField("acceptingNew");
_enchantmentNew.setAccessible(true);
_enchantmentNew.set(null, true);
DULL_ENCHANTMENT = new DullEnchantment();
EnchantmentWrapper.registerEnchantment(DULL_ENCHANTMENT);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void addDullEnchantment(ItemStack itemStack) public static void addDullEnchantment(ItemStack itemStack)
{ {