diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java index f07a0e6..9e7b424 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/ExcellentEnchants.java @@ -55,6 +55,16 @@ public class ExcellentEnchants extends NexPlugin { this.enchantManager = new EnchantManager(this); this.enchantManager.setup(); + + if (Config.ENCHANTMENTS_DISPLAY_MODE.get() == 2) { + if (EngineUtils.hasPlugin(HookId.PROTOCOL_LIB)) { + ProtocolHook.setup(); + } + else { + this.warn(HookId.PROTOCOL_LIB + " is not installed. Set display mode to Plain lore."); + Config.ENCHANTMENTS_DISPLAY_MODE.set(1); + } + } } @Override @@ -104,15 +114,6 @@ public class ExcellentEnchants extends NexPlugin { @Override public void registerHooks() { - if (Config.ENCHANTMENTS_DISPLAY_MODE.get() == 2) { - if (EngineUtils.hasPlugin(HookId.PROTOCOL_LIB)) { - ProtocolHook.setup(); - } - else { - this.warn(HookId.PROTOCOL_LIB + " is not installed. Set display mode to Plain lore."); - Config.ENCHANTMENTS_DISPLAY_MODE.set(1); - } - } if (EngineUtils.hasPlaceholderAPI()) { PlaceholderHook.setup(); } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/SoulboundEnchant.java b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/SoulboundEnchant.java index 680be4c..99c968a 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/SoulboundEnchant.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/impl/universal/SoulboundEnchant.java @@ -1,5 +1,7 @@ package su.nightexpress.excellentenchants.enchantment.impl.universal; +import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.EnchantmentTarget; import org.bukkit.entity.Player; @@ -40,6 +42,8 @@ public class SoulboundEnchant extends ExcellentEnchant { if (deathEvent.getKeepInventory()) return; List saveList = new ArrayList<>(); + Location location = player.getLocation(); + World world = player.getWorld(); deathEvent.getDrops().removeIf(drop -> { if (EnchantUtils.getLevel(drop, this) > 0) { @@ -55,8 +59,13 @@ public class SoulboundEnchant extends ExcellentEnchant { this.plugin.runTask(task -> { saveList.forEach(save -> { - this.consumeCharges(save, EnchantUtils.getLevel(save, this)); - player.getInventory().addItem(save); + if (player.getInventory().firstEmpty() == -1) { + world.dropItemNaturally(location, save); + } + else { + this.consumeCharges(save, EnchantUtils.getLevel(save, this)); + player.getInventory().addItem(save); + } }); }); } diff --git a/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/ProtocolHook.java b/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/ProtocolHook.java index 351fc82..de94899 100644 --- a/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/ProtocolHook.java +++ b/Core/src/main/java/su/nightexpress/excellentenchants/hook/impl/ProtocolHook.java @@ -78,7 +78,7 @@ public class ProtocolHook { } @Nullable - private static ItemStack update(@Nullable ItemStack item, boolean isCreative) { + public static ItemStack update(@Nullable ItemStack item, boolean isCreative) { if (item == null || item.getType().isAir()) return item; ItemStack copy = new ItemStack(item);