mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-26 01:01:22 +01:00
Fixed soulbound with telekinesis
Signed-off-by: BuildTools <unconfigured@null.spigotmc.org>
This commit is contained in:
parent
a17b595745
commit
7a58185a86
@ -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())
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user