mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-30 21:07:48 +01:00
cleaner way to show incoming payments
This commit is contained in:
parent
a7aead4639
commit
278c001389
@ -121,9 +121,9 @@ public class GeneralConfigManager {
|
||||
|
||||
public int AutoJobJoinDelay;
|
||||
public boolean AutoJobJoinUse;
|
||||
|
||||
|
||||
public boolean AllowDelevel;
|
||||
|
||||
|
||||
//BossBar
|
||||
public boolean BossBarEnabled;
|
||||
public boolean BossBarShowOnEachAction;
|
||||
|
@ -110,15 +110,31 @@ public class ActionBar {
|
||||
if (abp != null && show) {
|
||||
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||
if (payment.getAmount() != 0D)
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format("%.2f", payment.getAmount()));
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", convertAmount(payment.getAmount()));
|
||||
|
||||
if (payment.getPoints() != 0D)
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format("%.2f", payment.getPoints()));
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", convertAmount(payment.getPoints()));
|
||||
|
||||
if (payment.getExp() != 0D)
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format("%.2f", payment.getExp()));
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", convertAmount(payment.getExp()));
|
||||
|
||||
send(abp, ChatColor.GREEN + Message);
|
||||
}
|
||||
}
|
||||
|
||||
private String convertAmount(double amount) {
|
||||
String format = "%.2f";
|
||||
if (amount % 1 == 0 || amount > 100 || amount < -100) {
|
||||
amount = (int) Math.round(amount);
|
||||
format = "%.0f";
|
||||
} else {
|
||||
if ((amount * 10) % 1 == 0) {
|
||||
format = "%.1f";
|
||||
}
|
||||
}
|
||||
return String.format(format, amount);
|
||||
}
|
||||
|
||||
public void send(CommandSender receivingPacket, String msg) {
|
||||
try {
|
||||
if (msg == null || nmsChatSerializer == null || msg.isEmpty())
|
||||
|
Loading…
Reference in New Issue
Block a user