Solved Quick Config Question

Discussion in 'Plugin Development' started by xYourFreindx, May 27, 2014.

Thread Status:
Not open for further replies.
  1. (so far) My config Looks like this
    Code:
    CameraMode:
        Enabled: true
        PlayersInCM:
            AreInvincible: true
    And my code looks like this​
    Code:java
    1.  
    2. @Override
    3. public void onEnable(){
    4. getConfig().options().copyDefaults(true);
    5. reloadConfig();
    6. saveConfig();
    7. if (getConfig().getBoolean("CameraMode.Enabled") == (false)) {
    8. getLogger().info("Plugin Disable Setting Detected...");
    9. getServer().getPluginManager().disablePlugin(this);
    10. }
    11. getServer().getPluginManager().registerEvents(this, this);
    12. PluginDescriptionFile pdfFile = this.getDescription();
    13. getLogger().info(pdfFile.getName() + " v" + pdfFile.getVersion() + " has been enabled");
    14. }

    And when both booleans are true, it runs as it's supposed to, but when "AreInvinvible" is disabled, and I run my plugin, it acts as though I had disabled the plugin instead.
    What could I possibly be doing wrong?
    Am I using the wrong statements for getting the boolean? :/
     
  2. Offline

    1Achmed1

    Try it with out the parenthesis around false...

    Also, the whole code would be useful, even if it's on github :)
     
  3. 1Achmed1 Thanks!
    My config is working now. Though, I'm still not sure how or why my previous attempts were failed..
     
  4. Offline

    1Achmed1

    I'm not 100% sure... but I think that it thought that you were trying to cast (false) to an object...
     
Thread Status:
Not open for further replies.

Share This Page