Fixed (hopefully) items from before 4.1.0-pre11 having hidden enchantments

This commit is contained in:
Auxilor 2020-10-10 13:50:21 +01:00
parent 37de34cee4
commit 3a44eabe5d
3 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,7 @@ public final class EnchantDisplay {
* @deprecated This is no longer used due to a change in the lore storage mechanism
*/
@Deprecated
private static final NamespacedKey KEY = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-len");
public static final NamespacedKey KEY = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-len");
/**
* The meta key to hide enchantments in lore

View File

@ -5,6 +5,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
import com.willfp.ecoenchants.display.EnchantDisplay;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.persistence.PersistentDataType;
public final class PacketSetSlot extends AbstractPacketAdapter {
public PacketSetSlot() {
@ -18,6 +19,8 @@ public final class PacketSetSlot extends AbstractPacketAdapter {
if(item != null && item.getItemMeta() != null) {
hideEnchants = item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS);
if(hideEnchants && item.getItemMeta().getPersistentDataContainer().has(EnchantDisplay.KEY, PersistentDataType.INTEGER))
hideEnchants = false;
}
item = EnchantDisplay.displayEnchantments(item, hideEnchants);

View File

@ -5,6 +5,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
import com.willfp.ecoenchants.display.EnchantDisplay;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.persistence.PersistentDataType;
public final class PacketWindowItems extends AbstractPacketAdapter {
public PacketWindowItems() {
@ -20,6 +21,8 @@ public final class PacketWindowItems extends AbstractPacketAdapter {
if(item != null && item.getItemMeta() != null) {
hideEnchants = item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS);
if(hideEnchants && item.getItemMeta().getPersistentDataContainer().has(EnchantDisplay.KEY, PersistentDataType.INTEGER))
hideEnchants = false;
}
EnchantDisplay.displayEnchantments(item, hideEnchants);