Solved Vault - Shorten balance

Discussion in 'Plugin Development' started by KarimAKL, May 8, 2018.

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

    KarimAKL

    What i want is to make it so that when using Vault's getBalance it doesn't show "0.0" and instead shows "0" another example is instead of "27.53832" it shows "27.53", how would i do this?
    EDIT: I have tried searching around for it but i couldn't seem to find anywhere that tells me how to do this.
     
  2. Online

    timtower Ninja on the waves Moderator

  3. Offline

    KarimAKL

    @timtower Thanks alot! :)
    End result:
    Code:Java
    1.  
    2. DecimalFormat df = new DecimalFormat("#.##");
    3. sender.sendMessage(df.format(plugin.econ.getBalance(target)))
    4.  

    This seems to work for now, thanks again. :) Solved.
     
  4. Online

    timtower Ninja on the waves Moderator

  5. Offline

    KarimAKL

    @timtower Oh okay.
    New end result:
    Code:Java
    1.  
    2. sender.sendMessage(plugin.econ.format(plugin.econ.getBalance(target)));
    3.  

    This shows the "$" before the amount so how do i change the "$" to something else?
     
  6. Online

    timtower Ninja on the waves Moderator

    @KarimAKL That is handled in the economy plugin itself.
     
  7. Offline

    KarimAKL

    @timtower Would that be Essentials then?
     
  8. Online

    timtower Ninja on the waves Moderator

    If that is your installed economy plugin then yes.
     
  9. Offline

    KarimAKL

    @timtower It is. Thanks for the help, this thread is solved now. :)
     
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page