Can´t load Material from a config?? Pls help!

Discussion in 'Programming' started by Bombour, May 27, 2017.

Thread Status:
Not open for further replies.
  1. Hello,
    i have a problem with my plugin.

    I don´t know what ist wrong.I try to load a Material from my config.yml.
    Here is my code:
    Code:
    String Material1 = cfg1.getString("Lobby.Teleporter.Items.Spawn");
    String Material2 = cfg1.getString(("Lobby.Teleporter.Items.Game1"));
    String Material3 = cfg1.getString(("Lobby.Teleporter.Items.Game2"));
    String Material4 = cfg1.getString(("Lobby.Teleporter.Items.Game3"));
    String Material5 = cfg1.getString(("Lobby.Teleporter.Items.Game4"));
    p.sendMessage("Items geladen");
    String Game1 = cfg1.getString("Lobby.Teleporter.Name.Game1");
    String Game2 = cfg1.getString("Lobby.Teleporter.Name.Game2");
    String Game3 = cfg1.getString("Lobby.Teleporter.Name.Game3");
    String Game4 = cfg1.getString("Lobby.Teleporter.Name.Game4");
    p.sendMessage("Games geladen");
    ItemStack item = new ItemStack(Material.getMaterial(Material1));
    p.sendMessage("item1 = ok");
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName("§cSpawn");
    item.setItemMeta(meta);

    ItemStack item1 = new ItemStack(Material.getMaterial(Material2));
    ItemMeta meta1 = item1.getItemMeta();
    meta1.setDisplayName(Game1);
    item1.setItemMeta(meta1);

    ItemStack item2 = new ItemStack(Material.getMaterial(Material3));
    ItemMeta meta2 = item2.getItemMeta();
    meta2.setDisplayName(Game2);
    item2.setItemMeta(meta2);

    ItemStack item3 = new ItemStack(Material.getMaterial(Material4));
    ItemMeta meta3 = item3.getItemMeta();
    meta3.setDisplayName(Game3);
    item3.setItemMeta(meta3);

    ItemStack item4 = new ItemStack(Material.getMaterial(Material5));
    ItemMeta meta4 = item4.getItemMeta();
    meta4.setDisplayName(Game4);
    item4.setItemMeta(meta4);



    inv.setItem(0, item1);
    inv.setItem(22, item);
    inv.setItem(44, item2);
    inv.setItem(8, item3);
    inv.setItem(36, item4);



    p.openInventory(inv);

    I make control messages but there are not working!

    Pls help.

    Sry for my bad english.

    LG Bombour
     
Thread Status:
Not open for further replies.