diff options
Diffstat (limited to 'Essentials/src/net/ess3/commands/Commandgc.java')
-rw-r--r-- | Essentials/src/net/ess3/commands/Commandgc.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandgc.java b/Essentials/src/net/ess3/commands/Commandgc.java new file mode 100644 index 000000000..dfb2917c7 --- /dev/null +++ b/Essentials/src/net/ess3/commands/Commandgc.java @@ -0,0 +1,41 @@ +package net.ess3.commands; + +import static net.ess3.I18n._; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.CommandSender; + + +public class Commandgc extends EssentialsCommand +{ + @Override + protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + float tps = ess.getTimer().getAverageTPS(); + ChatColor color; + if (tps >= 18) + { + color = ChatColor.GREEN; + } + else if (tps >= 15) + { + color = ChatColor.YELLOW; + } + else + { + color = ChatColor.RED; + } + sender.sendMessage(_("tps", "" + color + 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))); + + for (World w : server.getWorlds()) + { + sender.sendMessage( + (w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": " + + w.getLoadedChunks().length + _("gcchunks") + + w.getEntities().size() + _("gcentities")); + } + } +} |