[SPIGOT-849] Book tag.set("pages",pages) get invalid tag after upgrade to latest spigot! Created: 30/Apr/15 Updated: 11/Dec/17 Resolved: 30/Apr/15 |
|
Status: | Closed |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | FlashLight34 | Assignee: | Unassigned |
Resolution: | Invalid | Votes: | 0 |
Labels: | 1.8.3, nbt, spigot | ||
Environment: |
verygames computer |
Attachments: |
![]() |
Description |
Guide.java import net.minecraft.server.v1_8_R2.JsonList; import net.minecraft.server.v1_8_R2.NBTTagCompound; import net.minecraft.server.v1_8_R2.NBTTagString; import net.minecraft.server.v1_8_R2.NBTTagList; import net.minecraft.server.v1_8_R2.ItemStack; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; List<String> pages = Arrays.asList("[\"\",{\"text\":\"\\u2726 \",\"color\":\"black\",\"bold\":\"true\"},{\"text\":\"Présentation de\",\"color\":\"red\",\"bold\":\"false\"},{\"text\":\" \\u2726\n \\u2726 \",\"color\":\"black\",\"bold\":\"true\"},{\"text\":\"WorlDust \",\"color\":\"red\",\"bold\":\"false\"},{\"text\":\"\\u2726\n\",\"color\":\"black\",\"bold\":\"true\"},{\"text\":\"\nWorlDust est un serveur \",\"color\":\"dark_gray\",\"bold\":\"false\"}]"); public CraftItemStack getBook(JSONObject jsonObjtitauth, List<String> pages) { ItemStack stack = new ItemStack(net.minecraft.server.v1_8_R2.Item.d("written_book")) ; NBTTagCompound tag = new NBTTagCompound(); if (!stack.hasTag()) { tag = new NBTTagCompound(); stack.setTag(tag); } tag.set("author",new NBTTagString(getStringWiColor(jsonObjtitauth.get("author").toString()))); tag.set("title",new NBTTagString(getStringWiColor(jsonObjtitauth.get("title").toString()))); tag.set("pages",getpages(pages)); stack.setTag(tag); return CraftItemStack.asCraftMirror(stack); } //TODO probleme depuis derniere MAJ de spigot :| private NBTTagList getpages(List<String> pages) { NBTTagList gui = new NBTTagList(); for (String g : pages){ gui.add(new NBTTagString(g)); } return gui; } |
Comments |
Comment by FlashLight34 [ 07/May/15 ] |
i find my problem if i set a title too long that got all pages invalid tag eg: "; -> no error "; -> invalid tag |
Comment by Shevchik [ 30/Apr/15 ] |
Non-API methods are not supported |
Comment by FlashLight34 [ 30/Apr/15 ] |
That worked before upgrade |