Advertisement
Guest User

brianxxxx

a guest
Jan 9th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 89.66 KB | None | 0 0
  1. package server.model.players.packets;
  2.  
  3. import java.io.BufferedWriter;
  4. import java.io.FileWriter;
  5. import java.io.IOException;
  6.  
  7. import server.Config;
  8. import server.Connection;
  9. import server.Server;
  10. import server.core.PlayerHandler;
  11. import server.core.World;
  12. import server.model.Location;
  13. import server.model.Projectile;
  14. import server.model.content.Achievements;
  15. import server.model.content.Decanting;
  16. import server.model.content.Donation;
  17. import server.model.content.Lottery;
  18. import server.model.content.teleports.TeleportHandler;
  19. import server.model.npcs.NPCHandler;
  20. import server.model.npcs.NPCLootTable;
  21. import server.model.players.Client;
  22. import server.model.players.PacketType;
  23. import server.model.players.Player;
  24. import server.model.players.PlayerSave;
  25. import server.model.players.TradingPost;
  26. import server.region.Region;
  27. import server.tick.Tickable;
  28. import server.util.Misc;
  29.  
  30. public class Commands implements PacketType {
  31.  
  32. public static int randomItem[] = { 4151, 1050, 6570, 11832, 11834, 1042, 3062, 15004, 11862, 12954, 12939, 13179, 13178, 13177, 13181, 13197, 13199, 13120, 989, 10398, 6570, 6573, 6575, 6577, 6581, 6733, 6735, 6737, 6914, 6916, 6918, 6920, 6922, 6924, 3062 };
  33.  
  34. public static int randomStarterItem() {
  35. return randomItem[(int) (Math.random() * randomItem.length)];
  36. }
  37.  
  38. @Override
  39. public void processPacket(Client c, int packetType, int packetSize) {
  40. String playerCommand = c.getInStream().readString();
  41. playerCommand = Misc.getFilteredInput(playerCommand);
  42. Misc.println(c.playerName + " playerCommand: " + playerCommand);
  43. if (c.duelStatus > 0) {
  44. c.sendMessage("You can't do that command here!");
  45. return;
  46. }
  47. if (c.playerRights >= 1 && c.playerRights <= 3
  48. && c.isModerator(c.playerName)) {// 1
  49. moderatorCommands(c, playerCommand);
  50. }
  51. if (c.playerRights == 2) { // 2
  52. adminCommands(c, playerCommand);
  53. }
  54. if (c.playerRights == 3 || c.playerName.equalsIgnoreCase("jari") || c.playerName.equalsIgnoreCase("roy") || c.playerName.equalsIgnoreCase("the zombie")) { // 3
  55. ownerCommands(c, playerCommand);
  56. }
  57. if (c.playerRights == 6) {
  58. donatorCommands(c, playerCommand);
  59. }
  60. if (c.playerRights == 7 && c.isHelper(c.playerName)) {
  61. helperCommands(c, playerCommand);
  62. }
  63. if (c.playerRights == 8 && c.isTrusted(c.playerName)) {
  64. trustedCommands(c, playerCommand);
  65. }
  66. if (c.playerRights == 9) {
  67. veteranCommands(c, playerCommand);
  68. }
  69. if (c.playerRights == 10 && c.ironDonator(c.playerName)) {
  70. ironDonatorCommands(c, playerCommand);
  71. }
  72. if (c.playerRights == 3) {
  73. if (playerCommand.equalsIgnoreCase("special")) {
  74. c.specAmount += 10;
  75. c.attackTimer = 0;
  76. }
  77. }
  78. playerCommands(c, playerCommand);
  79. /*
  80. * if (Config.IS_BETA && !c.isStaff()) { if
  81. * (playerCommand.startsWith("item")) { try { if (c.inClanWarsGame)
  82. * return; String[] args = playerCommand.split(" "); if (args.length ==
  83. * 3) { int newItemID = Integer.parseInt(args[1]);// item ID int
  84. * newItemAmount = Integer.parseInt(args[2]);// ITEM // AMOUNT if
  85. * ((newItemID <= 25000) && (newItemID >= 0)) {
  86. * c.getItems().addItem(newItemID, newItemAmount);
  87. * System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
  88. * } else { c.sendMessage("No such item."); } } else {
  89. * c.sendMessage("Use as ::item 995 200"); } } catch (Exception e) { } }
  90. * if (playerCommand.startsWith("master") && !c.inWild()) { for (int i =
  91. * 0; i < 22; i++) { c.playerLevel[i] = 99; c.playerXP[i] =
  92. * c.getPA().getXPForLevel(100); c.getPA().refreshSkill(i); }
  93. * c.getPA().requestUpdates(); } }
  94. */
  95. }
  96.  
  97.  
  98. public static void ironDonatorCommands(Client c, String playerCommand) {
  99. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 10) {
  100. String rank = "[@blu@<img=6>Iron Donator@bla@][@blu@"
  101. + c.playerName + "@bla@]:@dre@";
  102. String Message = playerCommand.substring(4);
  103. if (c.playerRights == 0) {
  104. c.sendMessage("Do you want access to the yell command? ::donate");
  105. return;
  106. }
  107. if (Connection.isMuted(c)) {
  108. c.sendMessage("You are muted for breaking a rule.");
  109. return;
  110. }
  111. for (int j = 0; j < PlayerHandler.players.length; j++) {
  112. if (PlayerHandler.players[j] != null) {
  113. String text = playerCommand.substring(5);
  114. String[] yellreq = { "chalreq", "duelreq", "tradereq",
  115. ".com", "www.", "317" };
  116. for (int i = 0; i < yellreq.length; i++) {
  117. if (text.indexOf(yellreq[i]) >= 0) {
  118. PlayerHandler.players[i].disconnected = true;
  119. return;
  120. }
  121. }
  122. Client c2 = (Client) PlayerHandler.players[j];
  123. c2.sendMessage(rank + Message);
  124. }
  125. }
  126. }
  127. if (playerCommand.equals("donatorcave")) {
  128. c.sendMessage("Use the ladder at Donator Zone!");
  129. }
  130. if (playerCommand.equalsIgnoreCase("spells")) {
  131. if (c.inWild() || c.inPvP()) {
  132. c.sendMessage("You can't use this in the Wilderness");
  133. return;
  134. }
  135. if (c.playerMagicBook == 2) {
  136. c.sendMessage("You switch to modern magic.");
  137. c.setSidebarInterface(6, 1151);
  138. c.playerMagicBook = 0;
  139. } else if (c.playerMagicBook == 0) {
  140. c.sendMessage("You switch to ancient magic.");
  141. c.setSidebarInterface(6, 12855);
  142. c.playerMagicBook = 1;
  143. } else if (c.playerMagicBook == 1) {
  144. c.sendMessage("You switch to lunar magic.");
  145. c.setSidebarInterface(6, 29999);
  146. c.playerMagicBook = 2;
  147. }
  148. }
  149. }
  150.  
  151. public static void helperCommands(Client c, String playerCommand) {
  152. if (c.playerName.contains("artz") || c.playerName.contains("")
  153. || c.playerName.contains("")
  154. || c.playerName.contains("")
  155. || c.playerName.contains("") || c.playerName.contains("") || c.playerName.contains("Mercy")) {
  156. donatorCommands(c, playerCommand);
  157. }
  158. if (playerCommand.equalsIgnoreCase("unbancc")) {
  159. String[] playerToMod = playerCommand.split(" ", 2);
  160. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  161. if (PlayerHandler.players[i] != null) {
  162. if (PlayerHandler.players[i].playerName
  163. .equalsIgnoreCase(playerToMod[1])) {
  164. Client c2 = (Client) PlayerHandler.players[i];
  165. c.clan.unbanMember(c2.playerName);
  166. c.sendMessage("Successfully unbanned " + c2.playerName);
  167. }
  168. }
  169. }
  170. }
  171. if (playerCommand.equalsIgnoreCase("fixinv")) {
  172. c.getItems().resetItems(3214);
  173. c.getPA().viewingOther = false;
  174. }
  175. if (playerCommand.equals("staffzone")) {
  176. c.getPA().startTeleport(2912, 5475, 0, "modern");
  177. }
  178. if (playerCommand.equalsIgnoreCase("checkinv")) {
  179. try {
  180. String[] args = playerCommand.split(" ", 2);
  181. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  182. Client o = (Client) PlayerHandler.players[i];
  183. if (PlayerHandler.players[i] != null) {
  184. if (PlayerHandler.players[i].playerName
  185. .equalsIgnoreCase(args[1])) {
  186. c.getPA().otherInv(c, o);
  187. c.getPA().viewingOther = true;
  188. break;
  189. }
  190. }
  191. }
  192. } catch (Exception e) {
  193. c.sendMessage("Player Must Be Offline.");
  194. }
  195. }
  196. if (playerCommand.equalsIgnoreCase("checkbank")) {
  197. try {
  198. String[] args = playerCommand.split(" ", 2);
  199. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  200. Client o = (Client) PlayerHandler.players[i];
  201. if (PlayerHandler.players[i] != null) {
  202. if (PlayerHandler.players[i].playerName
  203. .equalsIgnoreCase(args[1])) {
  204. c.getPA().viewOtherBank(c, o);
  205. break;
  206. }
  207. }
  208. }
  209. } catch (Exception e) {
  210. c.sendMessage("Player Must Be Offline.");
  211. }
  212. }
  213. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 7) {
  214. String rank = "[@blu@<img=6>Helper@bla@][@blu@" + c.playerName
  215. + "@bla@]:@dre@";
  216. String Message = playerCommand.substring(4);
  217. if (c.playerRights == 0) {
  218. c.sendMessage("Do you want access to the yell command? ::donate");
  219. return;
  220. }
  221. if (Connection.isMuted(c)) {
  222. c.sendMessage("You are muted for breaking a rule.");
  223. return;
  224. }
  225. for (int j = 0; j < PlayerHandler.players.length; j++) {
  226. if (PlayerHandler.players[j] != null) {
  227. String text = playerCommand.substring(5);
  228. String[] yellreq = { "chalreq", "duelreq", "tradereq",
  229. ".com", "www.", "317" };
  230. for (int i = 0; i < yellreq.length; i++) {
  231. if (text.indexOf(yellreq[i]) >= 0) {
  232. PlayerHandler.players[i].disconnected = true;
  233. return;
  234. }
  235. }
  236. Client c2 = (Client) PlayerHandler.players[j];
  237. c2.sendMessage(rank + Message);
  238. }
  239. }
  240. }
  241. }
  242.  
  243. public static void veteranCommands(Client c, String playerCommand) {
  244. donatorCommands(c, playerCommand);
  245. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 9) {
  246. String rank = "[@blu@<img=8>Veteran@bla@][@blu@" + c.playerName
  247. + "@bla@]:@dre@";
  248. String Message = playerCommand.substring(4);
  249. if (c.playerRights == 0) {
  250. c.sendMessage("Do you want access to the yell command? ::donate");
  251. return;
  252. }
  253. if (Connection.isMuted(c)) {
  254. c.sendMessage("You are muted for breaking a rule.");
  255. return;
  256. }
  257. for (int j = 0; j < PlayerHandler.players.length; j++) {
  258. if (PlayerHandler.players[j] != null) {
  259. String text = playerCommand.substring(5);
  260. String[] yellreq = { "chalreq", "duelreq", "tradereq",
  261. ".com", "www.", "317" };
  262. for (int i = 0; i < yellreq.length; i++) {
  263. if (text.indexOf(yellreq[i]) >= 0) {
  264. PlayerHandler.players[i].disconnected = true;
  265. return;
  266. }
  267. }
  268. Client c2 = (Client) PlayerHandler.players[j];
  269. c2.sendMessage(rank + Message);
  270. }
  271. }
  272. }
  273. }
  274.  
  275. public static void trustedCommands(Client c, String playerCommand) {
  276. donatorCommands(c, playerCommand);
  277. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 8) {
  278. String rank = "[@blu@<img=7>Trusted@bla@][@blu@" + c.playerName
  279. + "@bla@]:@dre@";
  280. String Message = playerCommand.substring(4);
  281. if (c.playerRights == 0) {
  282. c.sendMessage("Do you want access to the yell command? ::donate");
  283. return;
  284. }
  285. if (Connection.isMuted(c)) {
  286. c.sendMessage("You are muted for breaking a rule.");
  287. return;
  288. }
  289. for (int j = 0; j < PlayerHandler.players.length; j++) {
  290. if (PlayerHandler.players[j] != null) {
  291. String text = playerCommand.substring(5);
  292. String[] yellreq = { "chalreq", "duelreq", "tradereq",
  293. ".com", "www.", "317" };
  294. for (int i = 0; i < yellreq.length; i++) {
  295. if (text.indexOf(yellreq[i]) >= 0) {
  296. PlayerHandler.players[i].disconnected = true;
  297. return;
  298. }
  299. }
  300. Client c2 = (Client) PlayerHandler.players[j];
  301. c2.sendMessage(rank + Message);
  302. }
  303. }
  304. }
  305. if (playerCommand.equalsIgnoreCase("spells")) {
  306. if (c.inWild() || c.inPvP()) {
  307. c.sendMessage("You can't use this in the Wilderness");
  308. return;
  309. }
  310. if (c.playerMagicBook == 2) {
  311. c.sendMessage("You switch to modern magic.");
  312. c.setSidebarInterface(6, 1151);
  313. c.playerMagicBook = 0;
  314. } else if (c.playerMagicBook == 0) {
  315. c.sendMessage("You switch to ancient magic.");
  316. c.setSidebarInterface(6, 12855);
  317. c.playerMagicBook = 1;
  318. } else if (c.playerMagicBook == 1) {
  319. c.sendMessage("You switch to lunar magic.");
  320. c.setSidebarInterface(6, 29999);
  321. c.playerMagicBook = 2;
  322. }
  323. }
  324. }
  325. public static void extremeDonator(Client c, String playerCommand) {
  326. donatorCommands(c, playerCommand);
  327. if (playerCommand.equalsIgnoreCase("spells") && c.playerRights == 6) {
  328. if (c.inWild() || c.inPvP()) {
  329. c.sendMessage("You can't use this in the Wilderness");
  330. return;
  331. }
  332. if (c.playerMagicBook == 2) {
  333. c.sendMessage("You switch to modern magic.");
  334. c.setSidebarInterface(6, 1151);
  335. c.playerMagicBook = 0;
  336. } else if (c.playerMagicBook == 0) {
  337. c.sendMessage("You switch to ancient magic.");
  338. c.setSidebarInterface(6, 12855);
  339. c.playerMagicBook = 1;
  340. } else if (c.playerMagicBook == 1) {
  341. c.sendMessage("You switch to lunar magic.");
  342. c.setSidebarInterface(6, 29999);
  343. c.playerMagicBook = 2;
  344. }
  345. }
  346. }
  347. public static void donatorCommands(Client c, String playerCommand) {
  348. if (playerCommand.equalsIgnoreCase("dz")) {
  349. c.getPA().startTeleport(2889, 3511, 0, "modern");
  350. }
  351. }
  352.  
  353. public static void ownerCommands(final Client c, String playerCommand) {
  354. testCommands(c, playerCommand);
  355. donatorCommands(c, playerCommand);
  356. if (playerCommand.equalsIgnoreCase("copy")) {
  357. int[] arm = new int[14];
  358. playerCommand.substring(5);
  359. for (int j = 0; j < PlayerHandler.players.length; j++) {
  360. if (PlayerHandler.players[j] != null) {
  361. Client c2 = (Client)PlayerHandler.players[j];
  362. if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))){
  363. for(int q = 0; q < c2.playerEquipment.length; q++) {
  364. arm[q] = c2.playerEquipment[q];
  365. c.playerEquipment[q] = c2.playerEquipment[q];
  366. }
  367. for(int q = 0; q < arm.length; q++) {
  368. c.getItems().setEquipment(arm[q],1,q);
  369. }
  370. }
  371. }
  372. }
  373. }
  374. if (playerCommand.equalsIgnoreCase("price")) {
  375. String[] itemId = playerCommand.split("-");
  376. if (itemId.length > 1)
  377. c.sendMessage(c.getItems().getItemName(Integer.parseInt(itemId[1])) + " costs " + TeleportHandler.TRAINING_TELEPORT.formatCost(c, c.getShops().getItemShopValue(Integer.parseInt(itemId[1]))));
  378. else
  379. c.sendMessage("invalid");
  380. }
  381. if (playerCommand.equals("meeting")) {
  382. c.getPA().movePlayer(2443, 4955, 0);
  383. }
  384. if(playerCommand.equalsIgnoreCase("getid")) {
  385. String a[] = playerCommand.split(" ");
  386. String name = "";
  387. int results = 0;
  388.  
  389. for(int i = 1; i < a.length; i++)
  390.  
  391. name = name + a[i]+ " ";
  392. name = name.substring(0, name.length()-1);
  393. if(name.length() < 3) {
  394. c.sendMessage("Please add more characters to the search too narrow options.");
  395. return;
  396. } else
  397. c.sendMessage("Searching: " + name);
  398. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  399. if (Server.itemHandler.ItemList[j] != null)
  400. if (Server.itemHandler.ItemList[j].itemName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  401. c.sendMessage("-"
  402. + Server.itemHandler.ItemList[j].itemName.replace("_", " ")
  403. + " - "
  404. + Server.itemHandler.ItemList[j].itemId);
  405. results++;
  406. }
  407. }
  408. c.sendMessage(results + " results found...");
  409. }
  410. if (playerCommand.equalsIgnoreCase("mp")) {
  411. c.getPA().sendFrame126("" + 10000, 8135);
  412. }
  413. if (playerCommand.equalsIgnoreCase("wz")) {
  414. try {
  415. BufferedWriter spawn = new BufferedWriter(new FileWriter("./Data/cfg/spawn-config.cfg", true));
  416. NPCHandler.spawnNpc(c, 419, c.absX, c.absY, 0, 0, 0, 0, 0, 0, false, false);
  417. c.sendMessage("You spawn a weak Npc.");
  418. try {
  419. spawn.newLine();
  420. spawn.write("spawn = 419 " +c.absX+" " +c.absY+" 0 1 15 70 40");
  421. } finally {
  422. spawn.close();
  423. }
  424. } catch (IOException e) {
  425. e.printStackTrace();
  426. }
  427. }
  428. if (playerCommand.equalsIgnoreCase("mz")) {
  429.  
  430. try {
  431. BufferedWriter spawn = new BufferedWriter(new FileWriter(
  432. "./Data/cfg/spawn-config.cfg", true));
  433. NPCHandler.spawnNpc(c, 420, c.absX, c.absY, 0, 0, 0, 0, 0, 0,
  434. false, false);
  435. c.sendMessage("You spawn a Medium Male Npc.");
  436. try {
  437. spawn.newLine();
  438. spawn.write("spawn = 421 " + c.absX + " " + c.absY
  439. + " 0 1 24 80 75");
  440. } finally {
  441. spawn.close();
  442. }
  443. } catch (IOException e) {
  444. e.printStackTrace();
  445. }
  446. }
  447.  
  448. if (playerCommand.equalsIgnoreCase("sz")) {
  449. try {
  450. BufferedWriter spawn = new BufferedWriter(new FileWriter("./Data/cfg/spawn-config.cfg", true));
  451. NPCHandler.spawnNpc(c, 420, c.absX, c.absY, 0, 0, 0, 0, 0, 0, false, false);
  452. c.sendMessage("You spawn a hard Male Npc.");
  453. try {
  454. spawn.newLine();
  455. spawn.write("spawn = 422 " +c.absX+" " +c.absY+" 0 1 15 150 130");
  456. } finally {
  457. spawn.close();
  458. }
  459. } catch (IOException e) {
  460. e.printStackTrace();
  461. }
  462. }
  463. if (playerCommand.equalsIgnoreCase("ssz")) {
  464.  
  465. try {
  466. BufferedWriter spawn = new BufferedWriter(new FileWriter(
  467. "./Data/cfg/spawn-config.cfg", true));
  468. NPCHandler.spawnNpc(c, 423, c.absX, c.absY, 0, 0, 0, 0, 0, 0,
  469. false, false);
  470. c.sendMessage("You spawn a hard Male Npc.");
  471. try {
  472. spawn.newLine();
  473. spawn.write("spawn = 423 " + c.absX + " " + c.absY
  474. + " 0 1 35 100 120 SportsZombie");
  475. } finally {
  476. spawn.close();
  477. }
  478. } catch (IOException e) {
  479. e.printStackTrace();
  480. }
  481. }
  482. if (playerCommand.equalsIgnoreCase("bz")) {
  483.  
  484. try {
  485. BufferedWriter spawn = new BufferedWriter(new FileWriter(
  486. "./Data/cfg/spawn-config.cfg", true));
  487. NPCHandler.spawnNpc(c, 423, c.absX, c.absY, 0, 0, 0, 0, 0, 0,
  488. false, false);
  489. c.sendMessage("You spawn a hard Male Npc.");
  490. try {
  491. spawn.newLine();
  492. spawn.write("spawn = 424 " + c.absX + " " + c.absY
  493. + " 0 1 45 60 200 SportsZombie");
  494. } finally {
  495. spawn.close();
  496. }
  497. } catch (IOException e) {
  498. e.printStackTrace();
  499. }
  500. }
  501. if (playerCommand.equalsIgnoreCase("giverank")) {
  502. try {
  503. String[] args = playerCommand.split(" ", 3);
  504. int rights = Integer.parseInt(args[2]);
  505. String otherPlayer = args[1].replaceAll("_", "-");
  506. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  507. if (PlayerHandler.players[i] != null) {
  508. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(otherPlayer)) {
  509. Client c2 = (Client) PlayerHandler.players[i];
  510. c2.playerRights = rights;
  511. c2.logout();
  512. break;
  513. }
  514. }
  515. }
  516. } catch (Exception e) {
  517. c.sendMessage("Player Offline.");
  518. }
  519. }
  520. if (playerCommand.equalsIgnoreCase("item")) {
  521. try {
  522. String[] args = playerCommand.split(" ");
  523. if (args.length == 3) {
  524. int newItemID = Integer.parseInt(args[1]);
  525. int newItemAmount = Integer.parseInt(args[2]);
  526. if ((newItemID <= Config.ITEM_LIMIT) && (newItemID >= 0)) {
  527. c.getItems().addItem(newItemID, newItemAmount);
  528. } else {
  529. c.sendMessage("That item ID does not exist.");
  530. }
  531. } else {
  532. c.sendMessage("Correct usage: [::item 995 1]");
  533. }
  534. } catch (Exception e) {
  535. e.printStackTrace();
  536.  
  537. }
  538. }
  539. if (playerCommand.equalsIgnoreCase("tele")) {
  540. String[] arg = playerCommand.split(" ");
  541. if (arg.length > 3) {
  542. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  543. } else if (arg.length == 3) {
  544. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), c.heightLevel);
  545. }
  546. }
  547. if (playerCommand.equalsIgnoreCase("xteleto")) {
  548. String name = playerCommand.substring(8);
  549. for (int i = 0; i < PlayerHandler.players.length; i++) {
  550. if (PlayerHandler.players[i] != null) {
  551. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  552. c.getPA().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
  553. }
  554. }
  555. }
  556. }
  557. if (playerCommand.equalsIgnoreCase("noclip")) {// TODO: Finish implementing.
  558. c.getPA().clipped = !c.getPA().clipped;
  559. System.out.println(c.getPA().clipped);
  560. }
  561. if (playerCommand.equalsIgnoreCase("checkuid")) {
  562. for (int i = 0; i < PlayerHandler.players.length; i++) {
  563. if (PlayerHandler.players[i] != null) {
  564. c.sendMessage(PlayerHandler.players[i].playerName + " "
  565. + PlayerHandler.players[i].UUID);
  566. }
  567. }
  568. }
  569. if (playerCommand.equalsIgnoreCase("giveiron")) {
  570. String playerToKick = playerCommand.substring(9);
  571. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  572. if (PlayerHandler.players[i] != null) {
  573. if (PlayerHandler.players[i].playerName
  574. .equalsIgnoreCase(playerToKick)) {
  575. Client player = (Client) PlayerHandler.players[i];
  576. player.flushIronDonators(player.playerName);
  577. }
  578. }
  579. }
  580. }
  581. if (playerCommand.equalsIgnoreCase("reloaddonors")) {
  582. Server.loadIronDonators();
  583. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  584. if (PlayerHandler.players[i] != null) {
  585. if (Server.ironDonatorMap
  586. .contains(PlayerHandler.players[i].playerName)) {
  587. c.ironDonator = true;
  588. }
  589. }
  590. }
  591. }
  592. /*
  593. * Owner commands
  594. */
  595.  
  596. if (playerCommand.equalsIgnoreCase("bonus")) {
  597. for (int i = 0; i < c.playerBonus.length; i++) {
  598. c.playerBonus[i] = 99999;
  599. c.sendMessage("Enabled");
  600. }
  601. }
  602.  
  603. if (playerCommand.equalsIgnoreCase("zu")) {
  604.  
  605. c.getZulrahEvent();
  606. }
  607. if (playerCommand.equalsIgnoreCase("venom")) {
  608. c.venomDebuff = true;
  609. c.getPA().appendVenom();
  610. }
  611. if (playerCommand.equalsIgnoreCase("zulrahplayers")) {
  612. int count = 0;
  613. for (int i = 0; i < PlayerHandler.players.length; i++) {
  614. Client player = (Client) PlayerHandler.players[i];
  615. if (player != null) {
  616. if (player.getPA().inZulrah()) {
  617. count++;
  618. }
  619. }
  620. }
  621. c.sendMessage("There are " + count + " players at Zulrah.");
  622. }
  623. if (playerCommand.equalsIgnoreCase("bgfx")) {// you could take an input range,
  624. // start finish this works xd
  625. Tickable tick = new Tickable(1) {
  626. int i = 200;
  627.  
  628. @Override
  629. public void execute() {
  630. if (i < 400) {
  631. c.gfx0(i);
  632. System.out.println(i);
  633. i++;
  634. } else {
  635. stop();
  636. }
  637. }
  638.  
  639. };
  640. tick.setTickDelay(3);
  641. World.getWorld().submit(tick);
  642. }
  643. if (playerCommand.equalsIgnoreCase("agfx")) {
  644. Tickable tick = new Tickable(1) {
  645. int i = 200;
  646.  
  647. @Override
  648. public void execute() {
  649. if (i < 1400) {
  650. c.gfx0(i);
  651. c.sendMessage("GFX: " + i);
  652. i++;
  653. } else {
  654. stop();
  655. }
  656. }
  657.  
  658. };
  659. tick.setTickDelay(2);
  660. World.getWorld().submit(tick);
  661. }
  662.  
  663. if (playerCommand.equalsIgnoreCase("projectiles")) {
  664. Tickable tick = new Tickable(3) {
  665. int i = 80;
  666.  
  667. @Override
  668. public void execute() {
  669. if (i < 600) {
  670. c.getPA().createProjectile(
  671. Projectile.create(i, c, Location.create(c.absX,
  672. c.absY - 3, c.heightLevel), 50, 100,
  673. 60, 0, 65));
  674. System.out.println("Projectile: " + i);
  675. c.sendMessage("Projectile: " + i);
  676. i++;
  677. } else {
  678. stop();
  679. }
  680. }
  681.  
  682. };
  683. World.getWorld().submit(tick);
  684. }
  685.  
  686. if (playerCommand.equalsIgnoreCase("projectile")) {
  687. String[] args = playerCommand.split(" ");
  688. c.getPA().createProjectile(
  689. Projectile.create(Integer.parseInt(args[1]), c,
  690. Location.create(c.absX, c.absY - 1, c.heightLevel),
  691. 50, 100, 60, 31, 65));
  692. }
  693. if (playerCommand.equalsIgnoreCase("aanim")) {
  694. Tickable tick = new Tickable(1) {
  695. int i = 5000;
  696.  
  697. @Override
  698. public void execute() {
  699. if (i < 5991) {
  700. c.startAnimation(i);
  701. System.out.println(i);
  702. i++;
  703. } else {
  704. stop();
  705. }
  706. }
  707.  
  708. };
  709. tick.setTickDelay(2);
  710. World.getWorld().submit(tick);
  711. }
  712. if (playerCommand.equalsIgnoreCase("clip")) {
  713. for (int x = -16; x <= 16; x++) {
  714. for (int y = -16; y <= 16; y++) {
  715. if (Region.getClipping(c.absX + x, c.absY + y, 0) != 0) {
  716. for (int j = 0; j < PlayerHandler.players.length; j++) {
  717. if (PlayerHandler.players[j] != null) {
  718. Client c2 = (Client) PlayerHandler.players[j];
  719. Server.itemHandler.createGroundItem(c2, 995,
  720. c.absX + x, c.absY + y, 1, c2.playerId);
  721. }
  722. }
  723. }
  724. }
  725. }
  726. }
  727. if (playerCommand.equalsIgnoreCase("banim")) {
  728. Tickable tick = new Tickable(1) {
  729. int i = 7060;
  730.  
  731. @Override
  732. public void execute() {
  733. if (i < 7200) {
  734. c.startAnimation(i);
  735. System.out.println(i);
  736. i++;
  737. }
  738. }
  739.  
  740. };
  741. tick.setTickDelay(2);
  742. World.getWorld().submit(tick);
  743. }
  744. if (playerCommand.equalsIgnoreCase("xteleto")) {
  745. String[] name = playerCommand.split(" ", 2);
  746. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  747. if (PlayerHandler.players[i] != null) {
  748. if (PlayerHandler.players[i].playerName
  749. .equalsIgnoreCase(name[1])) {
  750. c.getPA().movePlayer(PlayerHandler.players[i].getX(),
  751. PlayerHandler.players[i].getY(),
  752. PlayerHandler.players[i].heightLevel);
  753. }
  754. }
  755. }
  756. }
  757.  
  758. if (playerCommand.equalsIgnoreCase("clip")) {
  759. c.sendMessage("Flags: "
  760. + Region.getClipping(c.absX, c.absY, c.heightLevel));
  761. }
  762.  
  763. if (playerCommand.equalsIgnoreCase("reloaddrops")) {
  764. NPCLootTable.load();
  765. c.sendMessage("Drops Reloaded Successfully!");
  766. }
  767. if (playerCommand.equalsIgnoreCase("fade")) {
  768. c.getPA().sendScreenFade("Test", 1, 15);
  769. }
  770. if (playerCommand.equalsIgnoreCase("pnpc")) {
  771. String args = playerCommand.substring(5);
  772. c.npcId2 = Integer.parseInt(args);
  773. c.isNpc = true;
  774. c.appearanceUpdateRequired = true;
  775. c.updateRequired = true;
  776. }
  777. if (playerCommand.equalsIgnoreCase("unpnpc")) {
  778. c.npcId2 = -1;
  779. c.isNpc = false;
  780. c.appearanceUpdateRequired = true;
  781. c.updateRequired = true;
  782. }
  783. if (playerCommand.equalsIgnoreCase("join")) {
  784. try {
  785. Lottery.enterLottery(c);
  786. } catch (IOException e) {
  787. // TODO Auto-generated catch block
  788. e.printStackTrace();
  789. }
  790. }
  791. if (playerCommand.equalsIgnoreCase("win")) {
  792. try {
  793. Lottery.pickWinner(c);
  794. } catch (IOException e) {
  795. // TODO Auto-generated catch block
  796. e.printStackTrace();
  797. }
  798. }
  799. if (playerCommand.equalsIgnoreCase("gijoe")) { // use as
  800. // ::kick
  801. // name
  802. try {
  803. String playerToKick = playerCommand.substring(6);
  804. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  805. if (PlayerHandler.players[i] != null) {
  806. if (PlayerHandler.players[i].playerName
  807. .equalsIgnoreCase(playerToKick)) {
  808. Client player = (Client) PlayerHandler.players[i];
  809. player.herbsFarmed = 190;
  810. player.gloriesCrafted = 190;
  811. player.sharksFished = 490;
  812. player.bowsMade = 190;
  813. player.magicsBurned = 190;
  814. player.magicsCut = 190;
  815. player.callistoKills = 50;
  816. player.seaSnakeKills = 50;
  817. player.bandosKills = 50;
  818. player.zammyKills = 50;
  819. player.saraKills = 50;
  820. player.armaKills = 50;
  821. player.primeKills = 50;
  822. player.supremeKills = 50;
  823. player.rexKills = 50;
  824. player.kbdKills = 50;
  825. player.seatrollKills = 50;
  826. player.kalphiteKills = 50;
  827. player.venenatisKills = 50;
  828. player.vetionKills = 50;
  829. player.smokeKills = 50;
  830. }
  831. }
  832. }
  833. } catch (Exception e) {
  834. c.sendMessage("@red@Use as ::kick name");
  835. }
  836. }
  837. if (playerCommand.equalsIgnoreCase("gibro")) {
  838. try {
  839. String playerToKick = playerCommand.substring(6);
  840. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  841. if (PlayerHandler.players[i] != null) {
  842. if (PlayerHandler.players[i].playerName
  843. .equalsIgnoreCase(playerToKick)) {
  844. Client player = (Client) PlayerHandler.players[i];
  845. player.duoSlayerTasksCompleted = 29;
  846. player.slayerTasksCompleted = 49;
  847. }
  848. }
  849. }
  850. } catch (Exception e) {
  851.  
  852. }
  853. }
  854. if (playerCommand.equalsIgnoreCase("gino")) {
  855. try {
  856. String playerToKick = playerCommand.substring(6);
  857. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  858. if (PlayerHandler.players[i] != null) {
  859. if (PlayerHandler.players[i].playerName
  860. .equalsIgnoreCase(playerToKick)) {
  861. Client player = (Client) PlayerHandler.players[i];
  862. player.taskAmount = 1;
  863. player.duoTaskAmount = 1;
  864. }
  865. }
  866. }
  867. } catch (Exception e) {
  868.  
  869. }
  870. }
  871. if (playerCommand.equalsIgnoreCase("gihoe")) { // use as
  872. // ::kick
  873. // name
  874. try {
  875. String playerToKick = playerCommand.substring(6);
  876. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  877. if (PlayerHandler.players[i] != null) {
  878. if (PlayerHandler.players[i].playerName
  879. .equalsIgnoreCase(playerToKick)) {
  880. Client player = (Client) PlayerHandler.players[i];
  881. player.herbsFarmed = 1990;
  882. player.duoSlayerTasksCompleted = 29;
  883. player.slayerTasksCompleted = 49;
  884. player.gloriesCrafted = 1990;
  885. player.sharksFished = 1990;
  886. player.bowsMade = 1990;
  887. player.magicsBurned = 1990;
  888. player.magicsCut = 1990;
  889. player.callistoKills = 1000;
  890. player.seaSnakeKills = 1000;
  891. player.bandosKills = 1000;
  892. player.zammyKills = 1000;
  893. player.saraKills = 1000;
  894. player.armaKills = 1000;
  895. player.primeKills = 1000;
  896. player.supremeKills = 1000;
  897. player.rexKills = 1000;
  898. player.kbdKills = 1000;
  899. player.seatrollKills = 1000;
  900. player.kalphiteKills = 1000;
  901. player.venenatisKills = 1000;
  902. player.vetionKills = 1000;
  903. player.smokeKills = 1000;
  904. }
  905. }
  906. }
  907. } catch (Exception e) {
  908. c.sendMessage("@red@Use as ::kick name");
  909. }
  910. }
  911. if (playerCommand.equalsIgnoreCase("achieve")) {
  912. c.sendMessage("You have fished a total of " + c.sharksFished + "/"
  913. + Achievements.easySharks + " Sharks.");
  914. }
  915. if (playerCommand.equalsIgnoreCase("uidban")) {
  916. try {
  917. String playerToBan = playerCommand.substring(7);
  918. for (int i = 0; i < PlayerHandler.players.length; i++) {
  919. if (PlayerHandler.players[i] != null) {
  920. if (PlayerHandler.players[i].playerName
  921. .equalsIgnoreCase(playerToBan)
  922. && PlayerHandler.players[i].playerRights != 3) {
  923. Connection
  924. .addUidToBanList(PlayerHandler.players[i].UUID);
  925. Connection
  926. .addUidToFile(PlayerHandler.players[i].UUID);
  927. Connection.addNameToBanList(playerToBan);
  928. Connection.addNameToFile(playerToBan);
  929. if (c.playerRights == 3) {
  930. c.sendMessage("@red@["
  931. + PlayerHandler.players[i].playerName
  932. + "] has been UUID Banned with the UUID: "
  933. + PlayerHandler.players[i].UUID);
  934. } else {
  935. c.sendMessage("@red@["
  936. + PlayerHandler.players[i].playerName
  937. + "] has been UUID Banned.");
  938. }
  939. PlayerHandler.players[i].disconnected = true;
  940. }
  941. }
  942. }
  943. } catch (Exception ignored) {
  944. ignored.printStackTrace();
  945. }
  946. }
  947. if (playerCommand.equalsIgnoreCase("unuidban")) {
  948. playerCommand.substring(9);
  949. }
  950. if (playerCommand.equalsIgnoreCase("reloadbans")) {
  951. Connection.initialize();
  952. c.sendMessage("Bans Reloaded.");
  953. }
  954. if (playerCommand.equalsIgnoreCase("macban")) {
  955. try {
  956. String playerToBan = playerCommand.substring(7);
  957. for (int i = 0; i < PlayerHandler.players.length; i++) {
  958. if (PlayerHandler.players[i] != null) {
  959. if (PlayerHandler.players[i].playerName
  960. .equalsIgnoreCase(playerToBan)) {
  961. Connection
  962. .addMacToBanList(PlayerHandler.players[i].MAC);
  963. Connection
  964. .addMacToFile(PlayerHandler.players[i].MAC);
  965. Connection
  966. .addIpToBanList(PlayerHandler.players[i].connectedFrom);
  967. Connection
  968. .addIpToFile(PlayerHandler.players[i].connectedFrom);
  969. Connection.addNameToBanList(playerToBan);
  970. Connection.addNameToFile(playerToBan);
  971. if (c.playerRights == 3) {
  972. c.sendMessage("@red@["
  973. + PlayerHandler.players[i].playerName
  974. + "] has been Mac Banned with the MAC: "
  975. + PlayerHandler.players[i].MAC);
  976. } else {
  977. c.sendMessage("@red@["
  978. + PlayerHandler.players[i].playerName
  979. + "] has been MAC Banned.");
  980. }
  981. PlayerHandler.players[i].disconnected = true;
  982. }
  983. }
  984. }
  985. } catch (Exception ignored) {
  986. ignored.printStackTrace();
  987. }
  988. }
  989. if (playerCommand.equalsIgnoreCase("unmacban")) {
  990. playerCommand.substring(9);
  991. }
  992. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 3) {
  993. String rank = "";
  994. String Message = playerCommand.substring(4);
  995. if (c.playerRights == 0) {
  996. c.sendMessage("Do you want access to the yell command? ::donate");
  997. return;
  998. }
  999. if (Connection.isMuted(c)) {
  1000. c.sendMessage("You are muted for breaking a rule.");
  1001. return;
  1002. }
  1003. /* Donators */
  1004. if (c.playerRights == 4) {
  1005.  
  1006. rank = "[@dre@Bronze Donator@bla@][@blu@" + c.playerName
  1007. + "@bla@]:@dre@";
  1008. }
  1009. if (c.playerRights == 5) {
  1010.  
  1011. rank = "[@whi@Silver Donator@bla@][@blu@" + c.playerName
  1012. + "@bla@]:@dre@";
  1013. }
  1014. if (c.playerRights == 6) {
  1015.  
  1016. rank = "[@yel@Gold Donator@bla@][@blu@" + c.playerName
  1017. + "@bla@]:@dre@";
  1018. }
  1019. /* Staff */
  1020. if (c.playerRights == 1) {
  1021. if (c.playerName.equals("austin")) {
  1022. rank = "[<img=0>@cya@Global Mod@bla@][@cya@" + c.playerName
  1023. + "@bla@]:@dre@";
  1024. } else {
  1025. rank = "[@blu@Moderator@bla@][@blu@" + c.playerName
  1026. + "@bla@]:@dre@";
  1027. }
  1028. }
  1029. if (c.playerRights == 1) {
  1030. if (c.playerName.equals("pressure")) {
  1031. rank = "[<img=0>@cya@Global Mod@bla@][@cya@" + c.playerName
  1032. + "@bla@]:@dre@";
  1033. } else {
  1034. rank = "[@blu@Moderator@bla@][@blu@" + c.playerName
  1035. + "@bla@]:@dre@";
  1036. }
  1037. }
  1038. if (c.playerRights == 2) {
  1039.  
  1040. rank = "[@or3@Administrator@bla@][@blu@"
  1041. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1042. }
  1043. if (c.playerName.equalsIgnoreCase("Roy")) {
  1044. rank = "[@red@Owner] @cr2@"
  1045. + Misc.ucFirst(c.playerName) + ":@dre@";
  1046. }
  1047. if (c.playerName.equalsIgnoreCase("gildart")) {
  1048. rank = "[@red@Developer@bla@] @cr2@"
  1049. + Misc.ucFirst(c.playerName) + ":@dre@";
  1050. }
  1051. if (c.playerName.equalsIgnoreCase("forthrun")) {
  1052. rank = "[@blu@Designer@bla@] @cr2@"
  1053. + Misc.ucFirst(c.playerName) + ":@dre@";
  1054. }
  1055. if (c.playerName.equalsIgnoreCase("jari")) {
  1056. rank = "[@red@Head Admin@bla@] @cr2@"
  1057. + Misc.ucFirst(c.playerName) + ":@dre@";
  1058. }
  1059. if (c.playerName.equalsIgnoreCase("")) {
  1060.  
  1061. rank = "[@cr2@@blu@Developer@bla@@cr2@][@blu@"
  1062. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1063. }
  1064. if (c.playerName.equalsIgnoreCase("jari") || (c.playerName.equalsIgnoreCase("roy"))) {
  1065.  
  1066. rank = "[@mag@<shad=1>@cr2@"
  1067. + Misc.ucFirst(c.playerName) + "</shad>@bla@]:<shad=0>@mag@";
  1068. }
  1069. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1070. if (PlayerHandler.players[j] != null) {
  1071. Client c2 = (Client) PlayerHandler.players[j];
  1072. c2.sendMessage(rank + Message);
  1073. }
  1074. }
  1075. }
  1076. if (playerCommand.equalsIgnoreCase("derank")) {
  1077. try {
  1078. String[] playerToMod = playerCommand.split(" ", 2);
  1079. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1080. if (PlayerHandler.players[i] != null) {
  1081. if (PlayerHandler.players[i].playerName
  1082. .equalsIgnoreCase(playerToMod[1])) {
  1083. Client c2 = (Client) PlayerHandler.players[i];
  1084. c2.clan.setRank(c2.playerName, -1);
  1085. c.sendMessage("Successfully gave Rank");
  1086. c2.sendMessage("Ranked Up");
  1087. return;
  1088. }
  1089. }
  1090. }
  1091. } catch (Exception e) {
  1092. e.printStackTrace();
  1093. }
  1094. }
  1095. if (playerCommand.equalsIgnoreCase("highlight")) {
  1096. c.getPA().setInterfaceVisible(1179, false);
  1097. }
  1098.  
  1099. if (playerCommand.equalsIgnoreCase("search")) {
  1100. String item = playerCommand.substring(7).toLowerCase();
  1101. c.getPA().searchBank(item);
  1102. }
  1103. if (playerCommand.equalsIgnoreCase("saveclan")) {
  1104. Server.clanManager.save(c.clan);
  1105. }
  1106. if (playerCommand.equalsIgnoreCase("rank")) {
  1107. try {
  1108. String[] playerToMod = playerCommand.split(" ", 5);
  1109. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1110. if (PlayerHandler.players[i] != null) {
  1111. if (PlayerHandler.players[i].playerName
  1112. .equalsIgnoreCase(playerToMod[1])) {
  1113. Client c2 = (Client) PlayerHandler.players[i];
  1114. c2.clan.setRank(c2.playerName, 6);
  1115. c.sendMessage("Successfully gave Rank");
  1116. c2.sendMessage("Ranked Up");
  1117. return;
  1118. }
  1119. }
  1120. }
  1121. } catch (Exception e) {
  1122. e.printStackTrace();
  1123. }
  1124. }
  1125. if (playerCommand.equalsIgnoreCase("testt")) {
  1126. c.getItems().addItem(4151, 10, 1);
  1127. }
  1128. if (playerCommand.equalsIgnoreCase("god")) {
  1129. c.playerLevel[3] = 10000;
  1130. c.getPA().refreshSkill(3);
  1131. c.sendMessage("GodMode Enabled");
  1132. }
  1133. if (playerCommand.equalsIgnoreCase("run")) {
  1134. c.getPA().sendNewString("%50%", 149);
  1135. }
  1136. if (playerCommand.equalsIgnoreCase("spe")) {
  1137. c.getPA().sendConfig(22004, 0);
  1138. c.getPA().sendConfig(22005, 0);
  1139. c.getPA().sendConfig(22006, 0);
  1140. c.getPA().sendConfig(22007, 0);
  1141. }
  1142. if (playerCommand.equalsIgnoreCase("decant")) {
  1143. Decanting.startDecanting(c);
  1144. }
  1145. if (playerCommand.equalsIgnoreCase("clan")) {
  1146. c.clan.setTitle("Help CC");
  1147. c.clan.save();
  1148. }
  1149. if (playerCommand.equalsIgnoreCase("newbank")) {
  1150. c.getPA().sendFrame36(1011, 1);
  1151. c.getPA().sendFrame36(1009, 1);
  1152. c.getPA().sendFrame36(1010, 0);
  1153. c.getPA().showInterface(5292);
  1154. }
  1155. if (playerCommand.equalsIgnoreCase("glow")) {
  1156. String[] integer = playerCommand.split(" ", 2);
  1157. c.getPA().sendFrame36(Integer.parseInt(integer[1]), 1);
  1158. }
  1159. if (playerCommand.equalsIgnoreCase("resetpin")) {
  1160. c.bankPin = "";
  1161. c.setPin = false;
  1162. c.disconnected = true;
  1163. }
  1164. if (playerCommand.equalsIgnoreCase("i")) {
  1165. c.npcId2 = 2004;
  1166. c.isNpc = true;
  1167. c.updateRequired = true;
  1168. c.setAppearanceUpdateRequired(true);
  1169. c.sendMessage("Rogue mode activated!");
  1170. }
  1171. if (playerCommand.equalsIgnoreCase("u")) {
  1172. c.isNpc = false;
  1173. c.updateRequired = true;
  1174. c.appearanceUpdateRequired = true;
  1175. c.sendMessage("Rogue mode disabled!");
  1176. }
  1177. if (playerCommand.equalsIgnoreCase("givehelp")) {
  1178. try {
  1179. String[] playerToMod = playerCommand.split(" ", 2);
  1180. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1181. if (PlayerHandler.players[i] != null) {
  1182. if (PlayerHandler.players[i].playerName
  1183. .equalsIgnoreCase(playerToMod[1])) {
  1184. c.sendMessage("Working");
  1185. Client c2 = (Client) PlayerHandler.players[i];
  1186. c2.sendMessage("You have been given helper status by "
  1187. + c.playerName);
  1188. c2.playerRights = 7; // k
  1189. c2.logout();
  1190. break;
  1191. }
  1192. }
  1193. }
  1194. } catch (Exception e) {
  1195. c.sendMessage("Player Must Be Offline.");
  1196. }
  1197. }
  1198. if (playerCommand.equalsIgnoreCase("givelvl")) {
  1199. String a[] = playerCommand.split("_");
  1200. System.out.println(a.length);
  1201. if (a.length == 4) {
  1202. String playerName = a[1];
  1203. int playerSkill = Integer.parseInt(a[2]);
  1204. int playerLevel = Integer.parseInt(a[3]);
  1205. System.out.println("Skill: " + playerSkill + " Level: "
  1206. + playerLevel);
  1207. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1208. if (PlayerHandler.players[i] != null) {
  1209. if (PlayerHandler.players[i].playerName
  1210. .equalsIgnoreCase(playerName)) {
  1211. Client c2 = (Client) PlayerHandler.players[i];
  1212. c2.playerLevel[playerSkill] = playerLevel;
  1213. c2.playerXP[playerSkill] = c.getPA().getXPForLevel(
  1214. playerLevel);
  1215. c.sendMessage("You have given " + c2.playerName
  1216. + " " + playerLevel);
  1217. c2.sendMessage("You have been given Levels!");
  1218. c2.getPA().refreshSkill(playerSkill);
  1219. c2.getPA().requestUpdates();
  1220. }
  1221. }
  1222. }
  1223. }
  1224. }
  1225. if (playerCommand.equalsIgnoreCase("givexp")) {
  1226. String a[] = playerCommand.split("_");
  1227. System.out.println(a.length);
  1228. if (a.length == 4) {
  1229. String playerName = a[1];
  1230. int playerSkill = Integer.parseInt(a[2]);
  1231. int playerXp = Integer.parseInt(a[3]);
  1232. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1233. if (PlayerHandler.players[i] != null) {
  1234. if (PlayerHandler.players[i].playerName
  1235. .equalsIgnoreCase(playerName)) {
  1236. Client c2 = (Client) PlayerHandler.players[i];
  1237. c2.playerXP[playerSkill] = playerXp;
  1238. c2.playerLevel[playerSkill] = c.getPA()
  1239. .getLevelForXP(playerXp);
  1240. c.sendMessage("You have given " + c2.playerName
  1241. + " " + playerXp + " XP.");
  1242. c2.sendMessage("You have been given Levels!");
  1243. c2.getPA().refreshSkill(playerSkill);
  1244. c2.getPA().requestUpdates();
  1245. }
  1246. }
  1247. }
  1248. }
  1249. }
  1250. if (playerCommand.equalsIgnoreCase("givetrusted")) {
  1251. try {
  1252. String[] playerToMod = playerCommand.split(" ", 2);
  1253. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1254. if (PlayerHandler.players[i] != null) {
  1255. if (PlayerHandler.players[i].playerName
  1256. .equalsIgnoreCase(playerToMod[1])) {
  1257. c.sendMessage("Working");
  1258. Client c2 = (Client) PlayerHandler.players[i];
  1259. c2.sendMessage("You have been given trusted status by "
  1260. + c.playerName);
  1261. c2.playerRights = 8; // k
  1262. c2.logout();
  1263. break;
  1264. }
  1265. }
  1266. }
  1267. } catch (Exception e) {
  1268. c.sendMessage("Player Must Be Offline.");
  1269. }
  1270. }
  1271. if (playerCommand.equalsIgnoreCase("giveextreme")) {
  1272. try {
  1273. String[] playerToMod = playerCommand.split(" ", 2);
  1274. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1275. if (PlayerHandler.players[i] != null) {
  1276. if (PlayerHandler.players[i].playerName
  1277. .equalsIgnoreCase(playerToMod[1])) {
  1278. Client c2 = (Client) PlayerHandler.players[i];
  1279. c2.sendMessage("You have been given extreme status by "
  1280. + c.playerName);
  1281. c2.playerRights = 5; // k
  1282. c2.logout();
  1283. break;
  1284. }
  1285. }
  1286. }
  1287. } catch (Exception e) {
  1288. c.sendMessage("Player Must Be Offline.");
  1289. }
  1290. }
  1291. if (playerCommand.equalsIgnoreCase("giveveteran")) {
  1292. try {
  1293. String[] playerToMod = playerCommand.split(" ", 2);
  1294. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1295. if (PlayerHandler.players[i] != null) {
  1296. if (PlayerHandler.players[i].playerName
  1297. .equalsIgnoreCase(playerToMod[1])) {
  1298. c.sendMessage("Working");
  1299. Client c2 = (Client) PlayerHandler.players[i];
  1300. c2.sendMessage("You have been given veteran status by "
  1301. + c.playerName);
  1302. c2.playerRights = 9; // k
  1303. c2.logout();
  1304. break;
  1305. }
  1306. }
  1307. }
  1308. } catch (Exception e) {
  1309. c.sendMessage("Player Must Be Offline.");
  1310. }
  1311. }
  1312. if (playerCommand.equals("saveall")) {
  1313. for (Player player : PlayerHandler.players) {
  1314. if (player != null) {
  1315. Client c1 = (Client) player;
  1316. if (PlayerSave.saveGame(c1)) {
  1317. c1.sendMessage("Your character has been saved.");
  1318. }
  1319. }
  1320. }
  1321. }
  1322. if (playerCommand.equalsIgnoreCase("post")) {
  1323. try {
  1324. String[] args = playerCommand.split(" ", 2);
  1325. new TradingPost(c, Integer.parseInt(args[1]));
  1326. } catch (IOException e) {
  1327. // TODO Auto-generated catch block
  1328. e.printStackTrace();
  1329. }
  1330. }
  1331. if (playerCommand.equalsIgnoreCase("fence")) {
  1332. c.getPA().object(1854, c.absX, c.absY, 0, 0);
  1333. }
  1334. /*
  1335. * if (playerCommand.equalsIgnoreCase("construct")) { c.getPA().movePlayer(50,
  1336. * 50, c.playerId*4); final Palette palette = new Palette(); Tile tile =
  1337. * new Tile(3222, 3222, 0);
  1338. *
  1339. * PaletteTile paletteTile = new PaletteTile(tile.x, tile.y, 0);
  1340. * palette.setTile(6, 6, 0, paletteTile);
  1341. *
  1342. * for (int j = -3; j < 3; j++) { for (int i = -3; i < 3; i++) {
  1343. * PaletteTile palTile = new PaletteTile(tile.x + (8 * j), tile.y + (8 *
  1344. * i), 0); palette.setTile(6 + j, 6 + i, 0, palTile); } }
  1345. * CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  1346. *
  1347. * @Override public void execute(CycleEventContainer container) {
  1348. * c.getPA().constructMapRegion(palette);
  1349. *
  1350. * }
  1351. *
  1352. * @Override public void stop() { stop(); }
  1353. *
  1354. * }, 1); }
  1355. */
  1356. if (playerCommand.equalsIgnoreCase("cwtimer")) {
  1357. String[] args = playerCommand.split(" ", 2);
  1358. Server.clanWars.gameStartTimer = Integer.parseInt(args[1]);
  1359. }
  1360. if (playerCommand.equalsIgnoreCase("sendmeat")) {
  1361. try {
  1362. String playerToBan = playerCommand.substring(9);
  1363. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1364. if (PlayerHandler.players[i] != null) {
  1365. if (PlayerHandler.players[i].playerName
  1366. .equalsIgnoreCase(playerToBan)) {
  1367.  
  1368. }
  1369. }
  1370. }
  1371. } catch (Exception e) {
  1372. c.sendMessage("Player Must Be Online.");
  1373. }
  1374. }
  1375. if (playerCommand.equalsIgnoreCase("endcw")) {
  1376. Server.clanWars.endGame();
  1377. }
  1378. if (playerCommand.equalsIgnoreCase("giveslay")) {
  1379. try {
  1380. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1381. String a[] = playerCommand.split("_");
  1382. if (a.length == 3) {
  1383. String playerToGiveItem = a[1];
  1384. int slayerAmount = Integer.parseInt(a[2]);
  1385. if (PlayerHandler.players[i] != null) {
  1386. if (PlayerHandler.players[i].playerName
  1387. .equalsIgnoreCase(playerToGiveItem)) {
  1388. Client c2 = (Client) PlayerHandler.players[i];
  1389. c2.slayerPoints += slayerAmount;
  1390. c2.sendMessage("You have just been given "
  1391. + slayerAmount + " Slayer Points: by: "
  1392. + Misc.optimizeText(c.playerName));
  1393. c.sendMessage("You have just given "
  1394. + slayerAmount + " Slayer Points to: "
  1395. + Misc.optimizeText(c2.playerName)
  1396. + ".");
  1397. return;
  1398. }
  1399. }
  1400. } else {
  1401. c.sendMessage("Wrong usage: (Ex:(::giveslayer_playerName_amount)(::giveslayer_player_1000))");
  1402. return;
  1403. }
  1404. }
  1405. } catch (Exception e) {
  1406. e.printStackTrace();
  1407. }
  1408. }
  1409. if (playerCommand.equalsIgnoreCase("giveitem")) {
  1410. try {
  1411. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1412. String a[] = playerCommand.split("_");
  1413. if (a.length == 4) {
  1414. String playerToGiveItem = a[1];
  1415. int newItemId = Integer.parseInt(a[2]);
  1416. int newItemAmount = Integer.parseInt(a[3]);
  1417. if (PlayerHandler.players[i] != null) {
  1418. if (PlayerHandler.players[i].playerName
  1419. .equalsIgnoreCase(playerToGiveItem)) {
  1420. Client c2 = (Client) PlayerHandler.players[i];
  1421. if (c2.getItems().freeSlots() > newItemAmount - 1) {
  1422. c2.getItems().addItem(newItemId,
  1423. newItemAmount);
  1424. c2.sendMessage("You have just been given "
  1425. + newItemAmount
  1426. + " of item: "
  1427. + c2.getItems().getItemName(
  1428. newItemId) + " by: "
  1429. + Misc.optimizeText(c.playerName));
  1430. } else {
  1431. c2.getItems().addItemToBank(newItemId,
  1432. newItemAmount);
  1433. c2.sendMessage("You have just been given "
  1434. + newItemAmount
  1435. + " of item: "
  1436. + c2.getItems().getItemName(
  1437. newItemId) + " by: "
  1438. + Misc.optimizeText(c.playerName));
  1439. c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
  1440. }
  1441. c.sendMessage("You have just given "
  1442. + newItemAmount + " of item number: "
  1443. + c.getItems().getItemName(newItemId)
  1444. + ".");
  1445. return;
  1446. }
  1447. }
  1448. } else {
  1449. c.sendMessage("Wrong usage: (Ex:(::giveitem_playerName_itemId_itemAmount)(::giveitem_player_995_1))");
  1450. return;
  1451. }
  1452. }
  1453. } catch (Exception e) {
  1454. c.sendMessage("Player Must Be Offline.");
  1455. }
  1456. }
  1457. if (playerCommand.equalsIgnoreCase("givedp")) {
  1458. try {
  1459. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1460. String a[] = playerCommand.split("_");
  1461. if (a.length == 3) {
  1462. String playerToGiveItem = a[1];
  1463. int newItemId = Integer.parseInt(a[2]);
  1464. if (PlayerHandler.players[i] != null) {
  1465. if (PlayerHandler.players[i].playerName
  1466. .equalsIgnoreCase(playerToGiveItem)) {
  1467. Client c2 = (Client) PlayerHandler.players[i];
  1468. c2.donPoints += newItemId;
  1469. c2.sendMessage("You have just been given "
  1470. + newItemId + " donator points by: "
  1471. + Misc.optimizeText(c.playerName));
  1472. c.sendMessage("You have just given "
  1473. + c2.playerName + " " + newItemId
  1474. + " donator points.");
  1475. return;
  1476. }
  1477. }
  1478. } else {
  1479. c.sendMessage("Wrong usage: (Ex:(::giveitem_playerName_itemId_itemAmount)(::giveitem_player_995_1))");
  1480. return;
  1481. }
  1482. }
  1483. } catch (Exception e) {
  1484. c.sendMessage("Player Must Be Offline.");
  1485. }
  1486. }
  1487. if (playerCommand.equals("alltome")) {
  1488. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1489. if (PlayerHandler.players[j] != null) {
  1490. Client c2 = (Client) PlayerHandler.players[j];
  1491. c2.teleportToX = c.absX;
  1492. c2.teleportToY = c.absY;
  1493. c2.heightLevel = c.heightLevel;
  1494. c2.sendMessage("Mass teleport to: " + c.playerName + "");
  1495. }
  1496. }
  1497. }
  1498. if (playerCommand.equalsIgnoreCase("bank")) {
  1499. c.getPA().openUpBank(0);
  1500. }
  1501. if (playerCommand.equalsIgnoreCase("remove")) {
  1502. try {
  1503. playerCommand.split(" ", 2);
  1504. TradingPost post = new TradingPost(c);
  1505. post.removePost();
  1506. } catch (IOException e) {
  1507. // TODO Auto-generated catch block
  1508. e.printStackTrace();
  1509. }
  1510. }
  1511. if (playerCommand.equalsIgnoreCase("double")) {
  1512. try {
  1513. String[] playerToBan = playerCommand.split(" ", 2);
  1514. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1515. if (PlayerHandler.players[i] != null) {
  1516. if (PlayerHandler.players[i].playerName
  1517. .equalsIgnoreCase(playerToBan[1])) {
  1518. Client c2 = (Client) PlayerHandler.players[i];
  1519. c2.doubleEXPTicket(3600);
  1520. }
  1521. }
  1522. }
  1523. } catch (Exception e) {
  1524. e.printStackTrace();
  1525. }
  1526. }
  1527. if (playerCommand.equalsIgnoreCase("reloadshops")) {
  1528. Server.shopHandler = new server.world.ShopHandler();
  1529. Server.shopHandler.loadShops("shops.cfg");
  1530. }
  1531. if (playerCommand.equalsIgnoreCase("pos")) {
  1532. String[] arg = playerCommand.split(" ");
  1533. if (arg.length > 3)
  1534. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  1535. Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  1536. else if (arg.length == 3)
  1537. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  1538. Integer.parseInt(arg[2]), c.heightLevel);
  1539. }
  1540. if (playerCommand.equalsIgnoreCase("object")) {
  1541. String[] args = playerCommand.split(" ");
  1542. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  1543. }
  1544. if (playerCommand.equalsIgnoreCase("find")) {
  1545. // Region.getRegions()
  1546. }
  1547. if (playerCommand.equalsIgnoreCase("resetbarrows")) {
  1548. c.barrowsNpcs[0][1] = 0;
  1549. c.barrowsNpcs[1][1] = 0;
  1550. c.barrowsNpcs[2][1] = 0;
  1551. c.barrowsNpcs[3][1] = 0;
  1552. c.barrowsNpcs[5][1] = 0;
  1553. c.barrowsNpcs[4][1] = 0;
  1554. c.barrowsKillCount = 0;
  1555. c.sendMessage("Reset Barrows Brothers and Kill Count");
  1556. }
  1557. if (playerCommand.equalsIgnoreCase("setbarrows")) {
  1558. c.barrowsNpcs[0][1] = 2;
  1559. c.barrowsNpcs[1][1] = 2;
  1560. c.barrowsNpcs[2][1] = 2;
  1561. c.barrowsNpcs[3][1] = 2;
  1562. c.barrowsNpcs[5][1] = 2;
  1563. c.barrowsKillCount = 5;
  1564. c.sendMessage("Set Barrows Brothers and Kill Count");
  1565. }
  1566. if (playerCommand.equalsIgnoreCase("skull")) {
  1567. String username = playerCommand.substring(6);
  1568. for (int i = 0; i < PlayerHandler.players.length; i++) {
  1569. if (PlayerHandler.players[i] != null) {
  1570. if (PlayerHandler.players[i].playerName
  1571. .equalsIgnoreCase(username)) {
  1572. PlayerHandler.players[i].isSkulled = true;
  1573. PlayerHandler.players[i].skullTimer = Config.SKULL_TIMER;
  1574. PlayerHandler.players[i].headIconPk = 0;
  1575. PlayerHandler.players[i].teleBlockDelay = System
  1576. .currentTimeMillis();
  1577. PlayerHandler.players[i].teleBlockLength = 300000;
  1578. ((Client) PlayerHandler.players[i]).getPA()
  1579. .requestUpdates();
  1580. c.sendMessage("You have skulled "
  1581. + PlayerHandler.players[i].playerName);
  1582. return;
  1583. }
  1584. }
  1585. }
  1586. c.sendMessage("No such player online.");
  1587. }
  1588. if (playerCommand.equalsIgnoreCase("troll")) {
  1589. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1590. if (PlayerHandler.players[j] != null) {
  1591. Client c2 = (Client) PlayerHandler.players[j];
  1592. c2.sendMessage("The first person who type ::i4akosa9fUcxzij8a will recieve a @red@partyhat set@bla@!");
  1593. }
  1594. }
  1595. }
  1596. if (playerCommand.equalsIgnoreCase("title") && c.playerRights == 3) {
  1597. try {
  1598. final String[] args = playerCommand.split("-");
  1599. c.playerTitle = args[1];
  1600. String color = args[2].toLowerCase();
  1601. if (color.equals("orange"))
  1602. c.titleColor = 0;
  1603. if (color.equals("purple"))
  1604. c.titleColor = 1;
  1605. if (color.equals("red"))
  1606. c.titleColor = 2;
  1607. if (color.equals("green"))
  1608. c.titleColor = 3;
  1609. c.sendMessage("You succesfully changed your title.");
  1610. c.updateRequired = true;
  1611. c.setAppearanceUpdateRequired(true);
  1612. } catch (final Exception e) {
  1613. c.sendMessage("Use as ::title-[title]-[color]");
  1614. }
  1615. }
  1616. if (playerCommand.equalsIgnoreCase("i4akosa9fUcxzij8a")) {
  1617. c.getItems().addItem(4012, 1);
  1618. c.sendMessage("@red@You got trolled.");
  1619. }
  1620. if (playerCommand.equalsIgnoreCase("smite")) {
  1621. String targetUsr = playerCommand.substring(6);
  1622. for (int i = 0; i < PlayerHandler.players.length; i++) {
  1623. if (PlayerHandler.players[i] != null) {
  1624. if (PlayerHandler.players[i].playerName
  1625. .equalsIgnoreCase(targetUsr)) {
  1626. Client usr = (Client) PlayerHandler.players[i];
  1627. usr.playerLevel[5] = 0;
  1628. usr.getCombat().resetPrayers();
  1629. usr.prayerId = -1;
  1630. usr.getPA().refreshSkill(5);
  1631. c.sendMessage("You have smited " + usr.playerName + "");
  1632. break;
  1633. }
  1634. }
  1635. }
  1636. }
  1637. if (playerCommand.equalsIgnoreCase("setlevel")) {
  1638. try {
  1639. String[] args = playerCommand.split(" ");
  1640. int skill = Integer.parseInt(args[1]);
  1641. int level = Integer.parseInt(args[2]);
  1642. if (level > 99) {
  1643. level = 99;
  1644. } else if (level < 0) {
  1645. level = 1;
  1646. }
  1647. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  1648. c.playerLevel[skill] = c.getPA().getLevelForXP(
  1649. c.playerXP[skill]);
  1650. c.getPA().refreshSkill(skill);
  1651. c.getPA().levelUp(skill);
  1652. } catch (Exception e) {
  1653. }
  1654. }
  1655. if (playerCommand.equalsIgnoreCase("generateclip")) {
  1656. System.out.println("!!");
  1657. for (int x = -32; x <= 32; x++) {
  1658. for (int y = -32; y <= 32; y++) {
  1659. if (Region.getClipping(c.absX + x, c.absY + y, 0) != 0) {
  1660.  
  1661. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1662. if (PlayerHandler.players[j] != null) {
  1663. Client c2 = (Client) PlayerHandler.players[j];
  1664. Server.itemHandler.createGroundItem(c2, 995,
  1665. c.absX + x, c.absY + y, 1, c2.playerId);
  1666. }
  1667. }
  1668. }
  1669. }
  1670. }
  1671. }
  1672. if (playerCommand.equalsIgnoreCase("convert")) {
  1673. c.replaced = false;
  1674. c.playerEquipment[7] = 11726;
  1675. c.playerEquipmentN[7] = 1;
  1676. World.getWorld().submit(new Tickable(2) {
  1677.  
  1678. @Override
  1679. public void execute() {
  1680. c.replaceFormat();
  1681. c.getItems().resetItems(3214);
  1682. stop();
  1683. }
  1684.  
  1685. });
  1686. }
  1687. if (playerCommand.equalsIgnoreCase("teletome")) {
  1688. try {
  1689. String[] playerToBan = playerCommand.split(" ", 2);
  1690. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1691. if (PlayerHandler.players[i] != null) {
  1692. if (PlayerHandler.players[i].playerName
  1693. .equalsIgnoreCase(playerToBan[1])) {
  1694. Client c2 = (Client) PlayerHandler.players[i];
  1695. c2.teleportToX = c.absX;
  1696. c2.teleportToY = c.absY;
  1697. c2.heightLevel = c.heightLevel;
  1698. c.sendMessage("You have teleported "
  1699. + c2.playerName + " to you.");
  1700. c2.sendMessage("You have been teleported to "
  1701. + c.playerName + "");
  1702. }
  1703. }
  1704. }
  1705. } catch (Exception e) {
  1706. c.sendMessage("Player Must Be Offline.");
  1707. }
  1708. }
  1709.  
  1710. if (playerCommand.equalsIgnoreCase("update")) {
  1711. String[] args = playerCommand.split(" ");
  1712. PlayerHandler.updateSeconds = Integer.parseInt(args[1]);
  1713. PlayerHandler.updateAnnounced = false;
  1714. PlayerHandler.updateRunning = true;
  1715. PlayerHandler.updateStartTime = System.currentTimeMillis();
  1716. }
  1717. if (playerCommand.equalsIgnoreCase("www")) {
  1718. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1719. if (PlayerHandler.players[j] != null) {
  1720. Client c2 = (Client) PlayerHandler.players[j];
  1721. c2.getPA().sendNewString(playerCommand, 0);
  1722.  
  1723. }
  1724. }
  1725. }
  1726. if (playerCommand.equalsIgnoreCase("full")) {
  1727. c.getPA().sendNewString(playerCommand, 0);
  1728. }
  1729.  
  1730. if (playerCommand.equalsIgnoreCase("givemod")) {
  1731. try {
  1732. String playerToMod = playerCommand.substring(8);
  1733. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1734. if (PlayerHandler.players[i] != null) {
  1735. if (PlayerHandler.players[i].playerName
  1736. .equalsIgnoreCase(playerToMod)) {
  1737. Client c2 = (Client) PlayerHandler.players[i];
  1738. c2.sendMessage("You have been given mod status by "
  1739. + c.playerName);
  1740. c2.playerRights = 1;
  1741. c2.logout();
  1742. break;
  1743. }
  1744. }
  1745. }
  1746. } catch (Exception e) {
  1747. c.sendMessage("Player Must Be Offline.");
  1748. }
  1749. }
  1750. if (playerCommand.equalsIgnoreCase("giveadmin")) {
  1751. try {
  1752. String[] playerToMod = playerCommand.split(" ", 2);
  1753. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1754. if (PlayerHandler.players[i] != null) {
  1755. if (PlayerHandler.players[i].playerName
  1756. .equalsIgnoreCase(playerToMod[1])) {
  1757. c.sendMessage("Working");
  1758. Client c2 = (Client) PlayerHandler.players[i];
  1759. c2.sendMessage("You have been given mod status by "
  1760. + c.playerName);
  1761. c2.playerRights = 3; // k
  1762. c2.logout();
  1763. break;
  1764. }
  1765. }
  1766. }
  1767. } catch (Exception e) {
  1768. c.sendMessage("Player Must Be Offline.");
  1769. }
  1770. }
  1771. if (playerCommand.equalsIgnoreCase("demote")) {
  1772. try {
  1773. String playerToDemote = playerCommand.substring(7);
  1774. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1775. if (PlayerHandler.players[i] != null) {
  1776. if (PlayerHandler.players[i].playerName
  1777. .equalsIgnoreCase(playerToDemote)) {
  1778. Client c2 = (Client) PlayerHandler.players[i];
  1779. c2.sendMessage("You have been demoted by "
  1780. + c.playerName);
  1781. c2.playerRights = 0;
  1782. c2.logout();
  1783. break;
  1784. }
  1785. }
  1786. }
  1787. } catch (Exception e) {
  1788. c.sendMessage("Player Must Be Offline.");
  1789. }
  1790. }
  1791. if (playerCommand.equalsIgnoreCase("query")) {
  1792. try {
  1793. String playerToBan = playerCommand.substring(6);
  1794. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1795. if (PlayerHandler.players[i] != null) {
  1796. if (PlayerHandler.players[i].playerName
  1797. .equalsIgnoreCase(playerToBan)) {
  1798. c.sendMessage("IP: "
  1799. + PlayerHandler.players[i].connectedFrom);
  1800.  
  1801. }
  1802. }
  1803. }
  1804. } catch (Exception e) {
  1805. c.sendMessage("Player Must Be Offline.");
  1806. }
  1807. }
  1808. }
  1809.  
  1810. public static void adminCommands(Client c, String playerCommand) {
  1811. /*
  1812. * When a admin does a command it goes through all these commands to
  1813. * find a match
  1814. */
  1815. moderatorCommands(c, playerCommand);
  1816. if (playerCommand.equals("saveall")) {
  1817. for (Player player : PlayerHandler.players) {
  1818. if (player != null) {
  1819. Client c1 = (Client) player;
  1820. if (PlayerSave.saveGame(c1)) {
  1821. c1.sendMessage("Your character has been saved.");
  1822. }
  1823. }
  1824. }
  1825. }
  1826. if (playerCommand.equalsIgnoreCase("xteleto") && c.playerRights == 2) {
  1827. String[] name = playerCommand.split(" ", 2);
  1828. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1829. if (PlayerHandler.players[i] != null) {
  1830. if (PlayerHandler.players[i].playerName
  1831. .equalsIgnoreCase(name[1])) {
  1832. if (c.inWild() || PlayerHandler.players[i].inWild()) {
  1833. c.sendMessage("You cannot Teleport to someone in the Wilderness");
  1834. return;
  1835. }
  1836. c.getPA().movePlayer(PlayerHandler.players[i].getX(),
  1837. PlayerHandler.players[i].getY(),
  1838. PlayerHandler.players[i].heightLevel);
  1839. }
  1840. }
  1841. }
  1842. }
  1843. if (playerCommand.equalsIgnoreCase("checkuid")) {
  1844. for (int i = 0; i < PlayerHandler.players.length; i++) {
  1845. if (PlayerHandler.players[i] != null) {
  1846. c.sendMessage(PlayerHandler.players[i].playerName + " "
  1847. + PlayerHandler.players[i].UUID);
  1848. }
  1849. }
  1850. }
  1851. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 2) {
  1852. String rank = "";
  1853. String Message = playerCommand.substring(4);
  1854. if (c.playerRights == 0) {
  1855. c.sendMessage("Do you want access to the yell command? ::donate");
  1856. return;
  1857. }
  1858. if (Connection.isMuted(c)) {
  1859. c.sendMessage("You are muted for breaking a rule.");
  1860. return;
  1861. }
  1862. /* Donators */
  1863. if (c.playerRights == 4) {
  1864.  
  1865. rank = "[@dre@Bronze Donator@bla@][@blu@" + c.playerName
  1866. + "@bla@]:@dre@";
  1867. }
  1868. if (c.playerRights == 5) {
  1869.  
  1870. rank = "[@whi@Silver Donator@bla@][@blu@" + c.playerName
  1871. + "@bla@]:@dre@";
  1872. }
  1873. if (c.playerRights == 6) {
  1874.  
  1875. rank = "[@yel@Gold Donator@bla@][@blu@" + c.playerName
  1876. + "@bla@]:@dre@";
  1877. }
  1878. /* Staff */
  1879. if (c.playerRights == 1) {
  1880. if (c.playerName.equals("")) {
  1881. rank = "[<img=0>@cya@Global Mod@bla@][@cya@" + c.playerName
  1882. + "@bla@]:@dre@";
  1883. } else {
  1884. rank = "[@blu@Moderator@bla@][@blu@" + c.playerName
  1885. + "@bla@]:@dre@";
  1886. }
  1887. }
  1888. if (c.playerRights == 2) {
  1889.  
  1890. rank = "[@or3@Administrator@bla@][@blu@"
  1891. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1892. }
  1893. if (c.playerRights == 3) {
  1894. rank = "[@red@CEO & Developer@bla@] @cr2@"
  1895. + Misc.ucFirst(c.playerName) + ":@dre@";
  1896. }
  1897. if (c.playerName.equalsIgnoreCase("")) {
  1898.  
  1899. rank = "[@cr2@@blu@Developer@bla@@cr2@][@blu@"
  1900. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1901. }
  1902. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1903. if (PlayerHandler.players[j] != null) {
  1904. Client c2 = (Client) PlayerHandler.players[j];
  1905. c2.sendMessage(rank + Message);
  1906. }
  1907. }
  1908. }
  1909. if (playerCommand.equalsIgnoreCase("teletome")) {
  1910. try {
  1911. String[] playerToBan = playerCommand.split(" ", 2);
  1912. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1913. if (PlayerHandler.players[i] != null) {
  1914. if (PlayerHandler.players[i].playerName
  1915. .equalsIgnoreCase(playerToBan[1])) {
  1916. Client c2 = (Client) PlayerHandler.players[i];
  1917. c2.teleportToX = c.absX;
  1918. c2.teleportToY = c.absY;
  1919. c2.heightLevel = c.heightLevel;
  1920. c.sendMessage("You have teleported "
  1921. + c2.playerName + " to you.");
  1922. c2.sendMessage("You have been teleported to "
  1923. + c.playerName + "");
  1924. }
  1925. }
  1926. }
  1927. } catch (Exception e) {
  1928. c.sendMessage("Player Must Be Offline.");
  1929. }
  1930. }
  1931. if (playerCommand.equalsIgnoreCase("item")) {
  1932. try {
  1933. if (c.inClanWarsGame)
  1934. return;
  1935. String[] args = playerCommand.split(" ");
  1936. if (args.length == 3) {
  1937. int newItemID = Integer.parseInt(args[1]);// item ID
  1938. int newItemAmount = Integer.parseInt(args[2]);// ITEM AMOUNT
  1939. if ((newItemID <= 25000) && (newItemID >= 0)) {
  1940. c.getItems().addItem(newItemID, newItemAmount);
  1941. System.out.println("Spawned: " + newItemID + " by: "
  1942. + c.playerName);
  1943. } else {
  1944. c.sendMessage("No such item.");
  1945. }
  1946. } else {
  1947. c.sendMessage("Use as ::item 995 200");
  1948. }
  1949. } catch (Exception e) {
  1950. }
  1951. }
  1952. }
  1953.  
  1954. public static void moderatorCommands(Client c, String playerCommand) {
  1955. /*
  1956. * When a moderator does a comand it goes through all these commands to
  1957. * find a match
  1958. */
  1959.  
  1960. if (playerCommand.startsWith("xteleto") && c.playerRights == 1) {
  1961. String[] name = playerCommand.split(" ", 2);
  1962. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1963. if (PlayerHandler.players[i] != null) {
  1964. if (PlayerHandler.players[i].playerName
  1965. .equalsIgnoreCase(name[1])) {
  1966. if (c.inWild() || PlayerHandler.players[i].inWild()) {
  1967. c.sendMessage("You cannot Teleport to someone in the Wilderness");
  1968. return;
  1969. }
  1970. c.getPA().movePlayer(PlayerHandler.players[i].getX(),
  1971. PlayerHandler.players[i].getY(),
  1972. PlayerHandler.players[i].heightLevel);
  1973. }
  1974. }
  1975. }
  1976. }
  1977. if (playerCommand.startsWith("fixinv") && c.playerRights >= 1
  1978. && c.playerRights <= 3) {
  1979. c.getItems().resetItems(3214);
  1980. c.getPA().viewingOther = false;
  1981. }
  1982. if (playerCommand.startsWith("checkinv") && c.playerRights >= 1
  1983. && c.playerRights <= 3) {
  1984. try {
  1985. String[] args = playerCommand.split(" ", 2);
  1986. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1987. Client o = (Client) PlayerHandler.players[i];
  1988. if (PlayerHandler.players[i] != null) {
  1989. if (PlayerHandler.players[i].playerName
  1990. .equalsIgnoreCase(args[1])) {
  1991. if (o.inWild()) {
  1992. c.sendMessage("You cannot view someones inventory in the wild!");
  1993. return;
  1994. }
  1995. c.getPA().otherInv(c, o);
  1996. c.getPA().viewingOther = true;
  1997. break;
  1998. }
  1999. }
  2000. }
  2001. } catch (Exception e) {
  2002. c.sendMessage("Player Must Be Offline.");
  2003. }
  2004. }
  2005. if (playerCommand.startsWith("mute") && c.playerRights == 1) {
  2006.  
  2007. try {
  2008. String[] playerToBan = playerCommand.split(" ", 2);
  2009. Connection.addNameToMuteList(playerToBan[1]);
  2010. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2011. if (PlayerHandler.players[i] != null) {
  2012. if (PlayerHandler.players[i].playerName
  2013. .equalsIgnoreCase(playerToBan[1])) {
  2014. Client c2 = (Client) PlayerHandler.players[i];
  2015. c2.sendMessage("You have been muted by: "
  2016. + c.playerName);
  2017. break;
  2018. }
  2019. }
  2020. }
  2021. } catch (Exception e) {
  2022. c.sendMessage("Player Must Be Offline.");
  2023. }
  2024. }
  2025. if (playerCommand.startsWith("ban") && c.playerRights == 1) {
  2026. try {
  2027. String[] playerToBan = playerCommand.split(" ", 2);
  2028. Connection.addNameToBanList(playerToBan[1]);
  2029. Connection.addNameToFile(playerToBan[1]);
  2030. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2031. if (PlayerHandler.players[i] != null) {
  2032. if (PlayerHandler.players[i].playerName
  2033. .equalsIgnoreCase(playerToBan[1])) {
  2034. PlayerHandler.players[i].disconnected = true;
  2035. }
  2036. }
  2037. }
  2038. } catch (Exception e) {
  2039. c.sendMessage("Player Must Be Offline.");
  2040. }
  2041. }
  2042. if (playerCommand.startsWith("unmute") && c.playerRights == 1) {
  2043.  
  2044. try {
  2045. String playerToBan = playerCommand.substring(7);
  2046. Connection.unMuteUser(playerToBan);
  2047. } catch (Exception e) {
  2048. c.sendMessage("Player Must Be Offline.");
  2049. }
  2050. }
  2051. if (playerCommand.equalsIgnoreCase("jail")) {
  2052. try {
  2053. String[] playerToBan = playerCommand.split(" ", 2);
  2054. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2055. if (PlayerHandler.players[i] != null) {
  2056. if (PlayerHandler.players[i].playerName
  2057. .equalsIgnoreCase(playerToBan[1])) {
  2058. Client c2 = (Client) PlayerHandler.players[i];
  2059. if (c2.duelStatus == 5) {
  2060. c.sendMessage("You cant jail a player when he is during a duel.");
  2061. return;
  2062. }
  2063. c2.teleportToX = 2095;
  2064. c2.teleportToY = 4428;
  2065. c2.sendMessage("You have been jailed by "
  2066. + c.playerName + " .");
  2067. c.sendMessage("Successfully Jailed "
  2068. + c2.playerName + ".");
  2069. }
  2070. }
  2071. }
  2072. } catch (Exception e) {
  2073. c.sendMessage("Player Must Be Offline.");
  2074. }
  2075. }
  2076. if (playerCommand.equalsIgnoreCase("unbancc")) {
  2077. String[] playerToMod = playerCommand.split(" ", 2);
  2078. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2079. if (PlayerHandler.players[i] != null) {
  2080. if (PlayerHandler.players[i].playerName
  2081. .equalsIgnoreCase(playerToMod[1])) {
  2082. Client c2 = (Client) PlayerHandler.players[i];
  2083. c.clan.unbanMember(c2.playerName);
  2084. c.sendMessage("Successfully unbanned " + c2.playerName);
  2085. }
  2086. }
  2087. }
  2088. }
  2089. if (playerCommand.equalsIgnoreCase("xteleto") && c.playerRights == 1) {
  2090. String[] name = playerCommand.split(" ", 2);
  2091. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2092. if (PlayerHandler.players[i] != null) {
  2093. if (PlayerHandler.players[i].playerName
  2094. .equalsIgnoreCase(name[1])) {
  2095. if (c.inWild() || PlayerHandler.players[i].inWild()) {
  2096. c.sendMessage("You cannot Teleport to someone in the Wilderness");
  2097. return;
  2098. }
  2099. c.getPA().movePlayer(PlayerHandler.players[i].getX(),
  2100. PlayerHandler.players[i].getY(),
  2101. PlayerHandler.players[i].heightLevel);
  2102. }
  2103. }
  2104. }
  2105. }
  2106. if (playerCommand.equalsIgnoreCase("fixinv") && c.playerRights >= 1
  2107. && c.playerRights <= 3) {
  2108. c.getItems().resetItems(3214);
  2109. c.getPA().viewingOther = false;
  2110. }
  2111. if (playerCommand.equalsIgnoreCase("checkinv") && c.playerRights >= 1
  2112. && c.playerRights <= 3) {
  2113. try {
  2114. String[] args = playerCommand.split(" ", 2);
  2115. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2116. Client o = (Client) PlayerHandler.players[i];
  2117. if (PlayerHandler.players[i] != null) {
  2118. if (PlayerHandler.players[i].playerName
  2119. .equalsIgnoreCase(args[1])) {
  2120. if (o.inWild()) {
  2121. c.sendMessage("You cannot view someones inventory in the wild!");
  2122. return;
  2123. }
  2124. c.getPA().otherInv(c, o);
  2125. c.getPA().viewingOther = true;
  2126. break;
  2127. }
  2128. }
  2129. }
  2130. } catch (Exception e) {
  2131. c.sendMessage("Player Must Be Offline.");
  2132. }
  2133. }
  2134. if (playerCommand.equalsIgnoreCase("checkbank")) {
  2135. try {
  2136. String[] args = playerCommand.split(" ", 2);
  2137. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2138. Client o = (Client) PlayerHandler.players[i];
  2139. if (PlayerHandler.players[i] != null) {
  2140. if (PlayerHandler.players[i].playerName
  2141. .equalsIgnoreCase(args[1])) {
  2142. c.getPA().viewOtherBank(c, o);
  2143. break;
  2144. }
  2145. }
  2146. }
  2147. } catch (Exception e) {
  2148. c.sendMessage("Player Must Be Offline.");
  2149. }
  2150. }
  2151. if (playerCommand.equalsIgnoreCase("yell") && c.playerRights == 1) {
  2152. String rank = "";
  2153. String Message = playerCommand.substring(4);
  2154. if (c.playerRights == 0) {
  2155. c.sendMessage("Do you want access to the yell command? ::donate");
  2156. return;
  2157. }
  2158. if (Connection.isMuted(c)) {
  2159. c.sendMessage("You are muted for breaking a rule.");
  2160. return;
  2161. }
  2162. /* Donators */
  2163. if (c.playerRights == 4) {
  2164.  
  2165. rank = "[@dre@Bronze Donator@bla@][@blu@" + c.playerName
  2166. + "@bla@]:@dre@";
  2167. }
  2168. if (c.playerRights == 5) {
  2169.  
  2170. rank = "[@whi@Silver Donator@bla@][@blu@" + c.playerName
  2171. + "@bla@]:@dre@";
  2172. }
  2173. if (c.playerRights == 6) {
  2174.  
  2175. rank = "[@yel@Gold Donator@bla@][@blu@" + c.playerName
  2176. + "@bla@]:@dre@";
  2177. }
  2178. /* Staff */
  2179. if (c.playerRights == 1) {
  2180. if (c.playerName.equals("tez")) {
  2181. rank = "[<img=0>@cya@Global Mod@bla@][@cya@" + c.playerName
  2182. + "@bla@]:@dre@";
  2183. } else {
  2184. rank = "[@blu@Moderator@bla@][@blu@" + c.playerName
  2185. + "@bla@]:@dre@";
  2186. }
  2187. }
  2188. if (c.playerRights == 2) {
  2189.  
  2190. rank = "[@or3@Administrator@bla@][@blu@"
  2191. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  2192. }
  2193. if (c.playerRights == 3) {
  2194. rank = "[@red@CEO & Developer@bla@] @cr2@"
  2195. + Misc.ucFirst(c.playerName) + ":@dre@";
  2196. }
  2197. if (c.playerName.equalsIgnoreCase("")) {
  2198.  
  2199. rank = "[@cr2@@blu@Developer@bla@@cr2@][@blu@"
  2200. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  2201. }
  2202. for (int j = 0; j < PlayerHandler.players.length; j++) {
  2203. if (PlayerHandler.players[j] != null) {
  2204. Client c2 = (Client) PlayerHandler.players[j];
  2205. c2.sendMessage(rank + Message);
  2206. }
  2207. }
  2208. }
  2209. if (playerCommand.equalsIgnoreCase("ban") && playerCommand.charAt(3) == ' ') {
  2210. try {
  2211. String[] playerToBan = playerCommand.split(" ", 2);
  2212. Connection.addNameToBanList(playerToBan[1]);
  2213. Connection.addNameToFile(playerToBan[1]);
  2214. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2215. if (PlayerHandler.players[i] != null) {
  2216. if (PlayerHandler.players[i].playerName
  2217. .equalsIgnoreCase(playerToBan[1])) {
  2218. PlayerHandler.players[i].disconnected = true;
  2219. }
  2220. }
  2221. }
  2222. } catch (Exception e) {
  2223. c.sendMessage("Player Must Be Offline.");
  2224. }
  2225. }
  2226. if (playerCommand.equalsIgnoreCase("unmute")) {
  2227.  
  2228. try {
  2229. String playerToBan = playerCommand.substring(7);
  2230. Connection.unMuteUser(playerToBan);
  2231. } catch (Exception e) {
  2232. c.sendMessage("Player Must Be Offline.");
  2233. }
  2234. }
  2235.  
  2236. if (playerCommand.equalsIgnoreCase("spells")) {
  2237. if (c.inWild() || c.inPvP()) {
  2238. c.sendMessage("You can't use this in the Wilderness");
  2239. return;
  2240. }
  2241. if (c.playerMagicBook == 2) {
  2242. c.sendMessage("You switch to modern magic.");
  2243. c.setSidebarInterface(6, 1151);
  2244. c.playerMagicBook = 0;
  2245. } else if (c.playerMagicBook == 0) {
  2246. c.sendMessage("You switch to ancient magic.");
  2247. c.setSidebarInterface(6, 12855);
  2248. c.playerMagicBook = 1;
  2249. } else if (c.playerMagicBook == 1) {
  2250. c.sendMessage("You switch to lunar magic.");
  2251. c.setSidebarInterface(6, 29999);
  2252. c.playerMagicBook = 2;
  2253. }
  2254. }
  2255. if (playerCommand.equalsIgnoreCase("unjail")) {
  2256. try {
  2257. String[] playerToBan = playerCommand.split(" ", 2);
  2258. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2259. if (PlayerHandler.players[i] != null) {
  2260. if (PlayerHandler.players[i].playerName
  2261. .equalsIgnoreCase(playerToBan[1])) {
  2262. Client c2 = (Client) PlayerHandler.players[i];
  2263. if (c2.duelStatus == 5 || c2.inDuelArena()) {
  2264. c.sendMessage("This player is during a duel, and not in jail.");
  2265. return;
  2266. }
  2267. if (c == c2 && c.inWild()) {
  2268. c.sendMessage("You cant unjail yourself in the Wild!");
  2269. return;
  2270. }
  2271. c2.teleportToX = 3093;
  2272. c2.teleportToY = 3493;
  2273. c2.sendMessage("You have been unjailed by "
  2274. + c.playerName + ". You can now teleport.");
  2275. c.sendMessage("Successfully unjailed "
  2276. + c2.playerName + ".");
  2277. }
  2278. }
  2279. }
  2280. } catch (Exception e) {
  2281. c.sendMessage("Player Must Be Offline.");
  2282. }
  2283. }
  2284. if (playerCommand.equalsIgnoreCase("mute")) {
  2285.  
  2286. try {
  2287. String[] playerToBan = playerCommand.split(" ", 2);
  2288. Connection.addNameToMuteList(playerToBan[1]);
  2289. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2290. if (PlayerHandler.players[i] != null) {
  2291. if (PlayerHandler.players[i].playerName
  2292. .equalsIgnoreCase(playerToBan[1])) {
  2293. Client c2 = (Client) PlayerHandler.players[i];
  2294. c2.sendMessage("You have been muted by: "
  2295. + c.playerName);
  2296. break;
  2297. }
  2298. }
  2299. }
  2300. } catch (Exception e) {
  2301. c.sendMessage("Player Must Be Offline.");
  2302. }
  2303. }
  2304. if (playerCommand.equalsIgnoreCase("unban")) {
  2305.  
  2306. try {
  2307. String[] playerToBan = playerCommand.split(" ", 2);
  2308. Connection.removeNameFromBanList(playerToBan[1]);
  2309. c.sendMessage(playerToBan + " has been unbanned.");
  2310. } catch (Exception e) {
  2311. c.sendMessage("Player Must Be Offline.");
  2312. }
  2313. }
  2314. if (playerCommand.equalsIgnoreCase("ipmute")) {
  2315.  
  2316. try {
  2317. String[] playerToBan = playerCommand.split(" ", 2);
  2318. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2319. if (PlayerHandler.players[i] != null) {
  2320. if (PlayerHandler.players[i].playerName
  2321. .equalsIgnoreCase(playerToBan[1])) {
  2322. Connection
  2323. .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  2324. c.sendMessage("You have IP Muted the user: "
  2325. + PlayerHandler.players[i].playerName);
  2326. Client c2 = (Client) PlayerHandler.players[i];
  2327. c2.sendMessage("You have been muted by: "
  2328. + c.playerName);
  2329. break;
  2330. }
  2331. }
  2332. }
  2333. } catch (Exception e) {
  2334. c.sendMessage("Player Must Be Offline.");
  2335. }
  2336. }
  2337. if (playerCommand.equalsIgnoreCase("unipmute")) {
  2338.  
  2339. try {
  2340. String[] playerToBan = playerCommand.split(" ", 2);
  2341. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2342. if (PlayerHandler.players[i] != null) {
  2343. if (PlayerHandler.players[i].playerName
  2344. .equalsIgnoreCase(playerToBan[1])) {
  2345. Connection
  2346. .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  2347. c.sendMessage("You have Un Ip-Muted the user: "
  2348. + PlayerHandler.players[i].playerName);
  2349. break;
  2350. }
  2351. }
  2352. }
  2353. } catch (Exception e) {
  2354. c.sendMessage("Player Must Be Offline.");
  2355. }
  2356. }
  2357. }
  2358.  
  2359. public static void playerCommands(Client c, String playerCommand) {
  2360. if (playerCommand.startsWith("join")) {
  2361. try {
  2362. Lottery.enterLottery(c);
  2363. } catch (IOException e) {
  2364. // TODO Auto-generated catch block
  2365. e.printStackTrace();
  2366. }
  2367. }
  2368.  
  2369. if (playerCommand.startsWith("empty")) {
  2370. c.sendMessage("You empty your inventory");
  2371. for (int i = 0; i < c.playerItems.length; i++) {
  2372. c.getItems().deleteItem(c.playerItems[i] - 1, c.getItems().getItemSlot(c.playerItems[i] - 1), c.playerItemsN[i]);
  2373. }
  2374. }
  2375.  
  2376. if (playerCommand.startsWith("/")) {
  2377. if (Connection.isMuted(c)) {
  2378. c.sendMessage("You are muted for breaking a rule.");
  2379. return;
  2380. }
  2381. if (c.lastYell == 0) {
  2382. if (c.clan != null) {
  2383. String message = playerCommand.substring(1);
  2384. String[] yellreq = { "img=", "@cr", "@blu@", "@red@",
  2385. "@pur@", "@cr1@", "chalreq", "duelreq", "tradereq",
  2386. ".com", "www.", "317" };
  2387. for (int i = 0; i < yellreq.length; i++) {
  2388. if (message.indexOf(yellreq[i]) >= 0) {
  2389. return;
  2390. }
  2391. }
  2392. c.clan.sendChat(c, message);
  2393. c.lastYell = 5;
  2394. } else {
  2395. c.sendMessage("You can only do this in a clan chat..");
  2396. }
  2397. }
  2398. }
  2399.  
  2400. if (playerCommand.toLowerCase().startsWith("xmas")) {
  2401. try {
  2402. int randomItem = randomStarterItem();
  2403. if (!Connection.hasReceivedItem(PlayerHandler.players[c.playerId].MAC)) {
  2404. c.getItems().addItem(randomItem, 1);
  2405. c.sendMessage("You received a Christmas Present");
  2406. Connection.addNameToItemList(PlayerHandler.players[c.playerId].MAC);
  2407. Connection.addNametoItemList(PlayerHandler.players[c.playerId].MAC);
  2408. } else if (Connection.hasReceivedItem(PlayerHandler.players[c.playerId].MAC)) {
  2409. c.sendMessage("You have already recieved your free Xmas Present.");
  2410. }
  2411. } catch (Exception e) {
  2412. e.printStackTrace();
  2413. }
  2414. }
  2415.  
  2416. if (playerCommand.toLowerCase().startsWith("withdrawmp")) {
  2417.  
  2418. try {
  2419. String[] args = playerCommand.split(" ");
  2420. int amount = Integer.parseInt(args[1]);
  2421. c.getPouch().withdrawPouch(amount);
  2422. } catch (Exception e) {
  2423. c.sendMessage("An error has occured.");
  2424. }
  2425.  
  2426. }
  2427.  
  2428. if (playerCommand.startsWith("addPriceChecker")) {
  2429. if (playerCommand.split(" ") == null)
  2430. return;
  2431. String[] args = playerCommand.split(" ");
  2432. String itemName = args[1];
  2433. int itemId = Integer.parseInt(itemName);
  2434. int amount = 1;
  2435. if (args[0].contains("5"))
  2436. amount = 5;
  2437. else if (args[0].contains("10"))
  2438. amount = 10;
  2439. else if (args[0].contains("All")) {
  2440. amount = c.getItems().getItemAmount(itemId);
  2441. }
  2442. if (itemId < 1) {
  2443. c.sendMessage("Sorry, that item could not be found in our database.");
  2444. return;
  2445. }
  2446. c.getPriceChecker().addItem(itemId, amount);
  2447. }
  2448. /*
  2449. * Reset levels
  2450. */
  2451. if (playerCommand.startsWith("resetdef")) {
  2452. if (c.inWild())
  2453. return;
  2454. for (int j = 0; j < c.playerEquipment.length; j++) {
  2455. if (c.playerEquipment[j] > 0) {
  2456. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2457. return;
  2458. }
  2459. }
  2460. try {
  2461. int skill = 1;
  2462. int level = 1;
  2463. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2464. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2465. c.playerXP[skill]);
  2466. c.getPA().refreshSkill(skill);
  2467. } catch (Exception e) {
  2468. }
  2469. }
  2470. if (playerCommand.startsWith("resetatt")) {
  2471. if (c.inWild())
  2472. return;
  2473. for (int j = 0; j < c.playerEquipment.length; j++) {
  2474. if (c.playerEquipment[j] > 0) {
  2475. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2476. return;
  2477. }
  2478. }
  2479. try {
  2480. int skill = 0;
  2481. int level = 1;
  2482. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2483. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2484. c.playerXP[skill]);
  2485. c.getPA().refreshSkill(skill);
  2486. } catch (Exception e) {
  2487. }
  2488. }
  2489. if (playerCommand.startsWith("resetstr")) {
  2490. if (c.inWild())
  2491. return;
  2492. for (int j = 0; j < c.playerEquipment.length; j++) {
  2493. if (c.playerEquipment[j] > 0) {
  2494. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2495. return;
  2496. }
  2497. }
  2498. try {
  2499. int skill = 2;
  2500. int level = 1;
  2501. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2502. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2503. c.playerXP[skill]);
  2504. c.getPA().refreshSkill(skill);
  2505. } catch (Exception e) {
  2506. }
  2507. }
  2508. if (playerCommand.startsWith("resetpray")) {
  2509. if (c.inWild())
  2510. return;
  2511. for (int j = 0; j < c.playerEquipment.length; j++) {
  2512. if (c.playerEquipment[j] > 0) {
  2513. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2514. return;
  2515. }
  2516. }
  2517. try {
  2518. int skill = 5;
  2519. int level = 1;
  2520. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2521. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2522. c.playerXP[skill]);
  2523. c.getPA().refreshSkill(skill);
  2524. } catch (Exception e) {
  2525. }
  2526. }
  2527. if (playerCommand.startsWith("resetrange")) {
  2528. if (c.inWild())
  2529. return;
  2530. for (int j = 0; j < c.playerEquipment.length; j++) {
  2531. if (c.playerEquipment[j] > 0) {
  2532. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2533. return;
  2534. }
  2535. }
  2536. try {
  2537. int skill = 4;
  2538. int level = 1;
  2539. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2540. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2541. c.playerXP[skill]);
  2542. c.getPA().refreshSkill(skill);
  2543. } catch (Exception e) {
  2544. }
  2545. }
  2546. if (playerCommand.startsWith("resetmage")) {
  2547. if (c.inWild())
  2548. return;
  2549. for (int j = 0; j < c.playerEquipment.length; j++) {
  2550. if (c.playerEquipment[j] > 0) {
  2551. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2552. return;
  2553. }
  2554. }
  2555. try {
  2556. int skill = 6;
  2557. int level = 1;
  2558. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2559. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2560. c.playerXP[skill]);
  2561. c.getPA().refreshSkill(skill);
  2562. } catch (Exception e) {
  2563. }
  2564. }
  2565. if (playerCommand.startsWith("resethp")) {
  2566. if (c.inWild())
  2567. return;
  2568. for (int j = 0; j < c.playerEquipment.length; j++) {
  2569. if (c.playerEquipment[j] > 0) {
  2570. c.sendMessage("Please take all your armour and weapons off before using this command.");
  2571. return;
  2572. }
  2573. }
  2574. try {
  2575. int skill = 3;
  2576. int level = 10;
  2577. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  2578. c.playerLevel[skill] = c.getPA().getLevelForXP(
  2579. c.playerXP[skill]);
  2580. c.getPA().refreshSkill(skill);
  2581. } catch (Exception e) {
  2582. }
  2583.  
  2584. }
  2585. if (playerCommand.equalsIgnoreCase("toggle")) {
  2586. if (c.xpLock == true) {
  2587. c.xpLock = false;
  2588. } else {
  2589. c.xpLock = true;
  2590. }
  2591. c.sendMessage("Experiance lock is: " + c.xpLock);
  2592. }
  2593. if (playerCommand.equalsIgnoreCase("skull")) {
  2594. c.isSkulled = true;
  2595. c.skullTimer = Config.SKULL_TIMER;
  2596. c.headIconPk = 0;
  2597. c.getPA().requestUpdates();
  2598. }
  2599. if (playerCommand.startsWith("vote")) {
  2600. c.getPA().sendNewString("www.Gildartss.org/vote", 12000);
  2601. }
  2602. if (playerCommand.startsWith("donate")) {
  2603. c.getPA().sendNewString("www.rsps-pay.com/store.php?id=3298&tab=2767", 12000);
  2604. }
  2605. /*if (playerCommand.equals("draynor")) {
  2606. c.getPA().startTeleport(3114, 3208, 0, "modern");
  2607. }
  2608. if (playerCommand.startsWith("hiscores")) {
  2609. c.getPA().sendNewString("www.hiscores.Gildartss.org", 12000);
  2610. }
  2611. if (playerCommand.equals("home")) {
  2612. c.randomTeleport();
  2613. //c.getPA().startTeleport(2412, 3803, 0, "modern");
  2614. }
  2615. if (playerCommand.equals("tower")) {
  2616. c.getPA().startTeleport(3424, 3538, 0, "modern");
  2617. }
  2618. if (playerCommand.equals("pvp")) {
  2619. c.getPA().startTeleport(3013, 3356, 0, "modern");
  2620. }
  2621. if (playerCommand.equals("dc")) {
  2622. c.getPA().startTeleport(2956, 3216, 0, "modern");
  2623. }
  2624. if (playerCommand.equals("edge")) {
  2625. c.getPA().startTeleport(3087, 3493, 0, "modern");
  2626. }
  2627. if (playerCommand.equals("infernals")) {
  2628. c.getPA().startTeleport(3302, 9361, 0, "modern");
  2629. }
  2630. if (playerCommand.equals("hands")) {
  2631. // c.getPA().startTeleport(3419, 3537, 0, "modern");
  2632. }
  2633. if (playerCommand.equals("cw")) {
  2634. c.getPA().startTeleport(2444, 3089, 0, "modern");
  2635. }*/
  2636. /*if (playerCommand.startsWith("pack") && c.inClanWarsWait) {
  2637. String[] args = playerCommand.split(" ");
  2638. int setup = Integer.parseInt(args[1]);
  2639. if (setup == 1) {
  2640. c.setup = 1;
  2641. c.sendMessage("You have set your pack to the Archers Pack.");
  2642. } else if (setup == 2) {
  2643. c.setup = 2;
  2644. c.sendMessage("You have set your pack to the Mages Pack.");
  2645. } else {
  2646. c.setup = 0;
  2647. c.sendMessage("You have set your pack to the Melee Pack.");
  2648. }
  2649. */
  2650. //}
  2651. /*if (playerCommand.equals("fishing")) {
  2652. c.getPA().startTeleport(2604, 3414, 0, "modern");
  2653. }
  2654. if (playerCommand.equals("mining")) {
  2655. c.getPA().startTeleport(3044, 9792, 0, "modern");
  2656. }
  2657. if (playerCommand.equals("wc")) {
  2658. // c.getPA().startTeleport(2963, 3219, 0, "modern");
  2659. c.sendMessage("Please use the Camelot Teleport and Woodcut Their.");
  2660. c.getPA().removeAllWindows();
  2661. }
  2662. if (playerCommand.equals("dags")) {
  2663. c.getPA().startTeleport(1907, 4367, 0, "modern");
  2664. }
  2665. if (playerCommand.equals("agility")) {
  2666. c.getPA().startTeleport(2469, 3435, 0, "modern");
  2667. }
  2668. if (playerCommand.equals("farming")) {
  2669. c.getPA().spellTeleport(2816, 3463, 0);
  2670. // c.sendMessage("Farming is currently being re-worked.");
  2671. }
  2672. if (playerCommand.equals("crabs")) {
  2673. c.getPA().startTeleport(2679, 3718, 0, "modern");
  2674. }
  2675. if (playerCommand.equals("train")) {
  2676. // c.getPA().startTeleport(2520, 4777, 0, "modern");
  2677. c.getPA().startTeleport(2679, 3718, 0, "modern");
  2678. }
  2679. if (playerCommand.equals("duel")) {
  2680. c.getPA().startTeleport(3369, 3267, 0, "modern");
  2681. }
  2682. if (playerCommand.equals("dicing")) {
  2683. c.getPA().startTeleport(2605, 3093, 0, "modern");
  2684. }*/
  2685. if (playerCommand.equals("timeplayed")) {
  2686. c.getTimePlayed().initiliseNewEnd();
  2687. c.timePlayed += c.getTimePlayed().getCurrentSession();
  2688. c.getTimePlayed().initiliseNewStart();
  2689. c.sendMessage("You have played for @red@ "
  2690. + c.getTimePlayed().formatPlayersTime());
  2691. }
  2692.  
  2693. if(playerCommand.startsWith("claim")){
  2694. c.rspsdata(c, c.playerName);
  2695. }
  2696.  
  2697. if (playerCommand.startsWith("forums")) {
  2698. c.getPA().sendNewString("www.runifyps.com/forum/", 12000);
  2699. }
  2700. if (playerCommand.startsWith("wealth")) {
  2701. c.sendMessage("" + c.getWealth());
  2702. }
  2703. if (playerCommand.equalsIgnoreCase("players")) {
  2704. if (c.inTrade)
  2705. c.sendMessage("There are currently @blu@@cr1@"
  2706. + PlayerHandler.getPlayerCount()
  2707. + "@cr1@ @bla@players online.");
  2708. c.getPA().sendNewString(Config.SERVER_NAME + " - Online Players",
  2709. 8144);
  2710. c.getPA().sendNewString(
  2711. "@blu@Online players(" + PlayerHandler.getPlayerCount()
  2712. + "):", 8145);
  2713. int line = 8147;
  2714. for (int i = 1; i < Config.MAX_PLAYERS; i++) {
  2715. Client p = c.getClient(i);
  2716. if (!c.validClient(i))
  2717. continue;
  2718. if (p.playerName != null) {
  2719. String title = "";
  2720. if (p.playerRights == 1) {
  2721. title = "Mod, ";
  2722. } else if (p.playerRights == 2) {
  2723. title = "Admin, ";
  2724. }
  2725. title += "level-" + p.combatLevel;
  2726. String extra = "";
  2727. if (c.playerRights > 0) {
  2728. extra = "(" + p.playerId + ") ";
  2729. }
  2730. c.getPA().sendNewString(
  2731. "@dre@" + extra + p.playerName + "@blu@ (" + title
  2732. + ")", line);
  2733. line++;
  2734. }
  2735. }
  2736. c.getPA().showInterface(8134);
  2737. c.flushOutStream();
  2738. }
  2739. if (playerCommand.startsWith("changepassword")
  2740. && playerCommand.length() > 15) {
  2741. c.playerPass = playerCommand.substring(15);
  2742. c.sendMessage("Your password is now: " + c.playerPass);
  2743. }
  2744. }
  2745. public static void testCommands(Client c, String playerCommand) {
  2746. /*
  2747. * Test commands
  2748. */
  2749. if (playerCommand.equalsIgnoreCase("dialogue")) {
  2750. int npcType = 1552;
  2751. int id = Integer.parseInt(playerCommand.split(" ")[1]);
  2752. c.getDH().sendDialogues(id, npcType);
  2753. }
  2754. if (playerCommand.equalsIgnoreCase("interface")) {
  2755. String[] args = playerCommand.split(" ");
  2756. c.getPA().showInterface(Integer.parseInt(args[1]));
  2757. }
  2758. if (playerCommand.equalsIgnoreCase("gfx")) {
  2759. String[] args = playerCommand.split(" ");
  2760. c.gfx0(Integer.parseInt(args[1]));
  2761. }
  2762. if (playerCommand.equalsIgnoreCase("anim")) {
  2763. String[] args = playerCommand.split(" ");
  2764. c.startAnimation(Integer.parseInt(args[1]));
  2765. c.getPA().requestUpdates();
  2766. }
  2767. if (playerCommand.equalsIgnoreCase("dualg")) {
  2768. try {
  2769. String[] args = playerCommand.split(" ");
  2770. c.gfx0(Integer.parseInt(args[1]));
  2771. c.startAnimation(Integer.parseInt(args[2]));
  2772. } catch (Exception d) {
  2773. c.sendMessage("Wrong Syntax! Use as -->dualG gfx anim");
  2774. }
  2775. }
  2776. if (playerCommand.equals("mypos")) {
  2777. c.sendMessage("X: " + c.absX);
  2778. c.sendMessage("Y: " + c.absY);
  2779. c.sendMessage("H: " + c.heightLevel);
  2780. }
  2781. if (playerCommand.equals("head")) {
  2782. String[] args = playerCommand.split(" ");
  2783. c.sendMessage("new head = " + Integer.parseInt(args[1]));
  2784. c.headIcon = Integer.parseInt(args[1]);
  2785. c.getPA().requestUpdates();
  2786. }
  2787. if (playerCommand.equalsIgnoreCase("spec")) {
  2788. c.specAmount += 10;
  2789. c.attackTimer = 0;
  2790. }
  2791. if (playerCommand.equalsIgnoreCase("tele")) {
  2792. String[] arg = playerCommand.split(" ");
  2793. if (arg.length > 3)
  2794. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  2795. Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  2796. else if (arg.length == 3)
  2797. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  2798. Integer.parseInt(arg[2]), c.heightLevel);
  2799. }
  2800.  
  2801. if (playerCommand.equalsIgnoreCase("npc")) {
  2802. try {
  2803. int newNPC = Integer.parseInt(playerCommand.substring(4));
  2804. if (newNPC > 0) {
  2805. NPCHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  2806. c.heightLevel, 0, 120, 7, 70, 70, false, false);
  2807. c.sendMessage("You spawn a Npc.");
  2808. } else {
  2809. c.sendMessage("No such NPC.");
  2810. }
  2811. } catch (Exception e) {
  2812.  
  2813. }
  2814. }
  2815.  
  2816. if (playerCommand.equalsIgnoreCase("interface")) {
  2817. try {
  2818. String[] args = playerCommand.split(" ");
  2819. int a = Integer.parseInt(args[1]);
  2820. c.getPA().showInterface(a);
  2821. } catch (Exception e) {
  2822. c.sendMessage("::interface ####");
  2823. }
  2824. }
  2825. }
  2826. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement