Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-849

Book tag.set("pages",pages) get invalid tag after upgrade to latest spigot!

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Minor Minor
    • None
    • None
    • verygames computer maybe linux

      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;
      	}
      

            Unassigned Unassigned
            Flashlight34 FlashLight34
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: