mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
SPIGOT-4736: Serialized ItemStack Lore Doesn't Deserialize
This commit is contained in:
parent
c124606439
commit
58c5c617d8
2 changed files with 13 additions and 2 deletions
|
@ -1191,7 +1191,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||
}
|
||||
|
||||
if (hasLore()) {
|
||||
builder.put(LORE.BUKKIT, ImmutableList.copyOf(lore));
|
||||
builder.put(LORE.BUKKIT, ImmutableList.copyOf(Lists.transform(lore, CraftChatMessage::fromComponent)));
|
||||
}
|
||||
|
||||
if (hasCustomModelData()) {
|
||||
|
|
|
@ -3,12 +3,15 @@ package org.bukkit.craftbukkit.inventory;
|
|||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -43,6 +46,14 @@ public class CompositeSerialization extends AbstractTestingBase {
|
|||
item8.addUnsafeEnchantment(Enchantment.OXYGEN, 4);
|
||||
stacks.add(item8);
|
||||
|
||||
ItemStack item9 = new ItemStack(Material.APPLE);
|
||||
ItemMeta meta9 = item9.getItemMeta();
|
||||
meta9.setDisplayName(ChatColor.RED + "DisplayName");
|
||||
meta9.setLocalizedName(ChatColor.AQUA + "LocalizedName");
|
||||
meta9.setLore(Arrays.asList(ChatColor.BLUE + "Lore1", ChatColor.DARK_AQUA + "Lore2"));
|
||||
item9.setItemMeta(meta9);
|
||||
stacks.add(item9);
|
||||
|
||||
out.set("composite-list.abc.def", stacks);
|
||||
String yaml = out.saveToString();
|
||||
|
||||
|
@ -52,7 +63,7 @@ public class CompositeSerialization extends AbstractTestingBase {
|
|||
|
||||
assertThat(stacks, hasSize(raw.size()));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int i = 0; i < raw.size(); i++) {
|
||||
assertThat(String.valueOf(i), (Object) stacks.get(i), is((Object) raw.get(i)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue