mirror of
https://e.coding.net/circlecloud/CTZServer.git
synced 2024-11-24 11:58:46 +00:00
add lose file...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
3301d2b7bf
commit
3a1abb4301
41
src/main/java/cn/citycraft/CTZServer/commands/CommandGc.java
Normal file
41
src/main/java/cn/citycraft/CTZServer/commands/CommandGc.java
Normal file
@ -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
Block a user