Need help with Config

Discussion in 'Plugin Development' started by AdityaTD, May 10, 2015.

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

    AdityaTD

    Hey guys can someone tell me how to give item to a player using Config and stuff? I am making a KitPVP Plugin so I wanna make it customizable. (Don't mind if any of the spelling is wrong, I just type too fast and furious lol! xD)
     
  2. Offline

    thefrooh

    Probably you could get the item meta, save it to the config, and when the player adds it, then set the item's meta to the one in the config. Not sure if that would work, I've never worked with items in config, but it's a start.
     
  3. Offline

    bohafr

    You can also put to config

    Items:
    Sword:
    id: minecraft:diamond_sword
    name: name
    and more..

    Then make function which get the sword and get all other things and set it to sword

    Example:
    public ItemStack getItemFromConfig(String name){
    if (!getConfig().contains("Items."+name)return null;

    ItemStack is = new ItemStack(Material.getMaterial(getConfig().getString("Items."+name+".id")));
    ItemMeta m = is.getItemMeta();
    m.setDisplayName(getConfig().getString("Items."+name+".name");
    is.setItemMeta(m);
    }
     
Thread Status:
Not open for further replies.

Share This Page