diff options
author | Chris Ward <chris@chrisgward.com> | 2013-12-01 17:04:42 +1100 |
---|---|---|
committer | Chris Ward <chris@chrisgward.com> | 2013-12-01 17:04:42 +1100 |
commit | f8e100f5b7c869b0cf1178efc849ee2138361b4b (patch) | |
tree | bdc3b0d3c72ee7624875fb3da305a5942c6271af | |
parent | 74dcb8e47a99a624f553181e2888cb46947163ac (diff) | |
download | Essentials-f8e100f5b7c869b0cf1178efc849ee2138361b4b.tar Essentials-f8e100f5b7c869b0cf1178efc849ee2138361b4b.tar.gz Essentials-f8e100f5b7c869b0cf1178efc849ee2138361b4b.tar.lz Essentials-f8e100f5b7c869b0cf1178efc849ee2138361b4b.tar.xz Essentials-f8e100f5b7c869b0cf1178efc849ee2138361b4b.zip |
Trim long /gc output, add /gc all
63ce4a99b9
-rw-r--r-- | Essentials/src/net/ess3/commands/Commandgc.java | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandgc.java b/Essentials/src/net/ess3/commands/Commandgc.java index 710ee2216..edda5790e 100644 --- a/Essentials/src/net/ess3/commands/Commandgc.java +++ b/Essentials/src/net/ess3/commands/Commandgc.java @@ -1,12 +1,15 @@ package net.ess3.commands; -import java.lang.management.ManagementFactory; -import static net.ess3.I18n._; import net.ess3.utils.DateUtil; import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.command.CommandSender; +import java.lang.management.ManagementFactory; +import java.util.List; + +import static net.ess3.I18n._; + public class Commandgc extends EssentialsCommand { @@ -35,25 +38,34 @@ public class Commandgc extends EssentialsCommand sender.sendMessage(_("§6Free memory:§c {0} MB.", (runtime.freeMemory() / 1024 / 1024))); sender.sendMessage(_("gcquene", (ess.getStorageQueue().getQueueSize()))); - for (World w : server.getWorlds()) + List<World> worlds = server.getWorlds(); + + if(worlds.size() > 3 && args.length == 0) + { + sender.sendMessage(_("§4Message truncated, to see the full output type:§c /{0} all", commandLabel)); + } + else { - final String worldType; - switch (w.getEnvironment()) + for (World w : server.getWorlds()) { - case NETHER: - worldType = "Nether"; - break; - case THE_END: - worldType = "The End"; - break; - default: - worldType = "World"; - break; + final String worldType; + switch (w.getEnvironment()) + { + case NETHER: + worldType = "Nether"; + break; + case THE_END: + worldType = "The End"; + break; + default: + worldType = "World"; + break; - } + } - sender.sendMessage( - worldType + " \"" + w.getName() + "\": " + w.getLoadedChunks().length + _("gcchunks") + w.getEntities().size() + _("gcentities")); + sender.sendMessage( + worldType + " \"" + w.getName() + "\": " + w.getLoadedChunks().length + _("gcchunks") + w.getEntities().size() + _("gcentities")); + } } } } |