Problem with's config

Discussion in 'Plugin Development' started by Plugers11, Apr 20, 2014.

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

    Plugers11

    What is bad in this code ?

    World world = Bukkit.getWorld(getConfig().getString("SGF.Lobby.world"));
     
  2. Offline

    TheMcScavenger

    Nothing. What is the error? Is it in the main class?
     
  3. Offline

    Plugers11

    Yea
    at teams.Main.onCommand(Main.java:102) ~[?:?]
     
  4. Offline

    theguynextdoor

    Nothing, assuming there is a) A string at "SGF.Lobby.world" and b) There is a world with the name given by the string at "SGF.Lobby.world"
     
  5. Offline

    Plugers11

    Caused by: java.lang.IllegalArgumentException: Name cannot be null
     
  6. Offline

    theguynextdoor

    Let me introduce you to a very good method of debugging such errors.

    Above where you have your world variable, put this code

    Code:
    Bukkit.broadcastMessage(getConfig().getString("SGF.Lobby.world"));
    If it prints out null, then there's your problem, you don't have that string defined in your config.
    If it prints out a string, then check there is a world with that name
    The former is more likely in this case
     
  7. Offline

    Plugers11

    Ohhh
    I was stupid :_:
    I used getConfig
    I must use : cfg

    Now it's working !

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page