parent
3301d2b7bf
commit
3a1abb4301
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.citycraft.CTZServer.commands;
|
||||||
|
|
||||||
|
import cn.citycraft.CTZServer.CTZServer;
|
||||||
|
import cn.citycraft.CTZServer.ServerThread;
|
||||||
|
import cn.citycraft.utils.StringUtil;
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
|
public class CommandGc extends BaseCommand {
|
||||||
|
ServerThread serverThread;
|
||||||
|
|
||||||
|
public CommandGc(ServerThread serverThread) {
|
||||||
|
super("gc", "mem");
|
||||||
|
this.serverThread = serverThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(String label, String[] args) {
|
||||||
|
Runtime rt = Runtime.getRuntime();
|
||||||
|
if (label.equalsIgnoreCase("gc"))
|
||||||
|
rt.gc();
|
||||||
|
CTZServer.print("最大内存: " + StringUtil.b2mb(rt.maxMemory()));
|
||||||
|
CTZServer.print("使用内存: " + StringUtil.b2mb(rt.totalMemory()));
|
||||||
|
CTZServer.print("空闲内存: " + StringUtil.b2mb(rt.freeMemory()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return ChatColor.GREEN + "查看服务器内存占用";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumArguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPossibleArguments() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue