mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-14 21:22:09 +00:00
Add server uptime to /gc
This commit is contained in:
parent
aa14cc39d9
commit
cdff690bb5
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -31,10 +33,12 @@ public class Commandgc extends EssentialsCommand
|
||||||
{
|
{
|
||||||
color = ChatColor.RED;
|
color = ChatColor.RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(_("uptime", Util.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())));
|
||||||
sender.sendMessage(_("tps", "" + color + tps));
|
sender.sendMessage(_("tps", "" + color + 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)));
|
||||||
|
|
||||||
for (World w : server.getWorlds())
|
for (World w : server.getWorlds())
|
||||||
{
|
{
|
||||||
|
@ -54,5 +58,6 @@ public class Commandgc extends EssentialsCommand
|
||||||
+ w.getLoadedChunks().length + _("gcchunks")
|
+ w.getLoadedChunks().length + _("gcchunks")
|
||||||
+ w.getEntities().size() + _("gcentities"));
|
+ w.getEntities().size() + _("gcentities"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue