New Line error

Discussion in 'Plugin Development' started by Speaw, Dec 17, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Speaw

    [​IMG]
    \n not work.
    My code: [​IMG]
     
  2. Offline

    Webbeh

    Your screenshots are useless, at best, but I ASSUME it's a screenshot of an item's popup bubble, in which case... use the lore lines for the star count, instead of using the \n character.
     
  3. Offline

    Speaw

  4. @Speaw Also, I really don't like the look of that Main.instance... you're not by any chance using a public static field, are you?
     
  5. Offline

    uksspy

    New line doesn't work. Is it really that hard to see?
     
  6. Offline

    Speaw

    I'm not like static use.

    Code:
        public ItemStack menüitemlore(Material material, int amount, String displayname, String lore) {
            ItemStack item = new ItemStack(material, amount);
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(displayname);
            ArrayList<String> Lore = new ArrayList<String>();
            Lore.add(lore);
            meta.setLore(Lore);
            item.setItemMeta(meta);
            return item;
            }
     
  7. Offline

    nverdier

    Well I'm pretty sure lores can be a String[] So just separate the lines into a String[].
     
  8. Offline

    Webbeh

    Code:
    List<String> lore = new LinkedList<>();
     for (String sline : slines)
     {
     Integer line = Integer.valueOf(sline);
     String loreLine = config.getString(name+".items."+pos+".lore."+line);
     lore.add(loreLine);
     }
     itemMeta.setLore(lore);
    Example code on how to use the setLore, that takes a List<String>. Each new line has to be in another "lore.add(newlinecontents)";
     
Thread Status:
Not open for further replies.

Share This Page