mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-14 22:55:55 +01: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)
|
EssentialsTimer(final IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
|
history.add(20d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,7 +40,7 @@ public class EssentialsTimer implements Runnable
|
|||||||
history.remove();
|
history.remove();
|
||||||
}
|
}
|
||||||
double tps = tickInterval * 1000000.0 / timeSpent;
|
double tps = tickInterval * 1000000.0 / timeSpent;
|
||||||
if (tps <= 20)
|
if (tps <= 21)
|
||||||
{
|
{
|
||||||
history.add(tps);
|
history.add(tps);
|
||||||
}
|
}
|
||||||
|
@ -527,12 +527,12 @@ public class Util
|
|||||||
}
|
}
|
||||||
return is;
|
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)
|
public static String formatAsCurrency(final BigDecimal value)
|
||||||
{
|
{
|
||||||
dFormat.setRoundingMode(RoundingMode.FLOOR);
|
currencyFormat.setRoundingMode(RoundingMode.FLOOR);
|
||||||
String str = dFormat.format(value);
|
String str = currencyFormat.format(value);
|
||||||
if (str.endsWith(".00"))
|
if (str.endsWith(".00"))
|
||||||
{
|
{
|
||||||
str = str.substring(0, str.length() - 3);
|
str = str.substring(0, str.length() - 3);
|
||||||
@ -549,6 +549,13 @@ public class Util
|
|||||||
{
|
{
|
||||||
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
|
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)
|
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(_("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(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
|
||||||
sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
||||||
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
||||||
|
Loading…
Reference in New Issue
Block a user