1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-16 03:24:31 +02:00

Trim long /gc output, add /gc all

63ce4a99b9
This commit is contained in:
Chris Ward
2013-12-01 17:04:42 +11:00
parent 74dcb8e47a
commit f8e100f5b7

View File

@@ -1,12 +1,15 @@
package net.ess3.commands; package net.ess3.commands;
import java.lang.management.ManagementFactory;
import static net.ess3.I18n._;
import net.ess3.utils.DateUtil; import net.ess3.utils.DateUtil;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.lang.management.ManagementFactory;
import java.util.List;
import static net.ess3.I18n._;
public class Commandgc extends EssentialsCommand 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(_("§6Free memory:§c {0} MB.", (runtime.freeMemory() / 1024 / 1024)));
sender.sendMessage(_("gcquene", (ess.getStorageQueue().getQueueSize()))); sender.sendMessage(_("gcquene", (ess.getStorageQueue().getQueueSize())));
for (World w : server.getWorlds()) List<World> worlds = server.getWorlds();
if(worlds.size() > 3 && args.length == 0)
{ {
final String worldType; sender.sendMessage(_("§4Message truncated, to see the full output type:§c /{0} all", commandLabel));
switch (w.getEnvironment()) }
else
{
for (World w : server.getWorlds())
{ {
case NETHER: final String worldType;
worldType = "Nether"; switch (w.getEnvironment())
break; {
case THE_END: case NETHER:
worldType = "The End"; worldType = "Nether";
break; break;
default: case THE_END:
worldType = "World"; worldType = "The End";
break; 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"));
} }
} }
} }