Vault economy (getting balance error)

Discussion in 'Plugin Development' started by ThunderWaffeMC, Jul 6, 2013.

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

    ThunderWaffeMC

    I'm trying to use vault economy so if the player has more money than the string in the config it will work. I know that:

    if (econ.getBalance(player.getName()) > 500) {

    works but (as in the 500 being the integer) but it wont work as "price" (which will be an integer in the config)

    My code:

    Code:java
    1.  
    2. String price = this.plugin.getConfig().getString("diamond_sword_bow.spawn_diamond_swordbow_price");
    3. if (econ.getBalance(player.getName()) > price) { //if player does have more than <price>
    4. }
    5.  


    I get the error saying: the operator > is undefined for the types(s) double, String

    Thanks!
     
  2. Offline

    Unknowncmbk

    Simple:
    int num = Integer.parseString(price);
     
  3. Offline

    ThunderWaffeMC

    Unknowncmbk Thanks! But I get errors on ParseString ?
     
  4. Offline

    Unknowncmbk

    Probably something to do with "ParseString has a throws declaration" in which you can solve by surrounding with try/catch clause.

    try{
    int num = Integer.parseInt(price);
    }
    catch (Exception e){
    System.out.println(e);
    }
     
  5. Offline

    GodzOfMadness

    Where are you getting parseString from? It's parseInt(..)
     
    ThunderWaffeMC and Unknowncmbk like this.
  6. Offline

    Unknowncmbk

    :eek: A bad boy that knows how to type Integer. in Eclispe!
     
Thread Status:
Not open for further replies.

Share This Page