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. Offline

    timtower Administrator Administrator 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. Offline

    timtower Administrator Administrator 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. Offline

    timtower Administrator Administrator Moderator

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

    KarimAKL

    @timtower Would that be Essentials then?
     
  8. Offline

    timtower Administrator Administrator 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