mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Fixed KEY_V
This commit is contained in:
parent
1442874493
commit
1572328146
@ -135,6 +135,10 @@ public final class EnchantDisplay {
|
||||
}
|
||||
} catch(NullPointerException ignored) { }
|
||||
|
||||
if(meta.getPersistentDataContainer().has(KEY_V, PersistentDataType.INTEGER)) {
|
||||
meta.getPersistentDataContainer().remove(KEY_V);
|
||||
}
|
||||
|
||||
meta.getPersistentDataContainer().remove(KEY);
|
||||
itemLore.removeIf((s) -> s.startsWith(PREFIX));
|
||||
|
||||
@ -163,9 +167,9 @@ public final class EnchantDisplay {
|
||||
if(item == null || item.getItemMeta() == null || !EnchantmentTarget.ALL.getMaterials().contains(item.getType()))
|
||||
return item;
|
||||
|
||||
if(hideEnchants && item.getItemMeta().getPersistentDataContainer().has(KEY_V, PersistentDataType.INTEGER)) {
|
||||
hideEnchants = false;
|
||||
item.getItemMeta().getPersistentDataContainer().remove(KEY_V);
|
||||
if(item.getItemMeta().getPersistentDataContainer().has(KEY_V, PersistentDataType.INTEGER)) {
|
||||
if(hideEnchants)
|
||||
hideEnchants = false;
|
||||
}
|
||||
|
||||
item = revertDisplay(item);
|
||||
|
@ -5,6 +5,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
|
||||
@ -35,6 +36,8 @@ public final class PacketOpenWindowMerchant extends AbstractPacketAdapter {
|
||||
fResult.setAccessible(true);
|
||||
ItemStack result = EnchantDisplay.displayEnchantments(merchantRecipe.getResult());
|
||||
result = EnchantDisplay.addV(result);
|
||||
if(!EnchantmentTarget.ALL.getMaterials().contains(result.getType()))
|
||||
return;
|
||||
fResult.set(merchantRecipe, result);
|
||||
|
||||
// Get NMS MerchantRecipe from CraftMerchantRecipe
|
||||
|
Loading…
Reference in New Issue
Block a user