Solved Using a boolean from a config in an if statement.

Discussion in 'Plugin Development' started by MineStein, May 6, 2014.

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

    MineStein

    Hello, I need help with my config.
    Code:java
    1. if(getConfig().getBoolean("opBan").


    What do I do after this so I can make it if opBan = true/false it does this.

    Any questions? Tag me MineStein
     
  2. MineStein This really isn't helpful. What are you trying to do with the list?
     
  3. Offline

    MineStein

    AdamQpzm I am attempting to make it say that if the boolean "isOp" inside the config.yml = true, it does this. If it = false, it does this.
     
  4. Offline

    Minnymin3

  5. Offline

    KillerOfPie

    You dont need anything after the getBoolean() except to close the if(), and this wont work if you dont have your config setup correctly. Other then that this should work just fine.

    Code:java
    1. if(getConfig().getBoolean("opBan"))
     
  6. MineStein Using the getBoolean() will return a boolean so you can just use it like it is.

    PHP:
    if(getConfig().getBoolean("isOp")) {
        
    // Yay, it's true!
    } else {
        
    // Aww, it's false.
    }
     
  7. Offline

    MineStein

    AdamQpzm Ok, thank you.

    ~Thread Finished~
     
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page