Trim long /gc output, add /gc all

This commit is contained in:
KHobbits 2013-01-20 20:35:41 +00:00
parent 1ccda52e9f
commit 63ce4a99b9
15 changed files with 40 additions and 18 deletions

View File

@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
@ -33,28 +34,36 @@ public class Commandgc extends EssentialsCommand
{ {
color = ChatColor.RED; color = ChatColor.RED;
} }
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 + 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()) List<World> worlds = server.getWorlds();
if (worlds.size() > 3 && args.length == 0)
{ {
String worldType = "World"; sender.sendMessage(_("messageTruncated", commandLabel, "all"));
switch (w.getEnvironment())
{
case NETHER:
worldType = "Nether";
break;
case THE_END:
worldType = "The End";
break;
}
sender.sendMessage(_("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size()));
} }
else
{
for (World w : worlds)
{
String worldType = "World";
switch (w.getEnvironment())
{
case NETHER:
worldType = "Nether";
break;
case THE_END:
worldType = "The End";
break;
}
sender.sendMessage(_("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size()));
}
}
} }
} }

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -495,3 +495,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -491,4 +491,5 @@ holdFirework=\u00a74You must be holding a firework to add effects
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -492,3 +492,4 @@ invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value f
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}

View File

@ -129,7 +129,7 @@ commands:
aliases: [gm,creative,creativemode,survival,survivalmode,adventure,adventuremode,gmc,gma,gms,gmt,egamemod,eecreative,ecreativemode,esurvival,esurvivalmode,eadventure,eadventuremode,egmc,egma,egms,egm,egmt] aliases: [gm,creative,creativemode,survival,survivalmode,adventure,adventuremode,gmc,gma,gms,gmt,egamemod,eecreative,ecreativemode,esurvival,esurvivalmode,eadventure,eadventuremode,egmc,egma,egms,egm,egmt]
gc: gc:
description: Reports memory, uptime and tick info. description: Reports memory, uptime and tick info.
usage: /<command> usage: /<command> [all]
aliases: [elag,lag,mem,memory,egc,emem,ememory,uptime,euptime] aliases: [elag,lag,mem,memory,egc,emem,ememory,uptime,euptime]
getpos: getpos:
description: Get your current coordinates or those of a player. description: Get your current coordinates or those of a player.