Accessing the config file statically

Discussion in 'Plugin Development' started by itotallyrock, Mar 31, 2014.

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

    itotallyrock

    I'm not a pro with java and I've run across a an instantiation error
    When I attempt to access the config file statically

    I'm attempting to set a variable for a section of content in the config file
    Code:java
    1. public static String rate=getConfig().getString("rate");

    I need to be able to use this variable in static methods, how can I do this?

    I also understand that getConfig() is not a static method and needs a variable before it to reference,
    this is all I have learned for myself
    So it should be
    Code:
    Something.getConfig()
    but I don't know what to put for the "Something"

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    Avery246813579

    The something could be, Bukkit.getServer ().getConfig (). If that doesn't work make a static instance of you main class and just call to that.
     
Thread Status:
Not open for further replies.

Share This Page