CommandMemory.java 867 B

12345678910111213141516171819202122232425262728
  1. package me.km.commands;
  2. import me.km.api.Module;
  3. import me.km.api.ModuleCommand;
  4. import me.km.permissions.Permissions;
  5. import net.minecraft.command.ICommandSender;
  6. public class CommandMemory extends ModuleCommand
  7. {
  8. public CommandMemory(Module m)
  9. {
  10. super("memory", m);
  11. super.setDescription("Gibt RAM Information aus");
  12. super.setUsage("/memory");
  13. super.setPermission(Permissions.MEMORY);
  14. super.addAlias("mem");
  15. }
  16. @Override
  17. public boolean execute(ICommandSender cs, String[] arg)
  18. {
  19. Runtime runtime = Runtime.getRuntime();
  20. long allocatedMemory = runtime.totalMemory() / 1048576;
  21. long usedMemory = allocatedMemory - (runtime.freeMemory() / 1048576);
  22. this.getModule().send(cs, "RAM-Belegung: " + usedMemory + " / " + allocatedMemory + " MB");
  23. return true;
  24. }
  25. }