Advertisement
Guest User

Untitled

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