Fixed soulbound with telekinesis

Signed-off-by: BuildTools <unconfigured@null.spigotmc.org>
This commit is contained in:
Auxilor 2020-10-15 13:44:37 +01:00 committed by BuildTools
parent a17b595745
commit 7a58185a86
2 changed files with 14 additions and 4 deletions

View File

@ -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<ItemStack> 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())

View File

@ -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<Player, List<ItemStack>> soulboundItemsMap = new HashMap<>();
private static final HashMap<Player, List<ItemStack>> soulboundItemsMap = new HashMap<>();
@EventHandler(priority = EventPriority.HIGH)
public static List<ItemStack> 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;