Solved Getting first item in GUI

Discussion in 'Plugin Development' started by Thrylouis, Jun 26, 2018.

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

    Thrylouis

    Hi,

    I've been working on this plugin for a while, but there's a problem. I try to get the first item in a gui by doing like this:
    Code:
    FileConfiguration config = YamlConfiguration.loadConfiguration(file);
                        ItemStack slot1 = e.getInventory().getItem(0);
                        if(slot1 !=null && slot1.getType() != Material.AIR)  {
                            config.set(p.getName() + "1", slot1);
                        } else {
                            config.set(p.getName(), "AIR");
                        }
                        p.closeInventory();
    But that doesn't work. It doesn't put it in the file I want. There are no errors.
    Be free to comment && help!
     
  2. Offline

    CommonSenze

    @Thrylouis
    You never saved the config after setting.
     
  3. Offline

    Thrylouis

    OMG: I'm so dumb. Thanks!
     
    Last edited: Jun 26, 2018
Thread Status:
Not open for further replies.

Share This Page