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 1f8764fb..e73493eb 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 @@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import com.willfp.ecoenchants.enchantments.EcoEnchants; +import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound; import com.willfp.ecoenchants.enchantments.util.EnchantChecks; import com.willfp.ecoenchants.events.entitydeathbyentity.EntityDeathByEntityEvent; import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager; @@ -117,6 +118,12 @@ public final class Telekinesis extends EcoEnchant { int xp = event.getDroppedExp(); Collection drops = event.getDrops(); + if(entity instanceof Player) { + if(Soulbound.getSoulboundItems((Player) entity) != null) { + drops.removeAll(Soulbound.getSoulboundItems((Player) entity)); + } + } + new DropQueue(player) .addItems(drops) .setLocation(entity.getLocation()) diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java index f3c6e5ba..a480aa50 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java @@ -4,7 +4,6 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; @@ -24,9 +23,13 @@ public final class Soulbound extends EcoEnchant { // START OF LISTENERS - HashMap> soulboundItemsMap = new HashMap<>(); + private static final HashMap> soulboundItemsMap = new HashMap<>(); - @EventHandler(priority = EventPriority.HIGH) + public static List getSoulboundItems(Player player) { + return soulboundItemsMap.get(player); + } + + @EventHandler public void onSoulboundDeath(PlayerDeathEvent event) { if(event.getKeepInventory()) return; @@ -46,7 +49,7 @@ public final class Soulbound extends EcoEnchant { soulboundItemsMap.put(player, soulboundItems); } - @EventHandler(priority = EventPriority.HIGH) + @EventHandler public void onSoulboundRespawn(PlayerRespawnEvent event) { if(!soulboundItemsMap.containsKey(event.getPlayer())) return;