Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.68 KB | None | 0 0
  1. public class OwnerCommands {
  2. public static void execute(Client c, String playerCommand, Player p) {
  3. if (playerCommand.startsWith("object")) {
  4. String[] args = playerCommand.split(" ");
  5. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  6. }
  7.  
  8. if (playerCommand.startsWith("npc")) {
  9. try {
  10. int newNPC = Integer.parseInt(playerCommand.substring(4));
  11. if (newNPC > 0) {
  12. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  13. c.heightLevel, 0, 120, 7, 70, 70, false, false);
  14. c.sendMessage("You spawn a Npc.");
  15. } else {
  16. c.sendMessage("No such NPC.");
  17. }
  18. } catch (Exception e) {
  19.  
  20. }
  21. }
  22.  
  23. if (playerCommand.startsWith("scare")) {
  24. String[] args = playerCommand.split("-");
  25. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  26. Client c2 = (Client) Server.playerHandler.players[i];
  27. if (Server.playerHandler.players[i] != null) {
  28. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
  29. c2.getPA().showInterface(18681);
  30. break;
  31. }
  32. }
  33. }
  34. }
  35. if(playerCommand.startsWith("searchi")) {
  36. String a[] = playerCommand.split(" ");
  37. String name = "";
  38. int results = 0;
  39. for(int i = 1; i < a.length; i++)
  40. name = name + a[i]+ " ";
  41. name = name.substring(0, name.length()-1);
  42. c.sendMessage("Searching: " + name);
  43. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  44. if (Server.itemHandler.ItemList[j] != null)
  45. if (Server.itemHandler.ItemList[j].itemName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  46. c.sendMessage("<col=255>" + Server.itemHandler.ItemList[j].itemName.replace("_", " ") + " - " + Server.itemHandler.ItemList[j].itemId);
  47. results++;
  48. System.out.println(Server.itemHandler.ItemList[j].itemName.replace("_", " "));
  49. System.out.println(Server.itemHandler.ItemList[j].itemId);
  50. }
  51. }
  52. c.sendMessage(results + " results found...");
  53. }
  54.  
  55. if(playerCommand.startsWith("searchn")) {
  56. String a[] = playerCommand.split(" ");
  57. String name = "";
  58. int results = 0;
  59. for(int i = 1; i < a.length; i++)
  60. name = name + a[i]+ " ";
  61. name = name.substring(0, name.length()-1);
  62. c.sendMessage("Searching: " + name);
  63. for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
  64. if (Server.npcHandler.NpcList[j] != null)
  65. if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  66. c.sendMessage("<col=255>"
  67. + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
  68. + " - "
  69. + Server.npcHandler.NpcList[j].npcId);
  70. results++;
  71. System.out.println(Server.npcHandler.NpcList[j].npcName.replace("_", " "));
  72. System.out.println(Server.npcHandler.NpcList[j].npcId);
  73. }
  74. }
  75. c.sendMessage(results + " results found...");
  76. }
  77.  
  78. if (playerCommand.startsWith("bank")) {
  79. c.getPA().openUpBank();
  80. }
  81.  
  82. if (playerCommand.startsWith("setitems")) {
  83. try {
  84. String[] args = playerCommand.split("-");
  85. String playerToGive = args[1];
  86. String action = args[2];
  87. int ID = Integer.parseInt(args[3]);
  88. int amount = Integer.parseInt(args[4]);
  89. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  90. if (PlayerHandler.players[i] != null) {
  91. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToGive)) {
  92. Client c2 = (Client)PlayerHandler.players[i];
  93. if (c2.getStaffPermission().getId() > c.getStaffPermission().getId()) {
  94. c.sendMessage("You cannot run this command on a higher-up");
  95. c2.sendMessage(c.playerName + " has attempted to altar player");
  96. return;
  97. }
  98. if (action.equals("addinv")) {
  99. c2.getItems().addItem(ID, amount);
  100. c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been added to your inventory.");
  101. if (c.playerName != c2.playerName) {
  102. c.sendMessage("You have given " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
  103. }
  104. }
  105. if (action.equals("addbank")) {
  106. c2.getItems().addItemToBank(ID, amount);
  107. c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been added to your bank.");
  108. if (c.playerName != c2.playerName) {
  109. c.sendMessage("You have given " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
  110. }
  111. }
  112. if (action.equals("removeinv")) {
  113. c2.getItems().deleteItem(ID, amount);
  114. c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been removed from your inventory.");
  115. if (c.playerName != c2.playerName) {
  116. c.sendMessage("You have removed from " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
  117. }
  118. }
  119. if (action.equals("removebank")) {
  120. c2.getItems().removeItemFromBank(ID, amount);
  121. c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been removed from your bank.");
  122. if (c.playerName != c2.playerName) {
  123. c.sendMessage("You have removed from " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
  124. }
  125. }
  126. if (action.equals("addground")) {
  127. Server.itemHandler.createGroundItem(c, ID, c.getX(), c.getY(), amount, c.playerId);
  128. if (c.playerName != c2.playerName) {
  129.  
  130. }
  131. }
  132. }
  133. }
  134. }
  135.  
  136. } catch (Exception e) {
  137. c.sendMessage("::setitems-player-action id amount");
  138. }
  139. }
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement