GUI Reload

Discussion in 'Plugin Development' started by XXDiamondPlayz, Oct 7, 2020.

  1. Offline

    XXDiamondPlayz

    Hi, so this is kind of hard to explain. So basically, I have a GUI. You can Fill in Empty Spaces of the GUI (Configurable thru the Config), however when I change "enabled" to true in the Config and use my custom /helpplugin reload command, it doesn't remove the item. And yes, I saved the Config and Reloaded it properly so please don't bother saying that. For some reason, it doesn't remove the items when they were previously set to true unless you use /plugman reload, /rl, or a restart all-together. Any ideas why?

    Code:
    if (Main.instance.getConfig().getString("enabled").equalsIgnoreCase("true")) {
    for (int i = 0; i < inv.getSize(); i++) {
    if (inv.getItem(i) == null || inv.getItem(i).getType().equals(Material.AIR)) {
    item = createItem("", Material.matchMaterial(Objects.requireNonNull(Main.instance.getConfig().getString("fillInBlanks"))), Collections.singletonList(""));inv.setItem(i, item);}
    }
    }
     
  2. Offline

    xelatercero

    Well elaborate more , give us the code where you handle the config (save, reload).

    Code:java
    1. Main.instance.getConfig()

    Make a proper Main instance

    Code:java
    1.  
    2. getString("enabled").equalsIgnoreCase("true"))
    3.  


    You can store booleans in the config , and get them with #getBoolean()
     

Share This Page