Solved Config - Color Formatting

Discussion in 'Plugin Development' started by toxiccoke, Nov 24, 2015.

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

    toxiccoke

    Hi

    So im working this plugin and im trying to make it so that colors can be changed within the config.I looked around and found that this is what i should be using:

    Code:
    s.setItem(0, createItem(Material.STAINED_GLASS_PANE, 1, (short) 14, ChatColor.translateAlternateColorCodes('&',getConfig().getString("Name1")), ""));
    but the color is not showing. have i done something incorrect?

    Thanks
    toxiccoke
     
  2. Offline

    Mrs. bwfctower

    @toxiccoke Show us the config and the createItem method.
     
  3. Offline

    toxiccoke

    @Mrs. bwfctower
    Createitem method:

    Code:
            ItemStack createItem(Material material, int amount, short shrt, String displayname, String lore) {
            ItemStack item = new ItemStack(material, amount, shrt);
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(displayname);
            ArrayList <String> Lore = new ArrayList <String>();
            Lore.add(lore);
            meta.setLore(Lore);
    
            item.setItemMeta(meta);
            return item;
    Config:

    Code:
    Name1: Name1
    Name2: Name2
    Name3: Name3
    Name4: Name4
    Name5: Name5
    Name6: Name6
    Name7: Name7
    Name8: Name8
    Name9: Name9
     
  4. Offline

    Mrs. bwfctower

    @toxiccoke In you config you have to put color codes! If you want Name2 to be green, make the value '&aName2'
     
  5. Offline

    toxiccoke

    @Mrs. bwfctower sorry that is what i have with the exported one

    @Mrs. bwfctower Solved It as i relisted that u need '&aName1' instead of just having &aName1.
    Thanks for the help.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 24, 2015
Thread Status:
Not open for further replies.

Share This Page