CommandMemory.java 798 B

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