diff --git a/NMS/v1_16_R1/src/main/java/com/willfp/ecoenchants/nms/v1_16_R1/ChatComponent.java b/NMS/v1_16_R1/src/main/java/com/willfp/ecoenchants/nms/v1_16_R1/ChatComponent.java index 4081a5b5..537c91f9 100644 --- a/NMS/v1_16_R1/src/main/java/com/willfp/ecoenchants/nms/v1_16_R1/ChatComponent.java +++ b/NMS/v1_16_R1/src/main/java/com/willfp/ecoenchants/nms/v1_16_R1/ChatComponent.java @@ -13,9 +13,7 @@ import net.minecraft.server.v1_16_R1.IChatBaseComponent; import net.minecraft.server.v1_16_R1.MojangsonParser; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; -import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -54,14 +52,9 @@ public class ChatComponent implements ChatComponentWrapper { String id = json.getAsJsonObject().get("id").toString(); String tag = json.getAsJsonObject().get("tag").toString(); ItemStack itemStack = getFromTag(tag, id); - boolean hideEnchants = false; - if(itemStack.getItemMeta() != null) { - if(itemStack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) hideEnchants = true; - if(itemStack.getItemMeta() instanceof EnchantmentStorageMeta && itemStack.getItemMeta().hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) hideEnchants = true; - } try { - itemStack = (ItemStack) Class.forName("com.willfp.ecoenchants.display.EnchantDisplay").getMethod("displayEnchantments", ItemStack.class, boolean.class).invoke(null, itemStack, hideEnchants); + itemStack = (ItemStack) Class.forName("com.willfp.ecoenchants.display.EnchantDisplay").getMethod("displayEnchantments", ItemStack.class).invoke(null, itemStack); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) { e.printStackTrace(); } diff --git a/NMS/v1_16_R2/src/main/java/com/willfp/ecoenchants/nms/v1_16_R2/ChatComponent.java b/NMS/v1_16_R2/src/main/java/com/willfp/ecoenchants/nms/v1_16_R2/ChatComponent.java index 5c180fdd..0baab3bd 100644 --- a/NMS/v1_16_R2/src/main/java/com/willfp/ecoenchants/nms/v1_16_R2/ChatComponent.java +++ b/NMS/v1_16_R2/src/main/java/com/willfp/ecoenchants/nms/v1_16_R2/ChatComponent.java @@ -13,9 +13,7 @@ import net.minecraft.server.v1_16_R2.IChatBaseComponent; import net.minecraft.server.v1_16_R2.MojangsonParser; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; -import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -54,14 +52,9 @@ public class ChatComponent implements ChatComponentWrapper { String id = json.getAsJsonObject().get("id").toString(); String tag = json.getAsJsonObject().get("tag").toString(); ItemStack itemStack = getFromTag(tag, id); - boolean hideEnchants = false; - if(itemStack.getItemMeta() != null) { - if(itemStack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) hideEnchants = true; - if(itemStack.getItemMeta() instanceof EnchantmentStorageMeta && itemStack.getItemMeta().hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) hideEnchants = true; - } try { - itemStack = (ItemStack) Class.forName("com.willfp.ecoenchants.display.EnchantDisplay").getMethod("displayEnchantments", ItemStack.class, boolean.class).invoke(null, itemStack, hideEnchants); + itemStack = (ItemStack) Class.forName("com.willfp.ecoenchants.display.EnchantDisplay").getMethod("displayEnchantments", ItemStack.class).invoke(null, itemStack); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) { e.printStackTrace(); } diff --git a/NMS/v1_16_R3/src/main/java/com/willfp/ecoenchants/nms/v1_16_R3/ChatComponent.java b/NMS/v1_16_R3/src/main/java/com/willfp/ecoenchants/nms/v1_16_R3/ChatComponent.java index 18133260..a5dd45e3 100644 --- a/NMS/v1_16_R3/src/main/java/com/willfp/ecoenchants/nms/v1_16_R3/ChatComponent.java +++ b/NMS/v1_16_R3/src/main/java/com/willfp/ecoenchants/nms/v1_16_R3/ChatComponent.java @@ -13,9 +13,7 @@ import net.minecraft.server.v1_16_R3.IChatBaseComponent; import net.minecraft.server.v1_16_R3.MojangsonParser; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; -import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -54,14 +52,9 @@ public class ChatComponent implements ChatComponentWrapper { String id = json.getAsJsonObject().get("id").toString(); String tag = json.getAsJsonObject().get("tag").toString(); ItemStack itemStack = getFromTag(tag, id); - boolean hideEnchants = false; - if(itemStack.getItemMeta() != null) { - if(itemStack.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) hideEnchants = true; - if(itemStack.getItemMeta() instanceof EnchantmentStorageMeta && itemStack.getItemMeta().hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) hideEnchants = true; - } try { - itemStack = (ItemStack) Class.forName("com.willfp.ecoenchants.display.EnchantDisplay").getMethod("displayEnchantments", ItemStack.class, boolean.class).invoke(null, itemStack, hideEnchants); + itemStack = (ItemStack) Class.forName("com.willfp.ecoenchants.display.EnchantDisplay").getMethod("displayEnchantments", ItemStack.class).invoke(null, itemStack); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) { e.printStackTrace(); } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java index 3397472b..52da315b 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java @@ -42,7 +42,6 @@ public class Telekinesis extends EcoEnchant { if (!EnchantChecks.mainhand(player, this)) return; if(this.getDisabledWorldNames().contains(player.getWorld().getName())) return; - //if(this.getDisabledWorlds().contains(player.getWorld())) return; if (event.isCancelled()) return; @@ -58,6 +57,7 @@ public class Telekinesis extends EcoEnchant { new DropQueue(player) .setLocation(block.getLocation()) .addItems(drops) + .forceTelekinesis() .push(); player.updateInventory(); diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/FastCollatedDropQueue.java b/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/FastCollatedDropQueue.java index 4b0c8129..8de1ce8d 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/FastCollatedDropQueue.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/FastCollatedDropQueue.java @@ -33,7 +33,7 @@ public class FastCollatedDropQueue extends InternalDropQueue { @Override public void push() { - CollatedDrops collatedDrops = COLLATED_MAP.containsKey(player) ? COLLATED_MAP.get(player).addDrops(items) : new CollatedDrops(items, loc, xp); + CollatedDrops collatedDrops = COLLATED_MAP.containsKey(player) ? COLLATED_MAP.get(player).addDrops(items).setLocation(loc) : new CollatedDrops(items, loc, xp); COLLATED_MAP.put(player, collatedDrops); } @@ -62,7 +62,7 @@ public class FastCollatedDropQueue extends InternalDropQueue { private static class CollatedDrops { private final List drops; - private final Location location; + private Location location; private final int xp; private CollatedDrops(List drops, Location location, int xp) { @@ -87,5 +87,11 @@ public class FastCollatedDropQueue extends InternalDropQueue { drops.addAll(toAdd); return this; } + + public CollatedDrops setLocation(Location loc) { + this.location = loc; + return this; + } + } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/InternalDropQueue.java b/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/InternalDropQueue.java index e5cd743d..92a35742 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/InternalDropQueue.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/util/internal/drops/InternalDropQueue.java @@ -131,7 +131,7 @@ public class InternalDropQueue implements AbstractDropQueue { assert world != null; if(hasTelekinesis) { - HashMap leftover = player.getInventory().addItem(items.toArray(new ItemStack[]{})); + HashMap leftover = player.getInventory().addItem(items.toArray(new ItemStack[0])); for(ItemStack drop : leftover.values()) { world.dropItemNaturally(loc.add(0.5, 0, 0.5), drop).setVelocity(new Vector()); }