mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-26 23:02:35 +02:00
Tidy up /gc's TPS output.
This commit is contained in:
parent
727c53eb2b
commit
293406a603
@ -22,6 +22,7 @@ public class EssentialsTimer implements Runnable
|
||||
EssentialsTimer(final IEssentials ess)
|
||||
{
|
||||
this.ess = ess;
|
||||
history.add(20d);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,7 +40,7 @@ public class EssentialsTimer implements Runnable
|
||||
history.remove();
|
||||
}
|
||||
double tps = tickInterval * 1000000.0 / timeSpent;
|
||||
if (tps <= 20)
|
||||
if (tps <= 21)
|
||||
{
|
||||
history.add(tps);
|
||||
}
|
||||
|
@ -527,12 +527,12 @@ public class Util
|
||||
}
|
||||
return is;
|
||||
}
|
||||
private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
|
||||
private static DecimalFormat currencyFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
|
||||
|
||||
public static String formatAsCurrency(final BigDecimal value)
|
||||
{
|
||||
dFormat.setRoundingMode(RoundingMode.FLOOR);
|
||||
String str = dFormat.format(value);
|
||||
currencyFormat.setRoundingMode(RoundingMode.FLOOR);
|
||||
String str = currencyFormat.format(value);
|
||||
if (str.endsWith(".00"))
|
||||
{
|
||||
str = str.substring(0, str.length() - 3);
|
||||
@ -549,6 +549,13 @@ public class Util
|
||||
{
|
||||
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
|
||||
}
|
||||
private static DecimalFormat threeDPlaces = new DecimalFormat("#,###.###");
|
||||
|
||||
public static String formatDouble(final double value)
|
||||
{
|
||||
threeDPlaces.setRoundingMode(RoundingMode.HALF_UP);
|
||||
return threeDPlaces.format(value);
|
||||
}
|
||||
|
||||
public static boolean isInt(final String sInt)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public class Commandgc extends EssentialsCommand
|
||||
}
|
||||
|
||||
sender.sendMessage(_("uptime", Util.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())));
|
||||
sender.sendMessage(_("tps", "" + color + tps));
|
||||
sender.sendMessage(_("tps", "" + color + Util.formatDouble(tps)));
|
||||
sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
||||
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
||||
|
Loading…
Reference in New Issue
Block a user