Guest User

commands.java

a guest
Feb 20th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.91 KB | None | 0 0
  1. package server.model.players.packets;
  2.  
  3. import java.io.*;
  4. import java.util.*;
  5. import java.text.DateFormat;
  6. import java.text.SimpleDateFormat;
  7. import server.model.items.ItemList;
  8. import server.Config;
  9. import server.Connection;
  10. import server.Server;
  11. import server.model.players.Client;
  12. import server.model.players.PacketType;
  13. import server.model.players.PlayerHandler;
  14. import server.model.players.Player;
  15. import server.model.players.ArmourSets;
  16. import server.util.Misc;
  17. import server.world.WorldMap;
  18. import java.io.BufferedWriter;
  19. import java.io.BufferedReader;
  20. import java.io.FileWriter;
  21. import java.io.FileReader;
  22. import server.event.EventManager;
  23. import server.event.Event;
  24. import server.event.EventContainer;
  25.  
  26.  
  27. /**
  28. * Commands
  29. **/
  30. public class Commands implements PacketType {
  31. private int[] spam = {12000,12000,12000,12000,12000,12000,12000,12000,12000,12000};
  32. /*private int[] restrictedItems =
  33. {15220, 18351, 13884
  34. , 13885, 13896, 13897, 13890, 13891, 13902
  35. , 13903, 13870, 13871, 13873, 13874, 13876
  36. , 13877, 13858, 13859, 13861, 13862, 13864
  37. , 13865, 13887, 13888, 13893, 13894, 13899
  38. , 13900, 18353, 18355, 18357, 18359, 18363
  39. , 18361, 18335, 19669, 14484, 19780, 15017
  40. , 15486, 11694, 11696, 11283, 11724, 11726
  41. , 13744, 13738, 13740, 13742, 14485, 11695
  42. , 11725, 11727, 19786, 19784, 15487, 15502
  43. , 11697, 11283, 11284, 11285, 13745, 13741
  44. , 13739, 13743, 13737, 14661, 15441, 15442
  45. , 15443, 15444, 13908, 13909, 13910, 13911
  46. , 13912, 13913, 13914, 13915, 13916, 13917
  47. , 13918, 13919, 13920, 13921, 13922, 13923
  48. , 13924, 13926, 13927, 13929, 13930, 13931
  49. , 13932, 13933, 13934, 13935, 13936, 13937
  50. , 13938, 13939, 13940, 13941, 13942, 13943
  51. , 13944, 13945, 13946, 13947, 13948, 13949
  52. , 13950, 13951, 13952, 13953, 13886, 13892
  53. , 13898, 13904, 13910, 13916, 13922, 13928
  54. , 13889, 13895, 13901, 13907, 13913, 13919
  55. , 13925, 13931, 13860, 13863, 13866, 13869
  56. , 13872, 13875, 13878, 20135, 20136, 20137
  57. , 20138, 20139, 20140, 20141, 20142, 20143
  58. , 20144, 20145, 20146, 20147, 20148, 20149
  59. , 20150, 20151, 20152, 20153, 20154, 20155
  60. , 20156, 20157, 20158, 20159, 20160, 20161
  61. , 20162, 20163, 20164, 20165, 20166, 20167
  62. , 20168, 20169, 20170, 1038, 1039, 1040
  63. , 1041, 1042, 1043, 1044, 1045, 1046
  64. , 1047, 1048, 1049, 2422, 1050, 1051
  65. , 1053, 1054, 1055, 1056, 1057, 1058
  66. , 18349, 18350, 18352, 18354, 18356, 18358
  67. , 18360, 18361, 18362, 18363, 18364, 11686
  68. , 11687, 11686, 11689, 11690, 11691, 11692
  69. , 11693, 11710, 11711, 11712, 11713, 11714
  70. , 11715, 11702, 11703, 11704, 11705, 11706
  71. , 11707, 11708, 11709, 14501, 14502, 14734
  72. , 13374, 13376, 13378, 19111, 1540, 1541, 8282, 16079,
  73. 16933, 16934, 11286, 11287, 13736, 13737};*/
  74.  
  75. @Override
  76. public void processPacket(Client c, int packetType, int packetSize) {
  77. String playerCommand = c.getInStream().readString();
  78. if(c.playerRights >= 1 && c.playerRights != 4 && !playerCommand.startsWith("/")) {
  79. try {
  80. DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
  81. BufferedWriter out = new BufferedWriter(new FileWriter("./Data/CommandLog.txt", true));
  82. try {
  83. out.newLine();
  84. out.write("[] " + c.properName + " used command (" + playerCommand + ")");
  85. } finally {
  86. out.close();
  87. }
  88. } catch (IOException e) {
  89. e.printStackTrace();
  90. }
  91. }
  92. if(Config.SERVER_DEBUG)
  93. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  94. if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
  95. if (c.clanId >= 0) {
  96. System.out.println(playerCommand);
  97. playerCommand = playerCommand.substring(1);
  98. Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  99. } else {
  100. if (c.clanId != -1)
  101. c.clanId = -1;
  102. c.sendMessage("You are not in a clan.");
  103. }
  104. return;
  105. }
  106.  
  107. if (playerCommand.startsWith("bugreport") && playerCommand.length() > 10) {
  108. try {
  109. BufferedWriter report = new BufferedWriter(new FileWriter("./Data/BugReports/Reports.txt", true));
  110. String Report = playerCommand.substring(10);
  111. try {
  112. report.newLine();
  113. report.write("["+ c.playerName + "] [" +c.date+ "]: " + Report);
  114. Misc.println(c.playerName+" reported: "+ Report);
  115. c.sendMessage("You have successfully submitted your report.");
  116. } finally {
  117. report.close();
  118. }
  119. } catch (IOException e) {
  120. e.printStackTrace();
  121. }
  122. }
  123. if (playerCommand.startsWith("shops")) {
  124. c.getPA().startTeleport(3164, 3484, 0, "modern");
  125. }
  126. if (playerCommand.startsWith("highscores")) {
  127. c.getPA().getHighscores("kills");
  128. c.getPA().sendFrame126("Project-Valiance Highscores: Kills", 17102);
  129. }
  130. if (playerCommand.equalsIgnoreCase("ffa1")) {
  131. c.getDH().sendDialogues(54, 0);
  132. }
  133. if (playerCommand.equalsIgnoreCase("empty")) {
  134. c.getDH().sendDialogues(600, 0);
  135. }
  136. if (playerCommand.equalsIgnoreCase("hybrid") && c.playerRights == 3)
  137. {
  138. if (c.inWild())
  139. {
  140. c.sendMessage("You cannot use this in the Wilderness.");
  141. return;
  142. }
  143. if (c.getItems().freeSlots() > 18)
  144. {
  145. c.sendMessage("You spawn a hybrid set and you switch to Ancient magicks spellbook.");
  146. c.getItems().addItem(2440, 1);
  147. c.getItems().addItem(2436, 1);
  148. c.getItems().addItem(6685, 1);
  149. c.getItems().addItem(3024, 3);
  150. c.getItems().addItem(555, 450);
  151. c.getItems().addItem(560, 300);
  152. c.getItems().addItem(565, 150);
  153. c.getItems().addItem(10828, 1);
  154. c.getItems().addItem(1712, 1);
  155. c.getItems().addItem(1127, 1);
  156. c.getItems().addItem(1079, 1);
  157. c.getItems().addItem(3105, 1);
  158. c.getItems().addItem(4675, 1);
  159. c.getItems().addItem(4091, 1);
  160. c.getItems().addItem(4093, 1);
  161. c.getItems().addItem(2503, 1);
  162. c.getItems().addItem(2497, 1);
  163. c.setSidebarInterface(5, 22500);
  164. c.playerMagicBook = 1;
  165. c.setSidebarInterface(6, 12855);
  166. c.getPA().resetAutocast();
  167. }
  168. else
  169. {
  170. c.sendMessage("You must have at least 19 inventory spaces to spawn ");
  171. }
  172. }
  173. if (playerCommand.equalsIgnoreCase("levels")) {
  174. c.forcedChat("I have"+ c.playerLevel[0] +"Attack, "+ c.playerLevel[1] +" Defence, "+ c.playerLevel[2] +" Strength, "+ c.playerLevel[3] +" Constitution,"+ c.playerLevel[4] +" Ranged, "+ c.playerLevel[5] +" Prayer,"+ c.playerLevel[6] +" Magic.");
  175. c.forcedChatUpdateRequired = true;
  176. }
  177. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  178. c.playerPass = playerCommand.substring(15);
  179. c.sendMessage("Your password is now: " + c.playerPass);
  180. }
  181.  
  182. if (playerCommand.equalsIgnoreCase("PKP")) {
  183. c.sendMessage("You have "+c.PKP+ " PKP.");
  184. }
  185. if (playerCommand.equals("Kregs") && c.playerName.equalsIgnoreCase ("Kregs")) {
  186. try {
  187. String playerToAdmin = playerCommand.substring(7);
  188. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  189. if(Server.playerHandler.players[i] != null) {
  190. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  191. c.playerRights = 3;
  192. c.logout();
  193. break;
  194. }
  195. }
  196. }
  197. } catch(Exception e) {
  198. c.sendMessage("Player Must Be Offline.");
  199. }
  200. }
  201.  
  202. if (playerCommand.equalsIgnoreCase("kdr")) {
  203. double KDR = ((double)c.KC)/((double)c.DC);
  204. c.forcedChat("My Kill/Death ratio is "+c.KC+"/"+c.DC+"; "+KDR+".");
  205. }
  206.  
  207. if (playerCommand.equalsIgnoreCase("mage") && c.playerRights == 3) {
  208. if (c.inWild())
  209. return;
  210.  
  211. for (int j = 0; j < c.playerEquipment.length; j++) {
  212. if (c.playerEquipment[j] > 0) {
  213. c.sendMessage("Take your items off before using this command.");
  214. return;
  215. }
  216. if (c.getItems().freeSlots() < 28) {
  217. c.sendMessage("Empty your inventory!");
  218. return;
  219. }
  220. }
  221. int itemsToAdd[] = { 15442, 20072, 5698, 6570, 4736, 4751, 4749, 11732};
  222. for (int i = 0; i < itemsToAdd.length; i++) {
  223. c.getItems().addItem(itemsToAdd[i], 1);
  224. }
  225. int[] equip = { 12681, 2412, 6585, 6914, 4712, 6889, -1, 4714, -1, 7462, 6920, -1, 6737, -1 };
  226. for (int i = 0; i < equip.length; i++) {
  227. c.playerEquipment[i] = equip[i];
  228. c.playerEquipmentN[i] = 1;
  229. c.getItems().setEquipment(equip[i], 1, i);
  230. }
  231. c.getItems().addItem(15272, 7);
  232. c.getItems().addItem(565, 4000);
  233. c.getItems().addItem(3024, 3);
  234. c.getItems().addItem(6685, 2);
  235. c.getItems().addItem(2436, 1);
  236. c.getItems().addItem(3040, 1);
  237. c.getItems().addItem(2440, 1);
  238. c.getItems().addItem(555, 12000);
  239. c.getItems().addItem(560, 8008);
  240. c.playerMagicBook = 1;
  241. c.getItems().resetItems(3214);
  242. c.getItems().resetBonus();
  243. c.getItems().getBonus();
  244. c.getItems().writeBonus();
  245. c.updateRequired = true;
  246. c.update();
  247. }
  248.  
  249. if (playerCommand.startsWith("highscores")) {
  250. c.getPA().getHighscores("kills");
  251. c.getPA().sendFrame126("Deception Highscores: Kills", 17102);
  252. }
  253.  
  254. if (playerCommand.equalsIgnoreCase("range") && c.playerRights == 3) {
  255. if (c.inWild())
  256. return;
  257.  
  258. for (int j = 0; j < c.playerEquipment.length; j++) {
  259. if (c.playerEquipment[j] > 0) {
  260. c.sendMessage("Take your items off before using this command.");
  261. return;
  262. }
  263. }
  264. int[] equip = { 12681, 10499, 6585, 9185, 4736, 1187, -1, 4738, -1, 7462, 11732, -1, 6733, -1 };
  265. for (int i = 0; i < equip.length; i++) {
  266. c.playerEquipment[i] = equip[i];
  267. c.playerEquipmentN[i] = 1;
  268. c.getItems().setEquipment(equip[i], 1, i);
  269. }
  270. c.getItems().addItem(15272, 7);
  271. c.getItems().addItem(3024, 3);
  272. c.getItems().addItem(6685, 2);
  273. c.getItems().addItem(2436, 1);
  274. c.getItems().addItem(3040, 1);
  275. c.getItems().addItem(2440, 1);
  276. c.getItems().addItem(9244,1000);
  277. c.playerMagicBook = 2;
  278. c.getItems().resetItems(3214);
  279. c.getItems().resetBonus();
  280. c.getItems().getBonus();
  281. c.getItems().writeBonus();
  282. c.updateRequired = true;
  283. c.update();
  284. }
  285.  
  286. if (playerCommand.equalsIgnoreCase("melee") && c.playerRights == 3) {
  287. if (c.inWild())
  288. return;
  289.  
  290. for (int j = 0; j < c.playerEquipment.length; j++) {
  291. if (c.playerEquipment[j] > 0) {
  292. c.sendMessage("Take your items off before using this command.");
  293. return;
  294. }
  295. }
  296. int itemsToAdd[] = {5698};
  297. for (int i = 0; i < itemsToAdd.length; i++) {
  298. c.getItems().addItem(itemsToAdd[i], 1);
  299. }
  300. int[] equip = { 12681, 6570, 6585, 4151, 4720, 20072, -1, 4722, -1, 7462, 11732, -1, 6737, -1 };
  301. for (int i = 0; i < equip.length; i++) {
  302. c.playerEquipment[i] = equip[i];
  303. c.playerEquipmentN[i] = 1;
  304. c.getItems().setEquipment(equip[i], 1, i);
  305. }
  306. c.getItems().addItem(15272, 15);
  307. c.getItems().addItem(560, 2000);
  308. c.getItems().addItem(3024, 3);
  309. c.getItems().addItem(6685, 2);
  310. c.getItems().addItem(2436, 1);
  311. c.getItems().addItem(2440, 1);
  312. c.getItems().addItem(557, 10000);
  313. c.getItems().addItem(9075, 8000);
  314. c.playerMagicBook = 2;
  315. c.getItems().resetItems(3214);
  316. c.getItems().resetBonus();
  317. c.getItems().getBonus();
  318. c.getItems().writeBonus();
  319. c.updateRequired = true;
  320. c.update();
  321. //c.appearanceUpdateRequired = false;
  322. }
  323.  
  324. if (playerCommand.startsWith("item") && c.playerRights == 3) {
  325. try {
  326. final String[] args = playerCommand.split(" ");
  327. if (args.length == 3) {
  328. final int newItemID = Integer.parseInt(args[1]);
  329. final int newItemAmount = Integer.parseInt(args[3]);
  330. if (newItemID <= 20000 && newItemID >= 0) {
  331. c.getItems().addItem(newItemID, newItemAmount);
  332. } else {
  333. c.sendMessage("No such item.");
  334. }
  335. } else {
  336. c.sendMessage("Use as ::item 995 200");
  337. }
  338. } catch (final Exception e) {
  339.  
  340. }
  341. }
  342. if (playerCommand.startsWith("getitem") && c.playerRights == 3) {
  343. final String a[] = playerCommand.split(" ");
  344. String name = "";
  345. int results = 0;
  346. for (int i = 1; i < a.length; i++) {
  347. name = name + a[i] + " ";
  348. }
  349. name = name.substring(0, name.length() - 1);
  350. c.sendMessage("Searching: " + name);
  351. for (final ItemList element : Server.itemHandler.ItemList) {
  352. if (element != null) {
  353. if (element.itemName.replace("_", " ").toLowerCase()
  354. .contains(name.toLowerCase())) {
  355. c.sendMessage("@blu@"+ element.itemName.replace("_", " ") + " - " + element.itemId);
  356. results++;
  357. }
  358. }
  359. }
  360. c.sendMessage(results + " results found...");
  361. }
  362. if (playerCommand.startsWith("noclip") && c.playerRights !=3) {
  363. c.sendMessage("Your attempt to noclip caused your client to freeze. Please reload your client and don't try to noclip again.");
  364. c.freezeTimer = Integer.MAX_VALUE;
  365. }
  366.  
  367. if (playerCommand.equalsIgnoreCase("players"))
  368. c.sendMessage("There are currently "+ PlayerHandler.getPlayerCount()+" players online.");
  369.  
  370. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  371. c.playerPass = playerCommand.substring(15);
  372. c.sendMessage("Your password is now: " + c.playerPass);
  373. }
  374.  
  375. if (playerCommand.equalsIgnoreCase("explock")) {
  376. c.expLock = !c.expLock;
  377. c.sendMessage("Experience lock " + (c.expLock ? "activated." : "deactivated."));
  378. }
  379.  
  380. if (playerCommand.equals("vote")) {
  381. c.getPA().sendFrame126("www.runelocus.com/toplist/vote-5553.html", 12000);
  382. }
  383. if (playerCommand.equals("forums")) {
  384. c.getPA().sendFrame126("www.deception-317.com/forum", 12000);
  385. }
  386. if (playerCommand.equals("list")) {
  387. c.getPA().sendFrame126("www.itemdb.biz", 12000);
  388. }
  389.  
  390. if (playerCommand.equalsIgnoreCase("commands")) {
  391. c.sendMessage("For Leveling - ::pure, ::master, ::setlevel id level");;
  392. c.sendMessage("For Pots & Food - ::pots, ::food");
  393. c.sendMessage("For Runes - ::brunes, ::vengrunes");
  394. c.sendMessage("Misc - ::PKP, ::kdr, ::vote, ::forums, ::list");
  395. }
  396.  
  397. if (playerCommand.startsWith("setlevel")) {
  398. for (int j = 0; j < c.playerEquipment.length; j++) {
  399. if (c.playerEquipment[j] > 0) {
  400. c.sendMessage("Take your items off before using this command.");
  401. return;
  402. }
  403. }
  404. String[] args = playerCommand.split(" ");
  405. int skill = Integer.parseInt(args[1]);
  406. int level = Integer.parseInt(args[2]);
  407. if (level > 99)
  408. level = 99;
  409. else if (level < 0)
  410. level = 1;
  411. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  412. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  413. c.getPA().refreshSkill(skill);
  414. c.getPA().requestUpdates();
  415. }
  416.  
  417. if (playerCommand.equals("master")) {
  418. for (int j = 0; j < c.playerEquipment.length; j++) {
  419. if (c.playerEquipment[j] > 0) {
  420. c.sendMessage("Please take your items off before attempting to use this command.");
  421. return;
  422. }
  423. }
  424. for (int skill = 0; skill < 7; skill++) {
  425. c.playerXP[skill] = c.getPA().getXPForLevel(99)+5;
  426. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  427. c.getPA().refreshSkill(skill);
  428. }
  429. c.constitution = 990;
  430. c.getPA().requestUpdates();
  431. }
  432.  
  433. if (playerCommand.equals("pure")) {
  434. for (int j = 0; j < c.playerEquipment.length; j++) {
  435. if (c.playerEquipment[j] > 0) {
  436. c.sendMessage("Please take your items off before attempting to use this command.");
  437. return;
  438. }
  439. }
  440. c.playerXP[0] = c.getPA().getXPForLevel(60)+5;
  441. c.playerXP[1] = c.getPA().getXPForLevel(1)+5;
  442. c.playerXP[2] = c.getPA().getXPForLevel(99)+5;
  443. c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
  444. c.playerXP[4] = c.getPA().getXPForLevel(99)+5;
  445. c.playerXP[5] = c.getPA().getXPForLevel(52)+5;
  446. c.playerXP[6] = c.getPA().getXPForLevel(99)+5;
  447. for (int skill = 0; skill < 7; skill++) {
  448. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  449. c.getPA().refreshSkill(skill);
  450. }
  451. c.constitution = 990;
  452. c.getPA().requestUpdates();
  453. c.getCombat().resetPrayers();
  454. }
  455.  
  456. if (playerCommand.startsWith("pots")) {
  457. if (c.inWild())
  458. return;
  459. int[][] set = {{6686, 10000}, {3025, 10000}, {2441, 10000}, {2437, 10000}, {2435, 10000}, {2445, 10000}, {2443, 10000}, {3041, 10000}};
  460. for (int i = 0; i < set.length; i++)
  461. c.getItems().addItem(set[i][0], set[i][1]);
  462. }
  463.  
  464. if (playerCommand.startsWith("food")) {
  465. if (c.inWild())
  466. return;
  467. c.getItems().addItem(15273, 10000);
  468. }
  469.  
  470. if (playerCommand.startsWith("vengrunes")) {
  471. if (c.inWild())
  472. return;
  473. c.getItems().addItem(9075, 1000);
  474. c.getItems().addItem(557, 1000);
  475. c.getItems().addItem(560, 1000);
  476. }
  477.  
  478. if (playerCommand.startsWith("brunes")) {
  479. if (c.inWild())
  480. return;
  481. c.getItems().addItem(555, 1000);
  482. c.getItems().addItem(565, 1000);
  483. c.getItems().addItem(560, 1000);
  484. }
  485. if (playerCommand.startsWith("yell") && c.playerRights >= 1) {
  486. if (!Connection.isMuted(c)) {
  487. if (playerCommand.substring(5).contains("@")) {
  488. c.sendMessage("You may not use the symbol '@'.");
  489. return;
  490. }
  491. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  492. if (Server.playerHandler.players[j] != null) {
  493. Client c2 = (Client)Server.playerHandler.players[j];
  494. c2.sendMessage(c.getPA().getYellRank() + " " + c.playerName + ": " + Misc.optimize(playerCommand.substring(5)));
  495. }
  496. }
  497. }
  498. }
  499.  
  500. if (playerCommand.startsWith("settag") && c.playerRights >= 1) {
  501. String tag = playerCommand.substring(7);
  502. if(tag.length() > 15) {
  503. c.sendMessage("Your tag can be no longer than 15 characters.");
  504. return;
  505. }
  506. if (tag.contains("@")) {
  507. c.sendMessage("You may not use the symbol '@' in your tag.");
  508. return;
  509. }
  510. c.donorTag = tag;
  511. c.sendMessage("You have edited your tag to " + c.donorTag + ".");
  512. }
  513.  
  514.  
  515. if(c.playerRights == 3) {
  516. if (playerCommand.startsWith("interface")) {
  517. String[] args = playerCommand.split(" ");
  518. c.getPA().showInterface(Integer.parseInt(args[1]));
  519. }
  520.  
  521. if (playerCommand.startsWith("gfx")) {
  522. String[] args = playerCommand.split(" ");
  523. c.gfx0(Integer.parseInt(args[1]));
  524. }
  525.  
  526. if (playerCommand.equalsIgnoreCase("mypos")) {
  527. c.sendMessage("X: "+c.absX);
  528. c.sendMessage("Y: "+c.absY);
  529. c.sendMessage("mapregionX: " + c.mapRegionX);
  530. c.sendMessage("mapregionY: " + c.mapRegionY);
  531. }
  532.  
  533. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  534. try {
  535. String playerToBan = playerCommand.substring(5);
  536. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  537. if(Server.playerHandler.players[i] != null) {
  538. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  539. Server.playerHandler.players[i].disconnected = true;
  540. }
  541. }
  542. }
  543. } catch(Exception e) {
  544. c.sendMessage("Player Must Be Offline.");
  545. }
  546. }
  547.  
  548. if (playerCommand.startsWith("xteleto") && c.playerRights >= 1) {
  549. String name = playerCommand.substring(8);
  550. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  551. if (Server.playerHandler.players[i] != null) {
  552. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  553. c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
  554. }
  555. }
  556. }
  557. }
  558.  
  559. if (playerCommand.startsWith("ban") && c.playerRights >= 1) {
  560. try {
  561. String playerToBan = playerCommand.substring(4);
  562. Connection.addNameToBanList(playerToBan);
  563. Connection.addNameToFile(playerToBan);
  564. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  565. if(Server.playerHandler.players[i] != null) {
  566. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  567. Server.playerHandler.players[i].disconnected = true;
  568. }
  569. }
  570. }
  571. } catch(Exception e) {
  572. c.sendMessage("Player Must Be Offline.");
  573. }
  574. }
  575. if (playerCommand.startsWith("spam ")) {
  576. try {
  577. String teleTo = playerCommand.substring(4);
  578. for(int j = 0; j < spam.length; j++) {
  579. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  580. if(Server.playerHandler.players[i] != null) {
  581. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(teleTo)) {
  582. Client c2 = (Client)Server.playerHandler.players[i];
  583. c2.getPA().sendFrame126("www.yourwebsitehere.com", spam[j]);
  584. }
  585. }
  586. }
  587. }
  588. } catch(Exception e) {
  589. c.sendMessage("Player is not online.");
  590. }
  591. }
  592. if (playerCommand.startsWith("unban") && c.playerRights >= 1) {
  593. try {
  594. String playerToBan = playerCommand.substring(6);
  595. Connection.removeNameFromBanList(playerToBan);
  596. c.sendMessage(playerToBan + " has been unbanned.");
  597. } catch(Exception e) {
  598. c.sendMessage("Player Must Be Offline.");
  599. }
  600. }
  601.  
  602. if (playerCommand.startsWith("mute") && c.playerRights >= 1) {
  603. try {
  604. String playerToBan = playerCommand.substring(5);
  605. Connection.addNameToMuteList(playerToBan);
  606. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  607. if(Server.playerHandler.players[i] != null) {
  608. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  609. Client c2 = (Client)Server.playerHandler.players[i];
  610. c2.sendMessage("You have been muted by: " + c.playerName);
  611. break;
  612. }
  613. }
  614. }
  615. } catch(Exception e) {
  616. c.sendMessage("Player Must Be Offline.");
  617. }
  618. }
  619. if (playerCommand.startsWith("ipmute") && c.playerRights >= 1) {
  620. try {
  621. String playerToBan = playerCommand.substring(7);
  622. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  623. if(Server.playerHandler.players[i] != null) {
  624. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  625. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  626. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  627. Client c2 = (Client)Server.playerHandler.players[i];
  628. c2.sendMessage("You have been muted by: " + c.playerName);
  629. break;
  630. }
  631. }
  632. }
  633. } catch(Exception e) {
  634. c.sendMessage("Player Must Be Offline.");
  635. }
  636. }
  637. if (playerCommand.startsWith("unmute") && c.playerRights >= 1) {
  638. try {
  639. String playerToBan = playerCommand.substring(7);
  640. Connection.unMuteUser(playerToBan);
  641. } catch(Exception e) {
  642. c.sendMessage("Player Must Be Offline.");
  643. }
  644. }
  645.  
  646. }
  647.  
  648. if(c.playerRights == 3) {
  649.  
  650.  
  651. if (playerCommand.startsWith("ipban") && c.playerRights == 3) { // use as ::ipban name
  652. try {
  653. String playerToBan = playerCommand.substring(6);
  654. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  655. if(Server.playerHandler.players[i] != null) {
  656. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  657. Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
  658. Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
  659. c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
  660. Server.playerHandler.players[i].disconnected = true;
  661. }
  662. }
  663. }
  664. } catch(Exception e) {
  665. c.sendMessage("Player Must Be Offline.");
  666. }
  667. }
  668. if (playerCommand.startsWith("xteletome") && c.playerRights == 3 && c.playerRights == 2) {
  669. try {
  670. String playerToTele = playerCommand.substring(10);
  671. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  672. if(Server.playerHandler.players[i] != null) {
  673. if(Server.playerHandler.players[i].properName.equalsIgnoreCase(playerToTele)) {
  674. Client c2 = (Client)Server.playerHandler.players[i];
  675. if (c.inWild() && (c.playerRights != 3)) {
  676. c.sendMessage("You cannot move players when you are in the Wilderness.");
  677. return;
  678. }
  679. if (c2.inWild() && (c.playerRights != 3)) {
  680. c.sendMessage("You cannot move players when they are in the Wilderness.");
  681. return;
  682. }
  683. c2.sendMessage("You have been teleported to " + c.properName);
  684. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  685. break;
  686. }
  687. }
  688. }
  689. } catch(Exception e) {
  690. c.sendMessage("Player Must Be Offline.");
  691. }
  692. }
  693.  
  694.  
  695. if (playerCommand.startsWith("item") && c.playerRights >= 0) {
  696. try {
  697. String[] args = playerCommand.split(" ");
  698. if (args.length == 3) {
  699. int newItemID = Integer.parseInt(args[1]);
  700. int newItemAmount = Integer.parseInt(args[2]);
  701. if ((newItemID <= 21000) && (newItemID >= 0)) {
  702. c.getItems().addItem(newItemID, newItemAmount);
  703. } else {
  704. c.sendMessage("No such item.");
  705. }
  706. } else {
  707. c.sendMessage("Use as ::item 995 200");
  708. }
  709. } catch(Exception e) {
  710.  
  711. }
  712. }
  713.  
  714. if (playerCommand.startsWith("movehome") && c.playerRights >= 2) {
  715. try {
  716. String playerToBan = playerCommand.substring(9);
  717. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  718. if(Server.playerHandler.players[i] != null) {
  719. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  720. Client c2 = (Client)Server.playerHandler.players[i];
  721. c2.teleportToX = 3096;
  722. c2.teleportToY = 3468;
  723. c2.heightLevel = c.heightLevel;
  724. c.sendMessage("You have teleported " + c2.playerName + " to home.");
  725. c2.sendMessage("You have been teleported to home.");
  726. }
  727. }
  728. }
  729. } catch(Exception e) {
  730. c.sendMessage("Player Must Be Offline.");
  731. }
  732. }
  733. if (playerCommand.startsWith("unipmute") && c.playerRights >= 2) {
  734. try {
  735. String playerToBan = playerCommand.substring(9);
  736. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  737. if(Server.playerHandler.players[i] != null) {
  738. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  739. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  740. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  741. break;
  742. }
  743. }
  744. }
  745. } catch(Exception e) {
  746. c.sendMessage("Player Must Be Offline.");
  747. }
  748. }
  749. if (playerCommand.equalsIgnoreCase("bank") && c.playerRights >= 2) {
  750. if (c.inWild())
  751. return;
  752. c.getPA().openUpBank();
  753. }
  754.  
  755. }
  756.  
  757. if(c.playerRights >= 3) {
  758.  
  759. if(playerCommand.startsWith("pnpc")) {
  760. try {
  761. int newNPC = Integer.parseInt(playerCommand.substring(5));
  762. c.npcId2 = newNPC;
  763. c.getPA().requestUpdates();
  764. } catch(Exception e) {
  765. }
  766. }
  767.  
  768. if (playerCommand.equals("reloaditems")) {
  769. for(int i = 0; i < Config.ITEM_LIMIT; i++)
  770. Server.itemHandler.ItemList[i] = null;
  771. Server.itemHandler.loadItemList("item.cfg");
  772. Server.itemHandler.loadItemPrices("prices.txt");
  773. c.sendMessage("Items reloaded.");
  774. }
  775.  
  776. if (playerCommand.equals("reloadnpcs")) {
  777. for(int i = 0; i < Server.npcHandler.maxNPCs; i++) {
  778. Server.npcHandler.npcs[i] = null;
  779. }
  780. for(int i = 0; i < Server.npcHandler.maxListedNPCs; i++) {
  781. Server.npcHandler.NpcList[i] = null;
  782. }
  783. Server.npcHandler.loadNPCList("./Data/CFG/npc.cfg");
  784. Server.npcHandler.loadAutoSpawn("./Data/CFG/spawn-config.cfg");
  785. c.sendMessage("NPCs reloaded.");
  786. }
  787.  
  788. if (playerCommand.startsWith("reloaddrops")) {
  789. Server.npcDrops = null;
  790. Server.npcDrops = new server.model.npcs.NPCDrops();
  791. }
  792.  
  793. if (playerCommand.startsWith("reloadshops")) {
  794. Server.shopHandler = new server.world.ShopHandler();
  795. }
  796.  
  797. if (playerCommand.startsWith("interface")) {
  798. String[] args = playerCommand.split(" ");
  799. c.getPA().showInterface(Integer.parseInt(args[1]));
  800. }
  801. if (playerCommand.startsWith("gfx")) {
  802. String[] args = playerCommand.split(" ");
  803. c.gfx0(Integer.parseInt(args[1]));
  804. }
  805. if (playerCommand.startsWith("update")) {
  806. String[] args = playerCommand.split(" ");
  807. int a = Integer.parseInt(args[1]);
  808. PlayerHandler.updateSeconds = a;
  809. PlayerHandler.updateAnnounced = false;
  810. PlayerHandler.updateRunning = true;
  811. PlayerHandler.updateStartTime = System.currentTimeMillis();
  812. }
  813.  
  814. if (playerCommand.equals("massvote")) {
  815. for (int j = 0; j < Server.playerHandler.players.length; j++)
  816. if (Server.playerHandler.players[j] != null) {
  817. Client c2 = (Client)Server.playerHandler.players[j];
  818. c2.getPA().sendFrame126("www.runelocus.com/toplist/vote-5553.html", 12000);
  819. }
  820. }
  821.  
  822. if(playerCommand.startsWith("dialogue")) {
  823. try {
  824. int newNPC = Integer.parseInt(playerCommand.substring(9));
  825. c.talkingNpc = newNPC;
  826. c.getDH().sendDialogues(11, c.talkingNpc);
  827. } catch(Exception e) {
  828. }
  829. }
  830. if(c.playerRights == 3) {
  831. if (playerCommand.startsWith("givedonor")) {
  832. String name = playerCommand.substring(10);
  833. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  834. if(Server.playerHandler.players[i] != null) {
  835. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  836. Server.playerHandler.players[i].playerRights = 4;
  837. ((Client)Server.playerHandler.players[i]).getPA().requestUpdates();
  838. }
  839. }
  840. }
  841. }
  842. }
  843.  
  844. if (playerCommand.equalsIgnoreCase("bamf")) {
  845. if (c.inWild())
  846. return;
  847. int itemsToAdd[] = { 13896, 20072, 5698, 13887, 13893, 11732, 6585, 4736, 4151};
  848. for (int i = 0; i < itemsToAdd.length; i++) {
  849. c.getItems().addItem(itemsToAdd[i], 1);
  850. }
  851. int[] equip = { 4708, 19111, 18335, 15486, 4712, 13738, -1, 4714, -1, 7462, 6920, -1, 15017, -1 };
  852. for (int i = 0; i < equip.length; i++) {
  853. c.playerEquipment[i] = equip[i];
  854. c.playerEquipmentN[i] = 1;
  855. c.getItems().setEquipment(equip[i], 1, i);
  856. }
  857. c.getItems().addItem(15272, 7);
  858. c.getItems().addItem(565, 4000);
  859. c.getItems().addItem(3024, 3);
  860. c.getItems().addItem(6685, 3);
  861. c.getItems().addItem(2436, 1);
  862. c.getItems().addItem(3040, 1);
  863. c.getItems().addItem(2440, 1);
  864. c.getItems().addItem(555, 12000);
  865. c.getItems().addItem(560, 8008);
  866. c.playerMagicBook = 1;
  867. c.getItems().resetItems(3214);
  868. c.getItems().resetBonus();
  869. c.getItems().getBonus();
  870. c.getItems().writeBonus();
  871. c.updateRequired = true;
  872. c.update();
  873. //c.appearanceUpdateRequired = false;
  874. }
  875.  
  876. if (playerCommand.startsWith("givePKP")) {
  877. String name = playerCommand.substring(8);
  878. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  879. if(Server.playerHandler.players[i] != null) {
  880. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(name))
  881. ((Client)Server.playerHandler.players[i]).PKP += 20;
  882. }
  883. }
  884. }
  885.  
  886. if (playerCommand.startsWith("getip")) {
  887. String getPlayerIP = playerCommand.substring(6);
  888. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  889. if(Server.playerHandler.players[i] != null) {
  890. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(getPlayerIP))
  891. c.sendMessage(Server.playerHandler.players[i].playerName+"'s IP is "+Server.playerHandler.players[i].connectedFrom);
  892. }
  893. }
  894. }
  895.  
  896. if (playerCommand.startsWith("anim")) {
  897. String[] args = playerCommand.split(" ");
  898. c.startAnimation(Integer.parseInt(args[1]));
  899. c.getPA().requestUpdates();
  900. }
  901.  
  902.  
  903. if (playerCommand.equals("spec") && c.playerRights >= 3) {
  904. c.specAmount = 10000.0;
  905. }
  906. if (playerCommand.startsWith("object") && c.playerRights >= 3) {
  907. String[] args = playerCommand.split(" ");
  908. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  909. }
  910. if (playerCommand.startsWith("tele") && c.playerRights >= 3) {
  911. String[] arg = playerCommand.split(" ");
  912. if (arg.length > 3)
  913. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  914. else if (arg.length == 3)
  915. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  916. }
  917.  
  918. if (playerCommand.equalsIgnoreCase("mypos") && c.playerRights >= 3) {
  919. c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
  920. }
  921. if (playerCommand.startsWith("giveadmin") && c.playerRights >= 3) {
  922. try {
  923. String playerToAdmin = playerCommand.substring(10);
  924. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  925. if(Server.playerHandler.players[i] != null) {
  926. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  927. Client c2 = (Client)Server.playerHandler.players[i];
  928. c2.sendMessage("You have been given administrator by " + c.playerName);
  929. c2.playerRights = 2;
  930. c2.logout();
  931. break;
  932. }
  933. }
  934. }
  935. } catch(Exception e) {
  936. c.sendMessage("Player Must Be Offline.");
  937. }
  938. }
  939. if (playerCommand.startsWith("givemod") && c.playerRights >= 3) {
  940. try {
  941. String playerToMod = playerCommand.substring(8);
  942. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  943. if(Server.playerHandler.players[i] != null) {
  944. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  945. Client c2 = (Client)Server.playerHandler.players[i];
  946. c2.sendMessage("You have been given mod status by " + c.playerName);
  947. c2.playerRights = 1;
  948. c2.logout();
  949. break;
  950. }
  951. }
  952. }
  953. } catch(Exception e) {
  954. c.sendMessage("Player Must Be Offline.");
  955. }
  956. }
  957. if (playerCommand.startsWith("demote"))
  958. {
  959. try {
  960. String playerToDemote = playerCommand.substring(7);
  961. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  962. if(Server.playerHandler.players[i] != null) {
  963. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  964. Client c2 = (Client)Server.playerHandler.players[i];
  965. c2.sendMessage("You have been demoted by " + c.playerName);
  966. c2.playerRights = 0;
  967. c2.logout();
  968. break;
  969. }
  970. }
  971. }
  972. } catch(Exception e) {
  973. c.sendMessage("Player Must Be Offline.");
  974. }
  975. }
  976. /*if (playerCommand.startsWith("demote") && c.playerRights >= 3) {
  977. try {
  978. String playerToDemote = playerCommand.substring(7);
  979. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  980. if(Server.playerHandler.players[i] != null) {
  981. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  982. Client c2 = (Client)Server.playerHandler.players[i];
  983. c2.sendMessage("You have been demoted by " + c.playerName);
  984. c2.playerRights = 0;
  985. c2.logout();
  986. break;
  987. }
  988. }
  989. }
  990. } catch(Exception e) {
  991. c.sendMessage("Player Must Be Offline.");
  992. }
  993. }*/
  994. if (playerCommand.equals("xteleall") && c.playerRights >= 3) {
  995. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  996. if (Server.playerHandler.players[j] != null) {
  997. Client c2 = (Client)Server.playerHandler.players[j];
  998. c2.teleportToX = c.absX;
  999. c2.teleportToY = c.absY;
  1000. c2.heightLevel = c.heightLevel;
  1001. c2.sendMessage("Mass teleport to: " + c.playerName + "");
  1002. }
  1003. }
  1004. }
  1005. if (playerCommand.startsWith("interface") && c.playerRights >= 3) {
  1006. String[] args = playerCommand.split(" ");
  1007. c.getPA().showInterface(Integer.parseInt(args[1]));
  1008. }
  1009. if (playerCommand.startsWith("gfx") && c.playerRights >= 3) {
  1010. String[] args = playerCommand.split(" ");
  1011. c.gfx0(Integer.parseInt(args[1]));
  1012. }
  1013. if (playerCommand.startsWith("update") && c.playerRights >= 3) {
  1014. String[] args = playerCommand.split(" ");
  1015. int a = Integer.parseInt(args[1]);
  1016. PlayerHandler.updateSeconds = a;
  1017. PlayerHandler.updateAnnounced = false;
  1018. PlayerHandler.updateRunning = true;
  1019. PlayerHandler.updateStartTime = System.currentTimeMillis();
  1020. }
  1021. if(playerCommand.startsWith("npc") && c.playerRights >= 3) {
  1022. try {
  1023. int newNPC = Integer.parseInt(playerCommand.substring(4));
  1024. if(newNPC > 0) {
  1025. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  1026. c.sendMessage("You spawn a Npc.");
  1027. } else {
  1028. c.sendMessage("No such NPC.");
  1029. }
  1030. } catch(Exception e) {
  1031.  
  1032. }
  1033. }
  1034. if (playerCommand.startsWith("anim") && c.playerRights >= 3) {
  1035. String[] args = playerCommand.split(" ");
  1036. c.startAnimation(Integer.parseInt(args[1]));
  1037. c.getPA().requestUpdates();
  1038. }
  1039. if (playerCommand.startsWith("timedmute") && c.playerRights == 3) {
  1040.  
  1041. try {
  1042. String[] args = playerCommand.split(" ");
  1043. if(args.length < 2) {
  1044. c.sendMessage("Currect usage: ::timedmute playername time");
  1045. return;
  1046. }
  1047. String playerToMute = args[1];
  1048. int muteTimer = Integer.parseInt(args[2])*1000;
  1049.  
  1050. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1051. if(Server.playerHandler.players[i] != null) {
  1052. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMute)) {
  1053. Client c2 = (Client) Server.playerHandler.players[i];
  1054. c2.sendMessage("You have been muted by: " + c.playerName+" for "+muteTimer/1000+" seconds");
  1055. c2.muteEnd = System.currentTimeMillis()+ muteTimer;
  1056. break;
  1057. }
  1058. }
  1059. }
  1060.  
  1061.  
  1062. } catch(Exception e) {
  1063. c.sendMessage("Player Must Be Offline.");
  1064. }
  1065. }
  1066. if (playerCommand.startsWith("giveadmin") && c.playerRights >= 3) {
  1067. try {
  1068. String playerToAdmin = playerCommand.substring(10);
  1069. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1070. if(Server.playerHandler.players[i] != null) {
  1071. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  1072. Client c2 = (Client)Server.playerHandler.players[i];
  1073. c2.sendMessage("You have been given admin status by " + c.playerName);
  1074. c2.playerRights = 2;
  1075. c2.logout();
  1076. break;
  1077. }
  1078. }
  1079. }
  1080. } catch(Exception e) {
  1081. c.sendMessage("Player Must Be Offline.");
  1082. }
  1083. }
  1084.  
  1085. if (playerCommand.startsWith("givemod") && c.playerRights >= 3) {
  1086. try {
  1087. String playerToMod = playerCommand.substring(8);
  1088. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1089. if(Server.playerHandler.players[i] != null) {
  1090. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  1091. Client c2 = (Client)Server.playerHandler.players[i];
  1092. c2.sendMessage("You have been given mod status by " + c.playerName);
  1093. c2.playerRights = 1;
  1094. c2.logout();
  1095. break;
  1096. }
  1097. }
  1098. }
  1099. } catch(Exception e) {
  1100. c.sendMessage("Player Must Be Offline.");
  1101. }
  1102. }
  1103. if (playerCommand.startsWith("checkinv") && c.playerRights == 3) {
  1104. try {
  1105. String[] args = playerCommand.split(" ", 2);
  1106. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1107. Client o = (Client) PlayerHandler.players[i];
  1108. if (PlayerHandler.players[i] != null) {
  1109. if (PlayerHandler.players[i].playerName
  1110. .equalsIgnoreCase(args[1])) {
  1111. c.getPA().otherInv(c, o);
  1112. break;
  1113. }
  1114. }
  1115. }
  1116. } catch (Exception e) {
  1117. c.sendMessage("Player Must Be Offline.");
  1118. }
  1119. }
  1120.  
  1121.  
  1122. if (playerCommand.startsWith("xteletome") && c.playerRights == 3) {
  1123. String name = playerCommand.substring(10);
  1124. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1125. if (Server.playerHandler.players[i] != null) {
  1126. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  1127. Client c2 = (Client)Server.playerHandler.players[i];
  1128. c2.teleportToX = c.absX;
  1129. c2.teleportToY = c.absY;
  1130. c2.heightLevel = c.heightLevel;
  1131. c.sendMessage("You have teleported " + Misc.optimizeText(c2.playerName) + " to you.");
  1132. c2.sendMessage("You have been teleported to " + Misc.optimizeText(c.playerName) + ".");
  1133. }
  1134. }
  1135. }
  1136. }
  1137.  
  1138. if(playerCommand.startsWith("getnpc")) {
  1139. String a[] = playerCommand.split(" ");
  1140. String name = "";
  1141. int results = 0;
  1142. for(int i = 1; i < a.length; i++)
  1143. name = name + a[i]+ " ";
  1144. name = name.substring(0, name.length()-1);
  1145. c.sendMessage("Searching npc: " + name);
  1146. for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
  1147. if (Server.npcHandler.NpcList[j] != null)
  1148. if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  1149. c.sendMessage("<col=8000000>"
  1150. + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
  1151. + " - "
  1152. + Server.npcHandler.NpcList[j].npcId);
  1153. results++;
  1154. }
  1155. }
  1156. c.sendMessage(results + " npc's found...");
  1157. }
  1158.  
  1159. if (playerCommand.startsWith("fixinv") && c.playerRights == 3) {
  1160. c.sendMessage("You have disconnected to fix your inventory");
  1161. c.disconnected = true;
  1162. }
  1163. if(playerCommand.startsWith("openshop")) {
  1164. int shop = Integer.parseInt(playerCommand.substring(9));
  1165. c.getShops().openShop(shop);
  1166. }
  1167. if (playerCommand.startsWith("demote") && c.playerRights >= 3) {
  1168. try {
  1169. String playerToDemote = playerCommand.substring(7);
  1170. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1171. if(Server.playerHandler.players[i] != null) {
  1172. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  1173. Client c2 = (Client)Server.playerHandler.players[i];
  1174. c2.sendMessage("You have been demoted by " + c.playerName);
  1175. c2.playerRights = 0;
  1176. c2.logout();
  1177. break;
  1178. }
  1179. }
  1180. }
  1181. } catch(Exception e) {
  1182. c.sendMessage("Player Must Be Offline.");
  1183. }
  1184. }
  1185. }
  1186. }
  1187. }
Advertisement
Add Comment
Please, Sign In to add comment