setting an in in a config file

Discussion in 'Plugin Development' started by bkleinman1, Sep 19, 2013.

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

    bkleinman1

    I am trying to make a plugin, but i need a value of a counter to be stored so im going to try and save it in a config file. When i tried this:
    Code:java
    1. getConfig().set("Number", nw.counter);

    I didnt work, and nothing happend.
    I am setting up the config right, and i am remembering to save it, because when i tried the same thing but with a string, it worked.
    Would really appreciate it if someone could help me.

    PS. I know that you can convert ints to strings but i have never really looked into it, if this is what i have to do for this, please could you explain in a little of detail and not just give code :) thanks!
     
  2. Offline

    L33m4n123

    String.valueOf(int); makes out of an int a String. However. You sure that nw.counter is NOT null? Because

    getConfig.set(path, null) 'deletes' the entry if there is one.. So to test it just do

    getConfig().set("Number", 5); if that worked, your nw.counter IS null^^
     
    bkleinman1 likes this.
  3. Offline

    bkleinman1

    L33m4n123 yea your right it must be null, do you know why or shall i give code?
     
  4. Offline

    Assult

    If the int is null then it basicly means that nothing is stored in it, fix it by storing something in it
     
    bkleinman1 likes this.
  5. Offline

    L33m4n123

    If you cannot figure it out on your own then sure. Post your code^^
     
    bkleinman1 likes this.
  6. Offline

    bkleinman1

    yea, i figured it out. I had set the int to 0 rather than 1, thanks :D
     
Thread Status:
Not open for further replies.

Share This Page