mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-27 20:37:34 +01:00
Fixed (hopefully) items from before 4.1.0-pre11 having hidden enchantments
This commit is contained in:
parent
37de34cee4
commit
3a44eabe5d
@ -30,7 +30,7 @@ public final class EnchantDisplay {
|
|||||||
* @deprecated This is no longer used due to a change in the lore storage mechanism
|
* @deprecated This is no longer used due to a change in the lore storage mechanism
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@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
|
* The meta key to hide enchantments in lore
|
||||||
|
@ -5,6 +5,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
||||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
public final class PacketSetSlot extends AbstractPacketAdapter {
|
public final class PacketSetSlot extends AbstractPacketAdapter {
|
||||||
public PacketSetSlot() {
|
public PacketSetSlot() {
|
||||||
@ -18,6 +19,8 @@ public final class PacketSetSlot extends AbstractPacketAdapter {
|
|||||||
|
|
||||||
if(item != null && item.getItemMeta() != null) {
|
if(item != null && item.getItemMeta() != null) {
|
||||||
hideEnchants = item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS);
|
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);
|
item = EnchantDisplay.displayEnchantments(item, hideEnchants);
|
||||||
|
@ -5,6 +5,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
||||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
public final class PacketWindowItems extends AbstractPacketAdapter {
|
public final class PacketWindowItems extends AbstractPacketAdapter {
|
||||||
public PacketWindowItems() {
|
public PacketWindowItems() {
|
||||||
@ -20,6 +21,8 @@ public final class PacketWindowItems extends AbstractPacketAdapter {
|
|||||||
|
|
||||||
if(item != null && item.getItemMeta() != null) {
|
if(item != null && item.getItemMeta() != null) {
|
||||||
hideEnchants = item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS);
|
hideEnchants = item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
if(hideEnchants && item.getItemMeta().getPersistentDataContainer().has(EnchantDisplay.KEY, PersistentDataType.INTEGER))
|
||||||
|
hideEnchants = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnchantDisplay.displayEnchantments(item, hideEnchants);
|
EnchantDisplay.displayEnchantments(item, hideEnchants);
|
||||||
|
Loading…
Reference in New Issue
Block a user