Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Convert Scientific Notation to decimal format #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/mmo/Info/MMOInfoGold.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package mmo.Info;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Locale;
Expand Down Expand Up @@ -115,7 +116,9 @@ public void onTick() {
final String plat = numForm.format(economy.getBalance(this.getScreen().getPlayer().getName()));
setText(String.format(ChatColor.WHITE + plat));
} else {
final String[] money = Double.toString((double) economy.getBalance(this.getScreen().getPlayer().getName())).split("\\.");
double moneyvalue = (double) economy.getBalance(this.getScreen().getPlayer().getName());
NumberFormat numberformat = new DecimalFormat("0.00");
final String[] money = numberformat.format(moneyvalue).split("\\.");
setText(String.format(ChatColor.WHITE + "%s" + ChatColor.YELLOW + "g " + ChatColor.WHITE + "%s" + ChatColor.GRAY + "s", money.length > 0 ? money[0] : "0", money.length > 1 ? money[1] : "0"));
}
}
Expand Down