Packet fixes
This commit is contained in:
parent
e48e76e503
commit
2cec377dfd
@ -55,6 +55,16 @@ public class ExcellentEnchants extends NexPlugin<ExcellentEnchants> {
|
||||
|
||||
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<ExcellentEnchants> {
|
||||
|
||||
@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();
|
||||
}
|
||||
|
@ -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<ItemStack> 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 -> {
|
||||
if (player.getInventory().firstEmpty() == -1) {
|
||||
world.dropItemNaturally(location, save);
|
||||
}
|
||||
else {
|
||||
this.consumeCharges(save, EnchantUtils.getLevel(save, this));
|
||||
player.getInventory().addItem(save);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user