Retrieving player data from config to display on lore

Discussion in 'Plugin Development' started by yewtree8, Nov 7, 2014.

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

    yewtree8

    Ok first thankyou for clicking on this, for about half an hour now I have been trying to figure out how to set the lore of an item dynamically (Created once) and to display a bit of data on an item lore, currently I have this method for creating a custom item:

    Code:java
    1. public static ItemStack setMeta(ItemStack material, String name , List<String> lore) {
    2. if(((material == null) || material.getType() == Material.AIR) || (name == null && lore == null))
    3.  
    4. return null;
    5.  
    6. ItemMeta im = material.getItemMeta();
    7. if (name != null)
    8. im.setDisplayName(name);
    9. if(lore != null) {
    10. im.setLore(lore);
    11.  
    12. material.setItemMeta(im);
    13. return material;
    14.  
    15. }
    16. return material;
    17. }


    So Therefore to create a new Item with custom name and lore it would look like:

    Code:java
    1. public static ItemStack item = setMeta(new ItemStack(Material.DIRT), ChatColor.LIGHT_PURPLE + "Dirt",
    2. Arrays.asList(ChatColor.BLUE + "Lore", ChatColor.ITALIC + " Another Lore"));



    So here's my problem....


    I'm trying to create an item to retrieve an integer in the config, using the line

    Code:
    Main.getInstance().getConfig().getInt(player.getName()+".cosmetics.batlauncher.ammo");
    
    However I cannot implement this into the current method, I do not want to make it so you have to mention a player every time you create an item using some sort of "for" method.

    All input appreciated and I would love it if you could help!:)

    Thanks


    - Yew
     
  2. Offline

    mine-care

    Mhm, could you explain me what you want to do ( a bit more) its name, I do t understand fully :3
    Also please stop abusing static :3
     
Thread Status:
Not open for further replies.

Share This Page