Solved Getting Specific Values From Config.yml HELP!

Discussion in 'Plugin Development' started by odogollie, Oct 8, 2012.

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

    gomeow

    Did you check that link?
     
  2. Offline

    odogollie

    I did check the link, but I do not fully understand it.

    When I use .toFloat(int) it comes back with: Cannot invoke toFloat(int) on the primitive type double

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  3. Offline

    gomeow

    If make it an int, you'll lose the "cents" in the price
     
  4. Offline

    odogollie

    Well the int in the .toFloat is the amount of decimals places to go to.
     
  5. Offline

    gomeow

    this might work, not totally sure

    Code:
    double price = getConfig().getDouble(item + ".price");
    double newprice = (price)Math.round(value *100)/100; 
    
    I think that might work
     
  6. Offline

    odogollie

    ok I will try that and get back to you.

    That did not work for me... hmmm

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

    gomeow

    Code:
    double price = getConfig().getDouble(item + ".price");
    double newprice = (double)Math.round(price * 100)/100; 
     
  8. Offline

    odogollie

    Sweet! let me put all the necessary lines in and i will get back to you!
     
  9. Offline

    gomeow

    Did that work?
     
  10. Offline

    odogollie

    Yes! It works! Thank you very much!
     
  11. Offline

    gomeow

    do you have any more questions?
    otherwise, mark this as solved
     
  12. Offline

    odogollie

    Not at the moment but I will post another thread if I need more help!
     
  13. Offline

    gomeow

    Code:
    double newprice = (price)Math.round(value *1000)/1000; 
    # of 0's determines # of #s after decimal
     
Thread Status:
Not open for further replies.

Share This Page