Advertisement
tahg

Untitled

Aug 8th, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. if ((commandName.equals("chunk")) && (args.length > 0)) {
  2. try {
  3. if (args[0].equals("stats")) {
  4. sender.sendMessage("" + this.count + " active chunks.");
  5. sender.sendMessage("" + this.total + " chunks loaded since server start.");
  6. }
  7. else if (args[0].equals("getchunks")) {
  8. sender.sendMessage("Chunk cutoff set to " + this.maxChunnks + " chunks.");
  9. }
  10. else if (args[0].equals("getmemory")) {
  11. sender.sendMessage("Memory cutoff set to " + this.maxMem / 1024L / 1024L + "MB.");
  12. }
  13. else if ((args[0].equals("setchunks")) && (args.length > 1)) {
  14. this.maxChunnks = Integer.parseInt(args[1]);
  15. }
  16. else if ((args[0].equals("setmemory")) && (args.length > 1)) {
  17. this.maxMem = (Long.parseLong(args[1]) * 1024L * 1024L);
  18. }
  19. else if (args[0].equals("currentmem")) {
  20. Runtime runtime = Runtime.getRuntime();
  21. long mem = runtime.totalMemory() - runtime.freeMemory();
  22. sender.sendMessage("Used memory " + mem / 1024L / 1024L + "MB.");
  23. }
  24. else if ((args[0].equals("register")) && (args.length > 1)) {
  25. this.registrants.put(sender, new Registrant(Integer.parseInt(args[1]), sender));
  26. sender.sendMessage("Registered you for chunk updates.");
  27. }
  28. else if (args[0].equals("unregister")) {
  29. this.registrants.remove(sender);
  30. sender.sendMessage("You will no longer get chunk updates.");
  31. }
  32. else if (args[0].equals("startweb") && (args.length > 1)) {
  33. server = new SimpleWebServer(this, Integer.parseInt(args[1]));
  34. }
  35. else {
  36. sender.sendMessage("Bad syntax");
  37. return false;
  38. }
  39. }
  40. catch (Exception e) {
  41. sender.sendMessage("Exception");
  42. }
  43. return true;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement