Solved config.yml doesn't find the path

Discussion in 'Plugin Development' started by Robke28, Sep 13, 2015.

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

    Robke28

    Hello,
    I would like to know what happens when you try to get a value from the config.yml, but it doesnt find the path,

    Thanks
    Robke28
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    Robke28

    But if i do
    Code:
                int money = this.getConfig().getInt("player");
    
                if(money = null ){
    
    
                }
    I get an error, any idea what i did wrong?
     
  4. Online

    timtower Administrator Administrator Moderator

    @Robke28 Probably because that can't be null.
    Just use contains before you get the value or set a default value
     
  5. Offline

    Robke28

    Well, basically I want to store information of people in the config.yml, but every time the game restarts, there are gonna be other players in the game, so i can't really set a default (I know a DB, would be better, but i don't have it at my disposal)
     
  6. Online

    timtower Administrator Administrator Moderator

    @Robke28 If it doesn't exist then the user hasn't played yet, so 0 would be a good default value
     
  7. Offline

    Robke28

    But how do i check if the player hasn't played yet?
     
  8. Online

    timtower Administrator Administrator Moderator

    @Robke28 Just check if the value exists in the config, if it doesn't exist then set the value to 0 or something.
    Can't really give a good number as I don't know how you are gonna use this.
     
  9. Offline

    Robke28

    Well, its minigame, with 4 players (probably different every time) and if they kill a mob they get 10 coins, saved in the config.yml, but the 1st time they kill a mob, they are not in the config.yml, so i wanna check if they are in it or not, the question is how can I check if they are in it or not
     
  10. Online

    timtower Administrator Administrator Moderator

  11. Offline

    Robke28

    Didn't know that
    thanks man!
     
  12. Offline

    boomboompower

    @Robke28 if your issue is fixed, please mark this thread as solved thx :D
     
  13. Offline

    Robke28

Thread Status:
Not open for further replies.

Share This Page