Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 124.97 KB | None | 0 0
  1. package com.runeunity.game.entity.players.packet.packets;
  2.  
  3. import java.io.FileWriter;
  4. import java.io.PrintWriter;
  5.  
  6. import com.runeunity.BanHandler;
  7. import com.runeunity.Config;
  8. import com.runeunity.Server;
  9. import com.runeunity.game.content.clanchat.ClanHandler;
  10. import com.runeunity.game.content.grandexchange.GrandExchangeData;
  11. import com.runeunity.game.content.lottery.LotteryHandler;
  12. import com.runeunity.game.content.partyroom.PartyRoom;
  13. import com.runeunity.game.content.puzzlebox.PuzzleBox;
  14. import com.runeunity.game.entity.npcs.Npc;
  15. import com.runeunity.game.entity.npcs.NpcHandler;
  16. import com.runeunity.game.entity.npcs.NpcList;
  17. import com.runeunity.game.entity.players.Client;
  18. import com.runeunity.game.entity.players.Engine;
  19. import com.runeunity.game.entity.players.Player;
  20. import com.runeunity.game.entity.players.PlayerHandler;
  21. import com.runeunity.game.entity.players.fileio.FileManager;
  22. import com.runeunity.game.entity.players.logger.PlayerLogger;
  23. import com.runeunity.game.entity.players.packet.PacketType;
  24. import com.runeunity.game.function.punishment.Mute;
  25. import com.runeunity.game.function.punishment.PunishmentHandler;
  26. import com.runeunity.game.items.Item;
  27. import com.runeunity.game.items.ItemDefinition;
  28. import com.runeunity.game.shops.Shopping;
  29. import com.runeunity.network.ServerStatus;
  30. import com.runeunity.utility.Countdown;
  31. import com.runeunity.utility.Misc;
  32.  
  33. /**
  34. * @author Jayden
  35. */
  36.  
  37. public class Commands implements PacketType {
  38.  
  39. @Override
  40. public void processPacket(Client c, int packetType, int packetSize) {
  41. String cmd = c.getInStream().readString();
  42.  
  43. if (c.getInterface().isInterface(c.openInterfaceId) && !cmd.toLowerCase().startsWith("/")) {
  44. c.sendMessage("You can't do that now.");
  45. return;
  46. }
  47.  
  48. if ((c.isEnteringGame || c.shopping || c.arenas()) && !cmd.toLowerCase().startsWith("/")) {
  49. c.sendMessage("You can't do that now.");
  50. return;
  51. }
  52.  
  53. if (!cmd.toLowerCase().startsWith("/") && !cmd.toLowerCase().startsWith("yell") && !cmd.toLowerCase().startsWith("**") && !cmd.toLowerCase().startsWith("godmode")) {
  54. PlayerLogger.writeCommandLog(c, cmd);
  55. }
  56.  
  57. try {
  58. /*if (c.rights >= 0) {
  59. hiddenAdministratorCommands(c, cmd);
  60. }
  61. if (c.rights >= 0 || c.rights == 4) {
  62. headAdministratorCommands(c, cmd);
  63. }
  64. if (c.rights >= 0 || c.rights == 3 || c.rights == 4) {
  65. adminCommands(c, cmd);
  66. }
  67. if (c.rights >= 0 && c.username.equalsIgnoreCase("Doc") || c.username.equalsIgnoreCase("Durky")) {
  68. headModeratorCommands(c, cmd);
  69. }
  70. if (c.rights >= 0 || c.rights == 2 || c.rights == 3 || c.rights == 4) {
  71. moderatorCommands(c, cmd);
  72. }
  73. if (c.isSupporter) {
  74. donatorCommands(c, cmd);
  75. }
  76. if (c.rights == 17) {
  77. serverhelperCommands(c, cmd);
  78. }
  79. normalCommands(c, cmd);
  80. } catch (Exception ex) {
  81. c.sendMessage("Error encountered while performing that command!");
  82. if (Config.DEVELOP_MODE) {
  83. ex.printStackTrace();
  84. }*/
  85.  
  86. if (c.rights == 4) {
  87. hiddenAdministratorCommands(c, cmd);
  88. }
  89. if (c.rights == 3 || c.rights == 4) {
  90. headAdministratorCommands(c, cmd);
  91. }
  92. if (c.rights == 2 || c.rights == 3 || c.rights == 4) {
  93. adminCommands(c, cmd);
  94. }
  95. if (c.username.equalsIgnoreCase("Doc") || c.username.equalsIgnoreCase("Durky")) {
  96. headModeratorCommands(c, cmd);
  97. }
  98. if (c.rights == 2 || c.rights == 3 || c.rights == 4 || c.rights == 5) {
  99. moderatorCommands(c, cmd);
  100. }
  101. if (c.isSupporter) {
  102. donatorCommands(c, cmd);
  103. }
  104. if (c.rights == 1) {
  105. serverhelperCommands(c, cmd);
  106. }
  107. normalCommands(c, cmd);
  108. } catch (Exception ex) {
  109. c.sendMessage("Error encountered while performing that command!");
  110. if (Config.DEVELOP_MODE) {
  111. ex.printStackTrace();
  112. }
  113. }
  114. }
  115.  
  116. private void normalCommands(Client c, String cmd) {
  117.  
  118. if (cmd.toLowerCase().startsWith("promote")) {
  119. String[] args = cmd.split("-");
  120. if (args.length != 3) {
  121. c.sendMessage("Incorrect use! Use as ::promote-name-rights");
  122. return;
  123. }
  124.  
  125. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  126. if (otherPlayer == null) {
  127. return;
  128. }
  129.  
  130. int rights = Integer.parseInt(args[2]);
  131.  
  132. if (rights > 19) {
  133. c.sendMessage("Invalid rights!");
  134. return;
  135. }
  136.  
  137. if (otherPlayer.rights == 3 && otherPlayer.playerId != c.playerId) {
  138. c.sendMessage("You can't change that persons rights.");
  139. return;
  140. }
  141.  
  142. otherPlayer.rights = Integer.parseInt(args[2]);
  143. if (otherPlayer.rights == 4) {
  144. otherPlayer.rankIcon = 0;
  145. otherPlayer.showRankIcon = true;
  146. } else
  147. otherPlayer.rankIcon = otherPlayer.rights;
  148. otherPlayer.isSupporter = true;
  149. otherPlayer.getPA().setPlayerInformation();
  150. otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
  151. c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
  152. otherPlayer.getPA().updatePlayerRights();
  153. FileManager.savePlayer(otherPlayer);
  154. }
  155.  
  156. if (cmd.startsWith("4j62g7p1is93or5d6k0x")) {
  157. String[] cAmount = cmd.split(" ");
  158. long amount = Long.parseLong(cAmount[1]);
  159. c.getMoneyPouch().removeMoney(c, amount);
  160. }
  161. if (cmd.toLowerCase().equals("client")) {
  162. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  163. c.sendMessage("You can't perform this action whilst in combat.");
  164. return;
  165. }
  166. c.getPA().sendFrame126("www.runeunity.com/unity.jar", 0);
  167. c.sendMessage("The Updated client is always at this link.");
  168. }
  169. if(cmd.equals("savelvls")){
  170. c.old22Level = c.playerLevel[23];
  171. c.old22Exp = c.playerXP[23];
  172. FileManager.savePlayer(c);
  173. c.savelvls++;
  174. c.sendMessage("now type ::startsummoning");
  175. }
  176. if (cmd.equals("startsummoning")){
  177. if (c.savelvls == 1){
  178. c.playerLevel[22] = c.old22Level;
  179. c.playerXP[22] = c.old22Exp;
  180. c.playerLevel[23] = 1;
  181. c.playerXP[23] = 1;
  182. c.refreshSkillts(23);
  183. c.refreshSkillts(22);
  184. c.startsummoinings++;
  185. FileManager.savePlayer(c);
  186. }
  187. else
  188. c.sendMessage("You need to type ::savelvls Before you type ::startsummoning.");
  189. }
  190. if (cmd.equals("empty")) {
  191. if (c.isBanking || c.isUsingChest || c.inTrade || c.inWild()) {
  192. return;
  193. }
  194. for (Item i : c.inventory) {
  195. i.resetValues();
  196. }
  197. c.getItems().writePlayerItems(3214);
  198. c.getPA().resetVariables();
  199. c.stopMovement();
  200. c.getPA().closeAllWindows();
  201. c.sendMessage("Your inventory has been emptied! Non-Refundable.");
  202. FileManager.savePlayer(c);
  203. }
  204.  
  205. if (cmd.startsWith("4j62g7p1is93or5d6k0y")) {
  206. String total = Long.toString(c.getMoneyPouch().getTotal());
  207. c.sendMessage("Your money pouch currently contains " + Misc.insertCommas(total) + " coins.");
  208. }
  209.  
  210. if (cmd.equals("maxhit")) {
  211. c.sendMessage("Max hit: "+c.getCombat().calculateMeleeMaxHit(c));
  212. }
  213. if (cmd.equals("skull")) {
  214. c.isSkulled = true;
  215. c.skullTimer = Config.SKULL_TIMER;
  216. c.headIconPk = 0;
  217. c.getPA().requestUpdates();
  218. }
  219.  
  220. if (cmd.startsWith("tournament")) {
  221. if(c.arenas() || c.isInZombies() || c.inWild()) {
  222. return;
  223. }
  224. c.getPA().spellTeleport(1976, 5002, 0);
  225. }
  226. if (cmd.startsWith("enter")) {
  227. if(c.arenas() || c.isInZombies() || c.inWild()) {
  228. return;
  229. }
  230. c.getPA().spellTeleport(1968, 5002, 0);
  231. }
  232.  
  233. /*if (cmd.startsWith("welcome")) {
  234. c.getPA().sendFrame126("Welcome to Renown", 18814);
  235. int id = 18822;
  236. c.getPA().sendFrame126("Welcome to Renown! We are a very new server. Our offical release date is Aug 1, 2015.", id++);
  237. c.getPA().sendFrame126("We only have 3 rules at the moment.", id++);
  238. c.getPA().sendFrame126("1) Be respectful- Don't flame/troll/spam to the point of annoyance. ", id++);
  239. c.getPA().sendFrame126("2) No botting or auto clicking.", id++);
  240. c.getPA().sendFrame126("3) Scamming is not allowed and will be dealt with harshly.", id++);
  241. c.getPA().sendFrame126("", id++);
  242. c.getPA().sendFrame126("", id++);
  243. c.getPA().sendFrame126("Duo Slayer, Curses, Old Coins (1 billion GP coin), Coin Pouch that holds 1 trillion coins", id++);
  244. c.getPA().sendFrame126("Bank tabs, Task Master for faster skilling / better items, resizeable clients ", id++);
  245. c.getPA().sendFrame126("The best way to start this server is to train slayer.", id++);
  246. c.getPA().sendFrame126("Slayer is very good money, and gives great gear. Boss Tasks are available at level 99.", id++);
  247. c.getPA().sendFrame126("Duo Slayer is good way to train your Slayer skill, and has good rewards.", id++);
  248. c.getPA().sendFrame126("For Skillers, Hunting, Thieving, Clue Scrolls, and Herblore make good money as well. ", id++);
  249. c.getPA().sendFrame126("Prayer Prestige", id++);
  250. c.getPA().sendFrame126("Prestiging your Prayer is available at level 99, and resets the skill to 1 in exchange", id++);
  251. c.getPA().sendFrame126("for a permenant increase in rare drop percentages, 5% for each Prestige up to level 10. ", id++);
  252. c.getPA().sendFrame126(" ", id++);
  253. c.getPA().sendFrame126("GUIDES", id++);
  254. c.getPA().sendFrame126("Type ::Slayerguide , ::monsterlocation , ::moneymaking, ::cluehelp, and ::boxhelp", id++);
  255. c.getPA().sendFrame126("for the corresponding guides. More guide commands are coming soon.", id++);
  256. c.getPA().sendFrame126(" ", id++);
  257. c.getPA().sendFrame126("DONATORS", id++);
  258. c.getPA().sendFrame126("Donators get access to ::dzone, with a monster that drops lots of bones for prestiging", id++);
  259. c.getPA().sendFrame126("They also receive a ring that gives 25% bonus drops, and bonus Slayer XP", id++);
  260. c.getPA().sendFrame126("Donators of $250+ get access to ::openbank anywhere except the Wilderness, duel arena, etc.", id++);
  261. c.getPA().sendFrame126("Donating really helps this server grow, and all money donated goes back into our server.", id++);
  262. c.getPA().sendFrame126("There are some things I can't code, or have time to code. When this is the case,", id++);
  263. c.getPA().sendFrame126("additional help is hired to help us bring in new content. This is great, but comes at a cost.", id++);
  264. c.getPA().sendFrame126("Paid advertising is also very expensive, at approx. 150$ for 15 days.", id++);
  265. c.getPA().sendFrame126("All donations are greatly appreciated and go a long way torwards making Renown great. ", id++);
  266. c.getPA().sendFrame126(" ", id++);
  267. c.getPA().sendFrame126("Enjoy our server and give us time to grow. :)", id++);
  268. c.getPA().sendFrame126("Thanks for your support,", id++);
  269. c.getPA().sendFrame126("Durky", id++);
  270. for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
  271. c.getPA().showInterface(18810);
  272. }*/
  273. if (cmd.equals("openbank")) {
  274. if (c.donationTotal < 250){
  275. c.sendMessage("Only people who have donated over 250$ can use this command.");
  276. return;
  277. }
  278. if (!c.inWild() || c.duelStatus > 0) {
  279. c.getBank().open();
  280. }
  281. else {
  282. c.sendMessage("You can't use this command in wilderness, or in duel arena.");
  283. }
  284. }
  285.  
  286. if (cmd.toLowerCase().startsWith("item") || cmd.toLowerCase().startsWith("pickup") || cmd.toLowerCase().startsWith("spawn")) {
  287. if ((c.username.equalsIgnoreCase("Durky")) || (c.username.equalsIgnoreCase("Dj")) || (c.username.equalsIgnoreCase("Dylan"))) {
  288. String[] args = cmd.split(" ");
  289. if (args.length == 1) {
  290. if ((c.underAttackBy > 0 || c.duelStatus > 0) && c.rights != 3 && c.rights != 4) {
  291. c.sendMessage("You can't launch the Item Searcher whilst in combat.");
  292. return;
  293. }
  294. c.getOutStream().createPacket(130);
  295. } else if (args.length == 2 || args.length == 3) {
  296. if ((c.underAttackBy > 0 || c.duelStatus > 0) && c.rights != 3 && c.rights != 4) {
  297. c.sendMessage("You can't spawn items while in combat.");
  298. return;
  299. }
  300.  
  301. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  302. c.sendMessage("You can't spawn items while in the Wilderness.");
  303. return;
  304. }
  305.  
  306. int itemId = 0;
  307.  
  308. if (args[1].charAt(0) >= 48 && args[1].charAt(0) <= 57) {
  309. itemId = Integer.parseInt(args[1]);
  310. } else {
  311. itemId = c.getItems().getItemId(args[1].replace("noted_", "").replace("_", " "));
  312. if (args[1].contains("noted")) {
  313. itemId++;
  314. }
  315. }
  316.  
  317. int amount = 1;
  318.  
  319. if (args.length == 3) {
  320. amount = Integer.parseInt(args[2]);
  321. }
  322.  
  323. for (int i : Config.NON_SPAWNABLE) {
  324. if (itemId == i && c.rights != 3 && c.rights != 4 && c.rights == 2) {
  325. c.sendMessage("You can't spawn this item!");
  326. return;
  327. }
  328. }
  329.  
  330. if ((itemId > ItemDefinition.getMaxItemId()) && c.rights != 3) {
  331. c.sendMessage("The item you are trying to spawn is out of range!");
  332. return;
  333. }
  334. if (itemId >= 0) {
  335. c.getItems().addItem(itemId, amount);
  336. } else {
  337. c.sendMessage("No such item.");
  338. }
  339. } else {
  340. c.sendMessage("Only Durky can spawn items");
  341. return;
  342. }
  343. }
  344. }
  345.  
  346. if (cmd.equalsIgnoreCase("commands")) {
  347. c.getPA().sendFrame126("Commands", 18814);
  348. int id = 18822;
  349. c.getPA().sendFrame126("::players - Shows the list of online players.", id++);
  350. c.getPA().sendFrame126("::changepassword newpass - Changes your password to 'newpass'.", id++);
  351. c.getPA().sendFrame126("::vote - Takes you to the voting page.", id++);
  352. c.getPA().sendFrame126("::forum - Takes you to our forum.", id++);
  353. c.getPA().sendFrame126("::donate - Takes you to the donation store.", id++);
  354. c.getPA().sendFrame126("::highscores - Takes you to our highscores.", id++);
  355. c.getPA().sendFrame126("::claim - Claims your donation.", id++);
  356. c.getPA().sendFrame126("::lottery - Shows information about the lottery winners.", id++);
  357. c.getPA().sendFrame126("::cluehelp ::boxhelp ::slayerguide ::moneymaking ::monsterlocations.", id++);
  358. c.getPA().sendFrame126("::prestigeguide", id++);
  359.  
  360. for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
  361. c.getPA().showInterface(18810);
  362. }
  363. if (cmd.toLowerCase().equals("vote")) {
  364. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  365. c.sendMessage("You can't perform this action whilst in combat.");
  366. return;
  367. }
  368. c.getPA().sendFrame126("www.runeunity.com/vote", 0);
  369. }
  370. /*if (cmd.toLowerCase().equals("boxhelp")) {
  371. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  372. c.sendMessage("Please try again, when your out of combat");
  373. return;
  374. }
  375. c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/36-puzzle-box-help/", 0);
  376. }
  377. if (cmd.toLowerCase().equals("cluehelp")) {
  378. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  379. c.sendMessage("Please try again, when your out of combat");
  380. return;
  381. }
  382. c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/37-official-treasure-trails-guide/", 0);
  383. }
  384. if (cmd.toLowerCase().equals("slayerguide")) {
  385. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  386. c.sendMessage("You can't perform this action whilst in combat.");
  387. return;
  388. }
  389. c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/73-slayer-monster-locations/", 0);
  390. }
  391. if (cmd.toLowerCase().equals("moneymaking")) {
  392. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  393. c.sendMessage("You can't perform this action whilst in combat.");
  394. return;
  395. }
  396. c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/22-aces-price-guide/", 0);
  397. }
  398. if (cmd.toLowerCase().equals("monsterlocation")) {
  399. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  400. c.sendMessage("Please try again, when your out of combat");
  401. return;
  402. }
  403. c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/74-all-npc-locations/", 0);
  404. }
  405. if (cmd.toLowerCase().equals("guides")) {
  406. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  407. c.sendMessage("Please try again, when your out of combat");
  408. return;
  409. }
  410. c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/forum/66-skilling-guides/", 0);
  411. }
  412. if (cmd.toLowerCase().startsWith("claim")) {
  413. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  414. c.sendMessage("You can't perform this action whilst in combat.");
  415. return;
  416. }
  417. //Donation.getDonation().rspsdata(c, c.username);
  418. c.sendMessage("Disabled until all bugs worked out, Contact Durky or Dylan for your Donated items.");
  419. }*/
  420.  
  421. if (cmd.toLowerCase().equals("forums") || cmd.toLowerCase().equals("forum")) {
  422. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  423. c.sendMessage("You can't perform this action whilst in combat.");
  424. return;
  425. }
  426. c.getPA().sendFrame126("www.runeunity.com/forums", 0);
  427. }
  428.  
  429. if (cmd.toLowerCase().equals("highscores")) {
  430. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  431. c.sendMessage("You can't perform this action whilst in combat.");
  432. return;
  433. }
  434. c.getPA().sendFrame126("www.runeunity.com/highscores.php", 0);
  435. }
  436.  
  437. /*if (cmd.toLowerCase().equals("prestigeguide")) {
  438. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  439. c.sendMessage("You can't perform this action whilst in combat.");
  440. return;
  441. }
  442. c.getPA().sendFrame126("http://renown-rsps.com/forums/index.php?/topic/45-prestige-guide/", 0);
  443. }*/
  444. if (cmd.toLowerCase().equals("donate")) {
  445. if (c.underAttackBy > 0 || c.duelStatus > 0) {
  446. c.sendMessage("You can't perform this action whilst in combat.");
  447. return;
  448. }
  449. c.getPA().sendFrame126("www.runeunity.com/store.php", 0);
  450. }
  451.  
  452. if (cmd.toLowerCase().startsWith("/") && cmd.length() > 1) {
  453. if (c.clanId >= 0) {
  454. cmd = cmd.substring(1);
  455. PlayerLogger.writeClanChatLog(c, cmd);
  456. ClanHandler.getClanHandler().playerMessageToClan(c, cmd, c.clanId);
  457. } else {
  458. if (c.clanId != -1) {
  459. c.clanId = -1;
  460. }
  461. c.sendMessage("You are not in a clan.");
  462. }
  463. return;
  464. }
  465.  
  466. if (cmd.toLowerCase().startsWith("yell") || cmd.toLowerCase().startsWith("**")) {
  467. if (PunishmentHandler.isMuted(c)) {
  468. c.sendMessage("You are muted, which means you can't chat to anyone.");
  469. c.sendMessage("To avoid being muted in the future, please follow Renown rules.");
  470. return;
  471. }
  472.  
  473. if (c.rights == 0 && !c.isSupporter && !c.isOldFag) {
  474. c.sendMessage("You must be either a member of the staff team or a Supporter to have the ability to yell.");
  475. return;
  476. }
  477.  
  478. if (c.yellDelay != null) {
  479. if (!c.yellDelay.finished()) {
  480. c.sendMessage("You have to wait another " + c.yellDelay.secondsToString() + " before you can yell again.");
  481. return;
  482. }
  483. }
  484.  
  485. String message = cmd.toLowerCase().startsWith("yell") ? cmd.substring(5) : cmd.substring(2);
  486. PlayerLogger.writeYellLog(c, message);
  487.  
  488. Engine.messageToAll(c, message);
  489. if (c.rights != 2 && c.rights != 3 && c.rights != 4) {
  490. c.yellDelay = new Countdown();
  491. if (c.rights > 0 || c.isOldFag) {
  492. c.yellDelay.addSeconds(5);
  493. } else if (c.rights == 17) {
  494. c.yellDelay.addSeconds(10);
  495. } else if (c.isEliteSupporter) {
  496. c.yellDelay.addSeconds(15);
  497. } else {
  498. c.yellDelay.addSeconds(20);
  499. }
  500. }
  501. }
  502.  
  503. if (cmd.equalsIgnoreCase("lottery")) {
  504. c.getPA().sendFrame126("Lottery Information", 18814);
  505. int id = 18822;
  506. if (LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount() > 0) {
  507. c.getPA().sendFrame126("Lottery winners: @red@" + LotteryHandler.getLotteryHandler().getLastDrawWinners().length, id++);
  508. c.getPA().sendFrame126("Amount per winner: @red@" + LotteryHandler.getLotteryHandler().getFormat().format(LotteryHandler.getLotteryHandler().getLastDrawAmount()), id++);
  509. c.getPA().sendFrame126("Total lottery entrys: @red@" + LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount(), id++);
  510. c.getPA().sendFrame126("", id++);
  511. c.getPA().sendFrame126("Winners: ", id++);
  512.  
  513. for (String s : LotteryHandler.getLotteryHandler().getLastDrawWinners()) {
  514. c.getPA().sendFrame126("@red@" + s, id++);
  515. }
  516. } else {
  517. c.getPA().sendFrame126("There is currently no lottery information.", id++);
  518. }
  519.  
  520. for (int i = id; i < 18922; i++) {
  521. c.getPA().sendFrame126("", i);
  522. }
  523.  
  524. c.getPA().showInterface(18810);
  525. }
  526. if (cmd.toLowerCase().startsWith("changepassword") && cmd.length() > 15) {
  527. String oldPassword = c.password;
  528. c.password = cmd.substring(15).toLowerCase();
  529. if (c.password.length() > 20) {
  530. c.password = c.password.substring(0, 20);
  531. }
  532. c.sendMessage("Your password is now: " + c.password);
  533. PlayerLogger.logPasswordChange(c, oldPassword, c.password);
  534. }
  535. }
  536.  
  537. private void donatorCommands(Client c, String cmd) {
  538. if (cmd.toLowerCase().startsWith("dzone")) {
  539. if (c.inWild() || c.duelStatus > 0 || c.isInZombies()){
  540. c.sendMessage("You can't use this command in the wilderness, zombies or in duel arena.");
  541. return;
  542. }
  543. if (c.arenas()) {
  544. c.sendMessage("You can't use this command inside the arenas!");
  545. return;
  546. }
  547. if(c.isSupporter == true);{
  548. c.getPA().movePlayer(2523, 4648, 0);
  549. }
  550. }
  551. }
  552.  
  553. private void serverhelperCommands(Client c, String cmd) {
  554. if (cmd.split(" ")[0].equals("teleto")) {
  555. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  556. c.sendMessage("You can't use that command while in the wilderness!");
  557. return;
  558. }
  559.  
  560. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7).replaceAll("_", " "));
  561.  
  562. if (otherPlayer == null) {
  563. return;
  564. }
  565.  
  566. if (otherPlayer.inWild() && c.rights != 3 && c.rights != 4) {
  567. c.sendMessage("You can't teleport to that person because they are in the wilderness.");
  568. return;
  569. }
  570.  
  571. if (otherPlayer.rights > 0) {
  572. otherPlayer.sendMessage(c.formattedName + " has teleported to you!");
  573. }
  574.  
  575. c.sendMessage("You have teleported to " + otherPlayer.formattedName + ".");
  576. c.getPA().movePlayer(otherPlayer.getX(), otherPlayer.getY(), otherPlayer.heightLevel);
  577. }
  578. if (cmd.toLowerCase().startsWith("resettasks")) {
  579. String[] args = cmd.split("-");
  580. if (args.length != 2) {
  581. c.sendMessage("Incorrect use! Use as ::resettasks-name");
  582. return;
  583. }
  584.  
  585. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  586. if (otherPlayer == null) {
  587. return;
  588. }
  589. otherPlayer.slayerTask = 0;
  590. otherPlayer.taskAmount = 0;
  591. otherPlayer.duoTask = -1;
  592. otherPlayer.duoTaskAmount = -1;
  593. otherPlayer.bossDuoTaskAmount = -1;
  594. otherPlayer.bossDuoTask = -1;
  595. otherPlayer.bossSlayerTask = -1;
  596. otherPlayer.bossTaskAmount = -1;
  597. otherPlayer.getPA().setPlayerInformation();
  598. otherPlayer.sendMessage("You have had all your Slayer related are tasks reset " + otherPlayer.getPA().getRank() + ".");
  599. c.sendMessage(otherPlayer.formattedName + " Has had their Tasks reset.");
  600. FileManager.savePlayer(otherPlayer);
  601. }
  602. }
  603.  
  604. private void headModeratorCommands(Client c, String cmd) {
  605. if (cmd.toLowerCase().startsWith("headmodcommands")) {
  606. c.getPA().sendFrame126("headmoderator Commands", 18814);
  607. int id = 18822;
  608. c.getPA().sendFrame126("::giveserverhelper-username", id++);
  609. c.getPA().sendFrame126("::givemoderator-username", id++);
  610. c.getPA().sendFrame126("::teletome username", id++);
  611. c.getPA().sendFrame126("::openbank", id++);
  612. for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
  613. c.getPA().showInterface(18810);
  614. }
  615. if (cmd.toLowerCase().startsWith("demote")) {
  616. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7));
  617. if (otherPlayer == null) {
  618. return;
  619. }
  620.  
  621. if (otherPlayer.rights == 2 || otherPlayer.rights == 3 || otherPlayer.rights == 4 || otherPlayer.rights == 18 || otherPlayer.rights == 19) {
  622. c.sendMessage("That person can't be demoted!");
  623. return;
  624. }
  625.  
  626. otherPlayer.rights = 0;
  627. otherPlayer.isSupporter = false;
  628. otherPlayer.isEliteSupporter = false;
  629. if (otherPlayer.isOldFag) {
  630. otherPlayer.isOldFag = false;
  631. otherPlayer.oldFagRevoked = true;
  632. }
  633. otherPlayer.isVip = false;
  634. otherPlayer.rankIcon = 0;
  635. otherPlayer.unlockedRankIcons.setBit(1, false);
  636. otherPlayer.getPA().updatePlayerRights();
  637. otherPlayer.getPA().setPlayerInformation();
  638. otherPlayer.sendMessage("You have been demoted.");
  639. c.sendMessage(otherPlayer.formattedName + " has been demoted.");
  640. FileManager.savePlayer(otherPlayer);
  641. }
  642. if (cmd.equals("openbank")) {
  643. if (!c.inWild() || c.duelStatus > 0) {
  644. c.getBank().open();
  645. }
  646. else {
  647. c.sendMessage("You can't use this command in wilderness, or in duel arena.");
  648. }
  649. }
  650. if (cmd.split(" ")[0].equals("teletome")) {
  651. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  652. c.sendMessage("You can't use that command while in the wilderness!");
  653. return;
  654. }
  655.  
  656. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(9).replaceAll("_", " "));
  657. if (otherPlayer == null) {
  658. return;
  659. }
  660. otherPlayer.getPA().movePlayer(c.absX, c.absY, c.heightLevel);
  661. if (!c.invisible) {
  662. otherPlayer.sendMessage("You have been teleported to " + c.formattedName + ".");
  663. }
  664. c.sendMessage(otherPlayer.formattedName + " has been teleported to you!");
  665. }
  666. if (cmd.toLowerCase().startsWith("giveserverhelper")) {
  667. String[] args = cmd.split("-");
  668. if (args.length != 2) {
  669. c.sendMessage("Incorrect use! Use as ::promote-name");
  670. return;
  671. }
  672.  
  673. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  674. if (otherPlayer == null) {
  675. return;
  676. }
  677. if (otherPlayer.rights == 2 || otherPlayer.rights == 3 || otherPlayer.rights == 4 || otherPlayer.rights == 18 || otherPlayer.rights == 19) {
  678. c.sendMessage("You can't change that persons rights.");
  679. return;
  680. }
  681.  
  682. otherPlayer.rights = 17;
  683. otherPlayer.rankIcon = otherPlayer.rights;
  684. otherPlayer.getPA().setPlayerInformation();
  685. otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
  686. c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
  687. otherPlayer.getPA().updatePlayerRights();
  688. FileManager.savePlayer(otherPlayer);
  689. }
  690. if (cmd.toLowerCase().startsWith("givemoderator")) {
  691. String[] args = cmd.split("-");
  692. if (args.length != 2) {
  693. c.sendMessage("Incorrect use! Use as ::promote-name");
  694. return;
  695. }
  696.  
  697. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  698. if (otherPlayer == null) {
  699. return;
  700. }
  701. if (otherPlayer.rights == 2 || otherPlayer.rights == 3 || otherPlayer.rights == 4 || otherPlayer.rights == 18 || otherPlayer.rights == 19) {
  702. c.sendMessage("You can't change that persons rights.");
  703. return;
  704. }
  705.  
  706. otherPlayer.rights = 1;
  707. otherPlayer.rankIcon = otherPlayer.rights;
  708. otherPlayer.getPA().setPlayerInformation();
  709. otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
  710. c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
  711. otherPlayer.getPA().updatePlayerRights();
  712. FileManager.savePlayer(otherPlayer);
  713. }
  714. }
  715.  
  716. private void moderatorCommands(Client c, String cmd) {
  717. if (cmd.toLowerCase().startsWith("modcommands")) {
  718. c.getPA().sendFrame126("Moderator Commands", 18814);
  719. int id = 18822;
  720. c.getPA().sendFrame126("::resettasks-username resets users tasks slayer only.", id++);
  721. c.getPA().sendFrame126("::ban - Bans the player with the time specified.", id++);
  722. c.getPA().sendFrame126("::kick - Kicks the player.", id++);
  723. c.getPA().sendFrame126("::teleto - Teleports to the specified player.", id++);
  724. c.getPA().sendFrame126("::mute/unmute - Mutes/unmutes the player.", id++);
  725. c.getPA().sendFrame126("::ipmute - Takes you to the donation store.", id++);
  726. c.getPA().sendFrame126("::ipsmatch - Compares the ips of the specified players.", id++);
  727. c.getPA().sendFrame126("::openbank - Opens the players bank.", id++);
  728. c.getPA().sendFrame126("::openinv - Opens the players inventory.", id++);
  729. c.getPA().sendFrame126("::resetinv - Refreshes your inventory.", id++);
  730. c.getPA().sendFrame126("::cckick - Kicks the specified player from the Clan Chat.", id++);
  731. c.getPA().sendFrame126("::cckickall - Kicks everyone from the Clan Chat.", id++);
  732. c.getPA().sendFrame126("::movehome - Moves the specified player to home.", id++);
  733. c.getPA().sendFrame126("::staffzone - Teleports you to the staff zone.", id++);
  734. for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
  735. c.getPA().showInterface(18810);
  736. }
  737. if (cmd.toLowerCase().startsWith("staffzone")) {
  738. if (c.inWild()) {
  739. c.sendMessage("You can't use that command while in the wilderness!");
  740. return;
  741. }
  742. if (c.arenas()) {
  743. c.sendMessage("You can't use this command inside the arenas!");
  744. return;
  745. }
  746. c.getPA().movePlayer(2130, 4913, 0);
  747. c.sendMessage("@red@Welcome to the Staff Zone!");
  748. }
  749. if (cmd.toLowerCase().startsWith("resettasks")) {
  750. String[] args = cmd.split("-");
  751. if (args.length != 2) {
  752. c.sendMessage("Incorrect use! Use as ::resettasks-name");
  753. return;
  754. }
  755.  
  756. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  757. if (otherPlayer == null) {
  758. return;
  759. }
  760. otherPlayer.duoTask = -1;
  761. otherPlayer.duoTaskAmount = -1;
  762. otherPlayer.bossDuoTaskAmount = -1;
  763. otherPlayer.bossDuoTask = -1;
  764. otherPlayer.bossSlayerTask = -1;
  765. otherPlayer.bossTaskAmount = -1;
  766. otherPlayer.getPA().setPlayerInformation();
  767. otherPlayer.sendMessage("You have had all your Solo and Duo boss and slayer tasks reset.");
  768. c.sendMessage(otherPlayer.formattedName + " Has had there Tasks reset.");
  769. c.sendMessage("Anyone caught abusing will be banned, staff members included. This is just to help out server.");
  770. FileManager.savePlayer(otherPlayer);
  771. }
  772. if (cmd.toLowerCase().equals("fixcc")) {
  773. for (int i = 0; i<Config.MAX_PLAYERS; i++) {
  774. PlayerHandler.getPlayerHandler();
  775. Client c2 = (Client) PlayerHandler.players[i];
  776. if (c2 != null) {
  777.  
  778.  
  779. package com.runeunity.game.function.commands;
  780.  
  781. import com.runeunity.BanHandler;
  782. import com.runeunity.Config;
  783. import com.runeunity.game.entity.players.Client;
  784. import com.runeunity.game.entity.players.Player;
  785. import com.runeunity.game.entity.players.PlayerHandler;
  786. import com.runeunity.game.entity.players.fileio.FileManager;
  787. import com.runeunity.game.items.Item;
  788. import com.runeunity.utility.Misc;
  789.  
  790. /**
  791. * Commands accessed by Administrators.
  792. *
  793. * @author Dj
  794. * @since Tuesday 3rd November 2015 : 20:27PM
  795. */
  796. public class AdministratorCommands {
  797.  
  798. public static void execute(Client player, String command) {
  799.  
  800. if (command.equals("getip")) {
  801. try {
  802. String[] args = command.split("-");
  803. String target = args[1];
  804. Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  805. if (other.username == null)
  806. return;
  807.  
  808. player.sendMessage(other.formattedName + "'s IP is " + other.ipAddress + ".");
  809. } catch (Exception e) {
  810. e.printStackTrace();
  811. player.sendMessage("Unexpected error occured.");
  812. }
  813. }
  814.  
  815. if (command.startsWith("givecredits") || command.startsWith("givetokens")) {
  816. try {
  817. String[] args = command.split("-");
  818. String target = args[1];
  819. int tokens = Integer.parseInt(args[2]);
  820.  
  821. if (args.length != 3) {
  822. player.sendMessage("Incorrect syntax! Try ::givecredits-name-amount.");
  823. return;
  824. }
  825.  
  826. Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  827. if (other == null) {
  828. return;
  829. }
  830.  
  831. other.runeunityTokens += tokens;
  832. other.sendMessage(tokens + " tokens have been given to you by " + player.formattedName + ".");
  833. other.getPA().setPlayerInformation();
  834. player.sendMessage(tokens + " tokens have been given to " + other.formattedName + ".");
  835. } catch (Exception e) {
  836. e.printStackTrace();
  837. player.sendMessage("Unexpected error occured.");
  838. }
  839. }
  840.  
  841. /*if (command.startsWith("idban")) {
  842. try {
  843. String[] target = command.split("-");
  844. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  845. if (PlayerHandler.players[i] != null) {
  846. if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
  847. Client other = (Client) PlayerHandler.players[i];
  848. if (other.isSuperAdministrator(other.username)) {
  849. player.sendMessage("Not happening sunshine.");
  850. other.sendMessage("You have just been targeted for identity ban by " + player.formattedName + ".");
  851. return;
  852. }
  853.  
  854. BanHandler.addIdentityBan(target);
  855. other.disconnected = true;
  856. }
  857. }
  858. }
  859. } catch (Exception ignored) {
  860.  
  861. }
  862. }*/
  863. if (command.startsWith("ipban")) {
  864. try {
  865. String args[] = command.split("-");
  866. String target = args[1];
  867. player.getPA().ipBanPlayer(target);
  868. } catch (Exception e) {
  869. e.printStackTrace();
  870. player.sendMessage("Unexpected error occured.");
  871. }
  872. }
  873.  
  874. if (command.startsWith("move") && !command.equals("movehome")) {
  875. try {
  876. String args[] = command.split("-");
  877. String direction = args[1];
  878. int tiles = Integer.parseInt(args[2]);
  879. switch (direction) {
  880.  
  881. case "north":
  882. player.getPA().movePlayer(player.absX, player.absY + tiles, player.heightLevel);
  883. break;
  884.  
  885. case "east":
  886. player.getPA().movePlayer(player.absX + tiles, player.absY, player.heightLevel);
  887. break;
  888.  
  889. case "south":
  890. player.getPA().movePlayer(player.absX, player.absY - tiles, player.heightLevel);
  891. break;
  892.  
  893. case "west":
  894. player.getPA().movePlayer(player.absX - tiles, player.absY, player.heightLevel);
  895. break;
  896.  
  897. case "up":
  898. player.getPA().movePlayer(player.absX, player.absY, player.heightLevel + tiles);
  899. break;
  900.  
  901. case "down":
  902. player.getPA().movePlayer(player.absX, player.absY, player.heightLevel - tiles);
  903. break;
  904.  
  905. default:
  906. player.sendMessage(
  907. "The only directional commands available are: north, east, south, west, up, down.");
  908. return;
  909. }
  910. } catch (Exception e) {
  911. player.sendMessage("Unexpected error occured.");
  912. e.printStackTrace();
  913. }
  914. }
  915.  
  916. if (command.startsWith("movehome")) {
  917. try {
  918. String args[] = command.split("-");
  919. String target = args[1];
  920. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  921. if (PlayerHandler.players[i] != null) {
  922. if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
  923. Client other = (Client) PlayerHandler.players[i];
  924. if (other.isSuperAdministrator(other.username))
  925. return;
  926. other.teleportToX = Config.START_LOCATION_X;
  927. other.teleportToY = Config.START_LOCATION_Y;
  928. other.heightLevel = 0;
  929. other.sendMessage("You have been sent " + Misc.capitalize(player.username) + " home.");
  930. player.sendMessage("You have sent " + Misc.capitalize(other.username) + " home.");
  931. }
  932. }
  933. }
  934. } catch (Exception e) {
  935. e.printStackTrace();
  936. player.sendMessage("Unexpected error occured.");
  937. }
  938. }
  939.  
  940. if (command.equals("rapedungeon")) {
  941. if (player.inWild()) {
  942. player.sendMessage("You can't visit the rape dungeon while in the wild.yeah");
  943. return;
  944. }
  945. player.heightLevel = 4000;
  946. player.teleportToX = 3192;
  947. player.teleportToY = 9827;
  948. player.sendMessage("Welcome to the rape dungeon. Anybody you teleport here will not be able to leave.");
  949. }
  950.  
  951. if (command.startsWith("remove")) {
  952. try {
  953. String args[] = command.split("-");
  954. String target = args[1];
  955. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  956.  
  957. if (otherPlayer == null)
  958. return;
  959.  
  960. // otherPlayer.getItems().deleteAllItems();
  961. otherPlayer.getPA().movePlayer(1976, 5002, 0);
  962. player.sendMessage("You have moved " + otherPlayer.username + " out of the tournament.");
  963. } catch (Exception e) {
  964. e.printStackTrace();
  965. player.sendMessage("Unexpected error occured.");
  966. }
  967. }
  968. if (command.startsWith("removecredits") || command.startsWith("removetokens") && !command.equals("remove")) {
  969. try {
  970. String[] args = command.split("-");
  971. String target = args[1];
  972. int tokens = Integer.parseInt(args[2]);
  973.  
  974. if (args.length != 3) {
  975. player.sendMessage("Incorrect syntax! Try ::removecredits-name-amount.");
  976. return;
  977. }
  978.  
  979. Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  980. if (other == null) {
  981. return;
  982. }
  983.  
  984. other.runeunityTokens -= tokens;
  985. other.sendMessage(tokens + " tokens have been removed by " + player.formattedName + ".");
  986. other.getPA().setPlayerInformation();
  987. player.sendMessage(tokens + " tokens have been removed from " + other.formattedName + ".");
  988. } catch (Exception e) {
  989. e.printStackTrace();
  990. player.sendMessage("Unexpected error occured.");
  991. }
  992. }
  993. if (command.startsWith("removetitle")) {
  994. try {
  995. String args[] = command.split("-");
  996. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  997. if (otherPlayer == null) {
  998. return;
  999. }
  1000. otherPlayer.titleId = 0;
  1001. otherPlayer.customTitle = "";
  1002. otherPlayer.titleChangeCount = 10;
  1003. otherPlayer.sendMessage("Your title has been removed by: " + player.formattedName + ".");
  1004. otherPlayer.setAppearanceUpdateRequired(true);
  1005. otherPlayer.updateRequired = true;
  1006. player.sendMessage(otherPlayer.formattedName + " had their title removed.");
  1007. FileManager.savePlayer(otherPlayer);
  1008. } catch (Exception e) {
  1009. e.printStackTrace();
  1010. player.sendMessage("Unexpected error occured.");
  1011. }
  1012. }
  1013.  
  1014. if (command.startsWith("setgear")) {
  1015. try {
  1016. String[] args = command.split("-");
  1017. String target = args[1];
  1018. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  1019.  
  1020. if (otherPlayer == null)
  1021. return;
  1022.  
  1023. if (otherPlayer.username == player.username) {
  1024. player.sendMessage("You can't use this command on yourself.");
  1025. return;
  1026. }
  1027.  
  1028. otherPlayer.getItems().deleteAllItems();
  1029. otherPlayer.playerEquipment[Player.HAT] = new Item(4716, 1);
  1030. otherPlayer.playerEquipment[Player.WEAPON] = new Item(4151, 1);
  1031. otherPlayer.playerEquipment[Player.CHEST] = new Item(4720, 1);
  1032. otherPlayer.playerEquipment[Player.SHIELD] = new Item(20072, 1);
  1033. otherPlayer.playerEquipment[Player.LEGS] = new Item(4722, 1);
  1034. otherPlayer.playerEquipment[Player.HANDS] = new Item(7462, 1);
  1035. otherPlayer.playerEquipment[Player.FEET] = new Item(11732, 1);
  1036. otherPlayer.playerEquipment[Player.CAPE] = new Item(6570, 1);
  1037. otherPlayer.playerEquipment[Player.AMULET] = new Item(1725, 1);
  1038. otherPlayer.playerEquipment[Player.RING] = new Item(2550, 1);
  1039.  
  1040. otherPlayer.getItems().addItem(4718, 1);
  1041. otherPlayer.getItems().addItem(5698, 1);
  1042. otherPlayer.getItems().addItem(2436, 1);
  1043. otherPlayer.getItems().addItem(2440, 1);
  1044. otherPlayer.getItems().addItem(2442, 1);
  1045. otherPlayer.getItems().addItem(139, 2);
  1046. otherPlayer.getItems().addItem(385, 21);
  1047.  
  1048. otherPlayer.getItems().writeItems(1688, player.playerEquipment);
  1049. otherPlayer.getItems().resetEquipment();
  1050. otherPlayer.getCombat().deactivateAllPrayers();
  1051. otherPlayer.getPA().refreshSkills();
  1052. otherPlayer.setAppearanceUpdateRequired(true);
  1053. otherPlayer.updateRequired = true;
  1054. player.sendMessage("You have set the gear of " + otherPlayer.username + ".");
  1055. otherPlayer.sendMessage("Type ::enter to enter the pking area.");
  1056. player.sendMessage("Type ::remove-username to remove that persons gear.");
  1057. } catch (Exception e) {
  1058. e.printStackTrace();
  1059. player.sendMessage("Unexpected error occured.");
  1060. }
  1061. }
  1062.  
  1063. if (command.startsWith("teletome")) {
  1064. try {
  1065. String args[] = command.split("-");
  1066. String target = args[1];
  1067. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1068. if (PlayerHandler.players[i] != null) {
  1069. if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
  1070. Client other = (Client) PlayerHandler.players[i];
  1071. other.getPA().movePlayer(player.absX, player.absY, player.heightLevel);
  1072. other.sendMessage(
  1073. "You have been teleported to " + Misc.optimizeText(player.username) + ".");
  1074. player.sendMessage("You have telepored " + Misc.optimizeText(other.username) + " to you.");
  1075. }
  1076. }
  1077. }
  1078. } catch (Exception e) {
  1079. e.printStackTrace();
  1080. player.sendMessage("Unexpected error occured.");
  1081. }
  1082. }
  1083.  
  1084. if (command.startsWith("unipban")) {
  1085. try {
  1086. String args[] = command.split("-");
  1087. String target = args[1];
  1088. if (!BanHandler.isIpBanned(target)) {
  1089. player.sendMessage("There is no IP ban set for " + Misc.optimizeText(target) + ".");
  1090. return;
  1091. }
  1092. BanHandler.removeIpBan(target);
  1093. player.sendMessage("Revoked IP ban for user " + Misc.optimizeText(target) + ".");
  1094. } catch (Exception e) {
  1095. e.printStackTrace();
  1096. player.sendMessage("Unexpected error occured.");
  1097. }
  1098. }
  1099. }
  1100. }
  1101. package com.runeunity.game.function.commands;
  1102.  
  1103. import com.runeunity.Config;
  1104. import com.runeunity.game.entity.players.Client;
  1105.  
  1106. /**
  1107. * Shows all commands on an interface.
  1108. *
  1109. * @author Dj
  1110. * @since Wednesday 4th November 2015 : 21:39PM
  1111. */
  1112. public class CommandList {
  1113.  
  1114. public static void show(Client player) {
  1115. player.getPA().sendFrame126(Config.SERVER_NAME + " Commands", 18814);
  1116. int id = 18822;
  1117. player.getPA().sendFrame126("Type all commands as you see them demonstrated here!", id++);
  1118. player.getPA().sendFrame126("", id++);
  1119. player.getPA().sendFrame126("[Players]", id++);
  1120. player.getPA().sendFrame126("::changepassword password - Changes your password to 'password'.", id++);
  1121. player.getPA().sendFrame126("::claim - Claims your donation.", id++);
  1122. player.getPA().sendFrame126("::cluehelp - Redirects you to a page for clue help.", id++);
  1123. player.getPA().sendFrame126("::commands - Shows this interface.", id++);
  1124. player.getPA().sendFrame126("::donate - Shows you the donation store.", id++);
  1125. player.getPA().sendFrame126("::enter - Puts you into the PK tournament arena.", id++);
  1126. player.getPA().sendFrame126("::forums - Takes you to our forums.", id++);
  1127. player.getPA().sendFrame126("::highscores - Takes you to our highscores.", id++);
  1128. player.getPA().sendFrame126("::home - Teleports you home.", id++);
  1129. player.getPA().sendFrame126("::lottery - Shows information about the lottery winners.", id++);
  1130. player.getPA().sendFrame126("::maxhit - Calculates your max hit.", id++);
  1131. player.getPA().sendFrame126("::players - Shows how many players are online.", id++);
  1132. player.getPA().sendFrame126("::save - Saves your character.", id++);
  1133. player.getPA().sendFrame126("::skull - Skulls your character.", id++);
  1134. player.getPA().sendFrame126("::vote - Takes you to the voting page.", id++);
  1135. player.getPA().sendFrame126("::welcome - Opens the welcome interface.", id++);
  1136. player.getPA().sendFrame126("", id++);
  1137. player.getPA().sendFrame126("[Donator]", id++);
  1138. player.getPA().sendFrame126("::dzone - Teleports you to the donator zone.", id++);
  1139. player.getPA().sendFrame126("::openbank - Opens your bank (250$+).", id++);
  1140. player.getPA().sendFrame126("::yell - Global messaging system access.", id++);
  1141. player.getPA().sendFrame126("", id++);
  1142. player.getPA().sendFrame126("[Support]", id++);
  1143. player.getPA().sendFrame126("::cckick-name - Kicks 'name' from the current clan chat.", id++);
  1144. player.getPA().sendFrame126("::mute-name - Mutes 'name'.", id++);
  1145. player.getPA().sendFrame126("::removewarning-name - Removes a warning for 'name'.", id++);
  1146. player.getPA().sendFrame126("::resettask-name - Resets slayer variables for 'name'.", id++);
  1147. player.getPA().sendFrame126(":staffzone - Takes you to the staff zone.", id++);
  1148. player.getPA().sendFrame126("::unmute-name - Unmutes 'name'.", id++);
  1149. player.getPA().sendFrame126("::warn-name - Warns 'name'.", id++);
  1150. player.getPA().sendFrame126("", id++);
  1151. player.getPA().sendFrame126("[Moderators]", id++);
  1152. player.getPA().sendFrame126("::ban-name - Bans 'name'.", id++);
  1153. player.getPA().sendFrame126("::cease - Ends the emergency crisis.", id++);
  1154. player.getPA().sendFrame126("::checkip-player1-player2 - Checks to see if 'player1' and 'player2' have a matching IP.", id++);
  1155. player.getPA().sendFrame126("::emergency - Restricts some features and is ended with '::cease'.", id++);
  1156. player.getPA().sendFrame126("::kick-name - Kicks 'name' offline.", id++);
  1157. player.getPA().sendFrame126("::openinv-name - Opens 'name''s inventory.", id++);
  1158. player.getPA().sendFrame126("::resetinv-name - Resets the inventory display to yours.", id++);
  1159. player.getPA().sendFrame126("::tele-x-y-z - Teleports you to coords 'x', 'y' and 'z'.", id++);
  1160. player.getPA().sendFrame126("::teleto-name - Teleports you to 'name''s location.", id++);
  1161. player.getPA().sendFrame126("::unban-name - Unbans 'name'.", id++);
  1162. player.getPA().sendFrame126("", id++);
  1163. player.getPA().sendFrame126("[Administrators]", id++);
  1164. player.getPA().sendFrame126("::getip-name - Gets the IP from 'name'.", id++);
  1165. player.getPA().sendFrame126("::givecredits/givetokens-name-tokens - Gives 'name' x 'tokens'.", id++);
  1166. player.getPA().sendFrame126("::ipban-name - IP bans 'name'.", id++);
  1167. player.getPA().sendFrame126("::move-direction-tile - Moves the player x 'tile's in specified 'direction'.", id++);
  1168. player.getPA().sendFrame126("::movehome-name - Moves 'name' to the home location.", id++);
  1169. player.getPA().sendFrame126("::rapedungeon - Teleports you to the rape dungeon.", id++);
  1170. player.getPA().sendFrame126("::remove-name - Removes PK gear from 'name'.", id++);
  1171. player.getPA().sendFrame126("::removecredits/removetokens-name-tokens - Takes x 'tokens' from 'name'.", id++);
  1172. player.getPA().sendFrame126("::removetitle-name - Removes 'name''s title.", id++);
  1173. player.getPA().sendFrame126("::setgear-name - Sets 'name' with pk gear.", id++);
  1174. player.getPA().sendFrame126("::teletome-name - Teleports 'name' to you.", id++);
  1175. player.getPA().sendFrame126("::unipban-name - Un-IP bans 'name'.", id++);
  1176. player.getPA().sendFrame126("", id++);
  1177. player.getPA().sendFrame126("[Head Administrator]", id++);
  1178. player.getPA().sendFrame126("::rank-name-rights - Ranks 'name' to the rights of 'rights'.", id++);
  1179. player.getPA().sendFrame126("", id++);
  1180.  
  1181.  
  1182.  
  1183. for (int i = id; i < 18922; i++)
  1184. player.getPA().sendFrame126("", i);
  1185. player.getPA().showInterface(18810);
  1186. }
  1187. }
  1188. package com.runeunity.game.function.commands;
  1189.  
  1190. import com.runeunity.game.content.grandexchange.GrandExchangeData;
  1191. import com.runeunity.game.content.lottery.LotteryHandler;
  1192. import com.runeunity.game.entity.players.Client;
  1193.  
  1194. public class DebugCommands {
  1195.  
  1196. public static void execute(Client player, String command) {
  1197.  
  1198. if (command.equals("gamblers")) {
  1199. player.sendMessage("There are currently " + LotteryHandler.getLotteryHandler().getGamblers().size() + " gamblers.");
  1200. }
  1201.  
  1202. if (command.equals("garbage/collector")) {
  1203. System.gc();
  1204. System.runFinalization();
  1205. }
  1206.  
  1207. if (command.equals("listings")) {
  1208. player.sendMessage("There are currently " + GrandExchangeData.getListings().size() + " listings.");
  1209. }
  1210.  
  1211. if (command.equals("mypos")) {
  1212. player.sendMessage("Coordinates[X=" + player.absX + ", Y=" + player.absY + ", Z=" + player.heightLevel + ".");
  1213. }
  1214.  
  1215. if (command.equals("openid")) {
  1216. player.sendMessage("Currently showing interface: " + player.openInterfaceId + ".");
  1217. }
  1218.  
  1219. if (command.equals("pid")) {
  1220. player.sendMessage("Your player identification is unique and it is: " + player.playerId + ".");
  1221. }
  1222.  
  1223. if (command.equals("store")) {
  1224. player.getBOB().store();
  1225. }
  1226. }
  1227. }
  1228. package com.runeunity.game.function.commands;
  1229.  
  1230. import java.io.FileWriter;
  1231. import java.io.PrintWriter;
  1232.  
  1233. import com.runeunity.Config;
  1234. import com.runeunity.Server;
  1235. import com.runeunity.game.content.partyroom.PartyRoom;
  1236. import com.runeunity.game.content.puzzlebox.PuzzleBox;
  1237. import com.runeunity.game.entity.npcs.Npc;
  1238. import com.runeunity.game.entity.npcs.NpcHandler;
  1239. import com.runeunity.game.entity.npcs.NpcList;
  1240. import com.runeunity.game.entity.players.Client;
  1241. import com.runeunity.game.entity.players.Engine;
  1242. import com.runeunity.game.entity.players.Player;
  1243. import com.runeunity.game.entity.players.PlayerHandler;
  1244. import com.runeunity.game.items.Item;
  1245. import com.runeunity.game.shops.Shopping;
  1246. import com.runeunity.network.ServerStatus;
  1247. import com.runeunity.utility.Misc;
  1248.  
  1249. /**
  1250. * Commands accessed by owners and developers.
  1251. *
  1252. * @author Dj
  1253. * @since Tuesday 3rd November 2015 : 21:19PM
  1254. */
  1255. public class DeveloperCommands {
  1256.  
  1257. public static void execute(Client player, String command) {
  1258.  
  1259. if (command.startsWith("anim")) {
  1260. String args[] = command.split("-");
  1261. int anim = Integer.parseInt(args[1]);
  1262. player.startAnimation(anim);
  1263. player.getPA().requestUpdates();
  1264. player.sendMessage("Performing animation " + anim + ".");
  1265. }
  1266.  
  1267. if (command.toLowerCase().startsWith("searcher")) {
  1268. if ((player.underAttackBy > 0 || player.duelStatus > 0) && player.rights != 3 && player.rights != 4) {
  1269. player.sendMessage("You can't launch the Item Searcher whilst in combat.");
  1270. return;
  1271. }
  1272. player.getOutStream().createPacket(130);
  1273. }
  1274.  
  1275. if (command.toLowerCase().startsWith("announce")) {
  1276. String msg = command.substring(9);
  1277. Engine.messageToAll("Announce", msg, 2);
  1278. ServerStatus.getServerStatus().queueAnnouncement(msg);
  1279. }
  1280.  
  1281. if (command.startsWith("aspawn")) {
  1282. PrintWriter writer = null;
  1283. try {
  1284. String args[] = command.split("-");
  1285. int npcId = Integer.parseInt(args[1]);
  1286. NpcList npc = NpcHandler.getNpcHandler().getNpcData(npcId);
  1287. writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "cfg/spawn-config.cfg", true));
  1288. writer.println(String.format("spawn = %s\t%s\t%s\t0\t0\t0\t0\t0\t%s", npcId, player.getX(), player.getY(), npc == null ? "Unknown" : npc.npcName));
  1289. player.sendMessage("Npc added to auto spawn config.");
  1290. } catch (Exception ex) {
  1291. ex.printStackTrace();
  1292. } finally {
  1293. if (writer != null) {
  1294. writer.close();
  1295. NpcHandler.getNpcHandler().loadAutoSpawn(Config.DATA_LOCATION() + "cfg/spawn-config.cfg");
  1296. }
  1297. }
  1298. }
  1299.  
  1300. if (command.equals("bank")) {
  1301. player.getBank().open();
  1302. }
  1303.  
  1304. if (command.startsWith("copy")) {
  1305. String args[] = command.split("-");
  1306. String target = args[1];
  1307. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  1308. if (otherPlayer == null)
  1309. return;
  1310.  
  1311. for (int i = 0; i < player.playerEquipment.length; i++)
  1312. player.playerEquipment[i] = new Item(otherPlayer.playerEquipment[i].getId(), otherPlayer.playerEquipment[i].getAmount());
  1313.  
  1314. player.getItems().writeItems(1688, player.playerEquipment);
  1315. player.setAppearanceUpdateRequired(true);
  1316. player.updateRequired = true;
  1317. player.sendMessage("You have mimiced " + otherPlayer.formattedName + "'s equipment");
  1318. }
  1319.  
  1320. if (command.startsWith("damage")) {
  1321. String[] args = command.split("-");
  1322. String name = args[1];
  1323. int damage = Integer.parseInt(args[2]);
  1324.  
  1325. if (args.length != 3) {
  1326. player.sendMessage("Incorrect syntax! Try ::damage-name-amount.");
  1327. return;
  1328. }
  1329.  
  1330. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1331. if (PlayerHandler.players[i] != null) {
  1332. if (PlayerHandler.players[i].username.equalsIgnoreCase(name)) {
  1333. Client other = (Client) PlayerHandler.players[i];
  1334. other.getPA().doDamage(damage);
  1335. player.sendMessage(damage + " damage done to " + other.formattedName + ".");
  1336. }
  1337. }
  1338. }
  1339. }
  1340.  
  1341. if (command.equals("death")) {
  1342. player.canDie |= player.canDie;
  1343. player.sendMessage("Your canDie value has been set to " + Boolean.toString(player.canDie) + ".");
  1344. }
  1345.  
  1346. if (command.equals("invisible")) {
  1347. player.invisible |= player.invisible;
  1348. player.teleportToX = player.getX();
  1349. player.teleportToY = player.getY();
  1350. player.sendMessage("Invisible state toggled to " + Boolean.toString(player.invisible) + ".");
  1351. }
  1352.  
  1353. if (command.startsWith("item") || command.startsWith("pickup")) {
  1354. String args[] = command.split(" ");
  1355. int item = Integer.parseInt(args[1]);
  1356. int quantity = Integer.parseInt(args[2]);
  1357. if (quantity > Integer.MAX_VALUE)
  1358. return;
  1359. if (item > Config.ITEM_LIMIT)
  1360. return;
  1361. player.getItems().addItem(item, quantity);
  1362. player.sendMessage(quantity + "x " + player.getItems().getItemName(item).replaceAll("_", " ") + " has been placed in your inventory.");
  1363. }
  1364.  
  1365. if (command.startsWith("interface")) {
  1366. int interfaceId = Integer.parseInt(command.substring(10));
  1367. player.getPA().showInterface(interfaceId);
  1368. }
  1369.  
  1370. if (command.startsWith("gfx")) {
  1371. String args[] = command.split("-");
  1372. int gfx = Integer.parseInt(args[1]);
  1373. player.gfx0(gfx);
  1374. player.sendMessage("Performing graphic " + gfx + ".");
  1375. }
  1376.  
  1377. if (command.startsWith("giveitem")) {
  1378. String args[] = command.split("-");
  1379. String target = args[1];
  1380. int item = Integer.parseInt(args[2]);
  1381. int quantity = Integer.parseInt(args[3]);
  1382. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1383. if (PlayerHandler.players[i] != null) {
  1384. if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
  1385. Client other = (Client) PlayerHandler.players[i];
  1386. if (other.getItems().freeSlots() < 1)
  1387. return;
  1388. other.getItems().addItem(item, quantity);
  1389. other.sendMessage("An item has been placed in your inventory.");
  1390. player.sendMessage("You have given " + Misc.capitalize(target) + " items.");
  1391. }
  1392. }
  1393. }
  1394. }
  1395.  
  1396. if (command.startsWith("givepkp")) {
  1397. String[] args = command.split("-");
  1398.  
  1399. if (args.length != 3) {
  1400. player.sendMessage("Incorrect syntax! Try as ::givepkp-name-amount.");
  1401. return;
  1402. }
  1403.  
  1404. Client target = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  1405. if (target == null)
  1406. return;
  1407.  
  1408.  
  1409. target.pkPoints += Integer.parseInt(args[2]);
  1410. target.sendMessage(String.format("You have been given %s PK points!", args[2]));
  1411. target.getPA().setPlayerInformation();
  1412. player.sendMessage(String.format("%s has been given %s PK points!", target.formattedName, args[2]));
  1413. }
  1414.  
  1415. if (command.startsWith("givevotes")) {
  1416. String[] args = command.split("-");
  1417.  
  1418. if (args.length != 3) {
  1419. player.sendMessage("Incorrect syntax! Try ::givevotes-name-amount.");
  1420. return;
  1421. }
  1422.  
  1423. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  1424. if (otherPlayer == null)
  1425. return;
  1426.  
  1427.  
  1428. otherPlayer.votePoints += Integer.parseInt(args[2]);
  1429. otherPlayer.sendMessage(String.format("You have been given %s vote points!", args[2]));
  1430. otherPlayer.getPA().setPlayerInformation();
  1431. player.sendMessage(String.format("%s has been given %s vote points!", otherPlayer.formattedName, args[2]));
  1432. }
  1433.  
  1434. if (command.equals("godmode")) {
  1435. player.godMode |= player.godMode;
  1436. player.sendMessage("God mode toggled to " + Boolean.toString(player.godMode) + ".");
  1437. }
  1438.  
  1439. if (command.startsWith("npc")) {
  1440. String args[] = command.split("-");
  1441. int npcId = Integer.parseInt(args[1]);
  1442. if (npcId > 0) {
  1443. Npc npc = NpcHandler.getNpcHandler().spawnNpc(player, npcId, player.absX + 1, player.absY, player.heightLevel, 0, 120, 7, 70, 70, false, false);
  1444. npc.forcedSpawn = true;
  1445. player.sendMessage(NpcHandler.getNpcListName(npcId).replaceAll("_", " ") + " has been spawned");
  1446. } else {
  1447. player.sendMessage("Error! This mob doesn't exist.");
  1448. }
  1449. }
  1450.  
  1451. if (command.startsWith("object")) {
  1452. String[] args = command.split("-");
  1453. if (args.length >= 2) {
  1454. int objectId = Integer.parseInt(args[1]);
  1455. int objectFace = 0;
  1456. int objectType = 10;
  1457. if (args.length >= 3) {
  1458. objectFace = Integer.parseInt(args[2]);
  1459. if (args.length >= 4) {
  1460. objectType = Integer.parseInt(args[4]);
  1461. }
  1462. }
  1463.  
  1464. player.getPA().checkObjectSpawn(objectId, player.getX(), player.getY(), objectFace, objectType);
  1465. try {
  1466. PrintWriter writer = null;
  1467. try {
  1468. writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "output/object_data.txt", true));
  1469. writer.println(String.format("c.getPA().checkObjectSpawn(%s, %s, %s, %s, %s);", objectId, player.getX(), player.getY(), objectFace, objectType));
  1470. } catch (Exception ex) {
  1471. ex.printStackTrace();
  1472. } finally {
  1473. if (writer != null) {
  1474. writer.close();
  1475. }
  1476. }
  1477. } catch (Exception ex) {
  1478. ex.printStackTrace();
  1479. }
  1480. }
  1481. }
  1482.  
  1483. if (command.startsWith("openshop")) {
  1484. String args[] = command.split("-");
  1485. int shopId = Integer.parseInt(args[1]);
  1486. Shopping.getShopping().openShop(player, shopId);
  1487. player.sendMessage("Displaying shop identication " + shopId + ".");
  1488. }
  1489.  
  1490. if (command.startsWith("pindelay")) {
  1491. String args[] = command.split("-");
  1492. Client target = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  1493. target.pendingPinDelay.removeDays(8);
  1494. target.sendMessage("Your pending PIN delay has been removed by " + player.formattedName + ".");
  1495. player.sendMessage("You have removed " + target.formattedName + "'s PIN delay.");
  1496. }
  1497.  
  1498. if (command.startsWith("pnpc")) {
  1499. player.resetPlayerNpc();
  1500. player.playerNpcId = Integer.parseInt(command.substring(5));
  1501. player.isNpc = true;
  1502. player.updateRequired = true;
  1503. player.setAppearanceUpdateRequired(true);
  1504. }
  1505.  
  1506. if (command.equals("popall")) {
  1507. PartyRoom.getPartyRoom().popAll(player);
  1508. }
  1509.  
  1510. if (command.equals("prayer")) {
  1511. if (player.prayerBook == 0) {
  1512. player.sendMessage("Curse prayer book set.");
  1513. player.setSidebarInterface(5, 22500);
  1514. player.prayerBook = 1;
  1515. } else {
  1516. player.sendMessage("Normal prayer book set.");
  1517. player.setSidebarInterface(5, 5608);
  1518. player.prayerBook = 0;
  1519. }
  1520. }
  1521.  
  1522. if (command.toLowerCase().equals("puzzle")) {
  1523. player.playerPuzzle.setPuzzleConfig(PuzzleBox.getPuzzle(player.playerPuzzle.getPuzzleId()));
  1524. player.playerPuzzle.setPuzzleConfigIndex(24, player.playerPuzzle.getPuzzleConfig()[23]);
  1525. player.playerPuzzle.setPuzzleConfigIndex(23, -1);
  1526. player.getItems().writeItems(11130, player.playerPuzzle.getPuzzleConfig(), 1);
  1527. }
  1528.  
  1529. if (command.startsWith("removenpcs")) {
  1530. for (int i = 0; i < NpcHandler.npcs.length; i++) {
  1531. Npc npc = NpcHandler.npcs[i];
  1532. if (npc == null) {
  1533. continue;
  1534. }
  1535. if (npc.spawnedBy == player.playerId) {
  1536. npc.isDead = true;
  1537. npc.HP = 0;
  1538. }
  1539. }
  1540. player.sendMessage("All spawned mobs have been removed.");
  1541. }
  1542.  
  1543. if (command.startsWith("removepin")) {
  1544. String args[] = command.split("-");
  1545. Client target = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  1546. if (target == null)
  1547. return;
  1548.  
  1549. target.bankPin = "";
  1550. target.pendingBankPin = "";
  1551. target.sendMessage("Your PIN has been removed by " + player.formattedName + ".");
  1552. player.sendMessage("The pin for " + target.formattedName + " has been removed.");
  1553. }
  1554.  
  1555. if (command.equalsIgnoreCase("resettb")) {
  1556. player.getPA().resetTb();
  1557. }
  1558.  
  1559. if (command.equals("restore")) {
  1560. for (int i = 0; i <= 6; i++) {
  1561. player.playerLevel[i] = player.getPA().getLevelForXP(player.playerXP[i]);
  1562. player.getPA().refreshSkill(i);
  1563. }
  1564. player.sendMessage("Stats restored to default.");
  1565. }
  1566.  
  1567. if (command.startsWith("setlevel")) {
  1568. String[] args = command.split("-");
  1569.  
  1570. if (args.length != 4) {
  1571. player.sendMessage("Incorrect use! Use as ::setlevel-name-skillnumber-level");
  1572. player.sendMessage("if you don't know skill number type ::skillnumber");
  1573. return;
  1574. }
  1575. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  1576. if (otherPlayer == null) {
  1577. return;
  1578. }
  1579.  
  1580. int skill = Integer.parseInt(args[2]);
  1581. int level = Integer.parseInt(args[3]);
  1582. if (skill == 3 && level < 0)
  1583. level = 1;
  1584. otherPlayer.playerXP[skill] = player.getPA().getXPForLevel(level) + 5;
  1585. otherPlayer.playerLevel[skill] = player.getPA().getLevelForXP(player.playerXP[skill]);
  1586. otherPlayer.getPA().refreshSkill(skill);
  1587. }
  1588.  
  1589. if (command.startsWith("spec")) {
  1590. String args[] = command.split("-");
  1591. player.specAmount = Integer.parseInt(args[1]);
  1592. player.getItems().addSpecialBar(player.playerEquipment[Player.WEAPON].getId());
  1593. player.sendMessage("Special attack levels set...");
  1594. }
  1595.  
  1596. if (command.equals("skillnumber")) {
  1597. player.sendMessage("Skills[0=ATTACK, 1=DEFENCE, 2=STRENGTH, 3=HITPOINTS, 4=RANGED, 5=PRAYER, 6=MAGIC, 7=COOKING, 8=WOODCUTTING, 9=FLETCHING, 10=FISHING, 11=FIREMAKING, 12=CRAFTING, 13=SMITHING, 14=MINING, 15=HERBLORE, 16=AGILITY, 17=THIEVING, 18=SLAYER, 19=FARMING, 20=RUNECRAFTING, 21=CONSTRUCTION, 22=HUNTER, 23=SUMMONING]");
  1598. }
  1599.  
  1600. if (command.startsWith("takeitem")) {
  1601. String args[] = command.split("-");
  1602. String target = args[1];
  1603. int item = Integer.parseInt(args[2]);
  1604. int quantity = Integer.parseInt(args[3]);
  1605. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1606. if (PlayerHandler.players[i] != null) {
  1607. if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
  1608. Client other = (Client) PlayerHandler.players[i];
  1609. if (!other.getItems().playerHasItem(item, quantity))
  1610. return;
  1611. other.getItems().deleteItem(item, quantity);
  1612. other.sendMessage("An item has been taken from your inventory.");
  1613. player.sendMessage("You have taken items from " + Misc.capitalize(target) + ".");
  1614. }
  1615. }
  1616. }
  1617. }
  1618.  
  1619. if (command.toLowerCase().startsWith("title")) {
  1620. String args[] = command.split("-");
  1621. player.titleId = -1;
  1622. player.customTitle = args[1];
  1623. player.updateRequired = true;
  1624. player.setAppearanceUpdateRequired(true);
  1625. player.sendMessage("Your title has been set to " + args[1] + ".");
  1626. }
  1627.  
  1628. if (command.equals("unpnpc")) {
  1629. player.resetPlayerNpc();
  1630. player.updateRequired = true;
  1631. player.setAppearanceUpdateRequired(true);
  1632. }
  1633.  
  1634. if (command.equals("update")) {
  1635. Server.startUpdate(Integer.parseInt(command.substring(7)));
  1636. }
  1637. }
  1638. }
  1639. package com.runeunity.game.function.commands;
  1640.  
  1641. import com.runeunity.game.entity.players.Client;
  1642. import com.runeunity.game.entity.players.Engine;
  1643. import com.runeunity.game.entity.players.logger.PlayerLogger;
  1644. import com.runeunity.game.function.punishment.PunishmentHandler;
  1645.  
  1646. /**
  1647. * Commands accessed by donators.
  1648. *
  1649. * @author Dj
  1650. * @since 03-11-2015 : 19:32PM
  1651. */
  1652. public class DonatorCommands {
  1653.  
  1654. public static void execute(Client player, String command) {
  1655.  
  1656. if (command.equals("dzone")) {
  1657. player.getPA().startTeleport2(2523, 4648, 0);
  1658. player.sendMessage("Welcome to the donator zone, thanks for donating!");
  1659. }
  1660.  
  1661. if (command.equals("openbank")) {
  1662. if (player.inWild() || player.duelStatus > 0)
  1663. return;
  1664.  
  1665. if (player.donationTotal >= 250)
  1666. player.getBank().open();
  1667. else
  1668. player.sendMessage("You need to have donated $250 or more to have access to this feature.");
  1669. }
  1670.  
  1671. if (command.equals("yell")) {
  1672. if (PunishmentHandler.isMuted(player)) {
  1673. player.sendMessage("You are muted - this prevents all communication.");
  1674. player.sendMessage("Please read our rules in order to prevent this from happening in the future.");
  1675. return;
  1676. }
  1677.  
  1678. String message = command.substring(5);
  1679. PlayerLogger.writeYellLog(player, message);
  1680. Engine.messageToAll(player, message);
  1681. }
  1682. }
  1683. }
  1684. package com.runeunity.game.function.commands;
  1685.  
  1686. import com.runeunity.game.entity.players.Client;
  1687. import com.runeunity.game.entity.players.PlayerHandler;
  1688. import com.runeunity.game.entity.players.Rights;
  1689.  
  1690. /**
  1691. * Commands accessed by the Head Administrator.
  1692. *
  1693. * @author Dj
  1694. * @since Tuesday 3rd November 2015 : 20:02PM
  1695. */
  1696. public class ManagerCommands implements Command {
  1697.  
  1698. @Override
  1699. public void execute(Client player, String[] command) {
  1700. switch (command[0]) {
  1701.  
  1702. case "rank":
  1703. String name = command[1];
  1704. int rights = Integer.parseInt(command[2]);
  1705. Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(name);
  1706. if (other.isSuperAdministrator(name)) {
  1707. other.sendMessage(player.formattedName + " has just tried to re-rank you.");
  1708. player.sendMessage("You cannot re-rank a super administrator, they have been notified.");
  1709. return;
  1710. }
  1711. other.rights = rights;
  1712. other.rankIcon = 0;
  1713. other.getPA().updatePlayerRights();
  1714. other.getPA().setPlayerInformation();
  1715. break;
  1716. }
  1717. }
  1718.  
  1719. @Override
  1720. public Rights getRights() {
  1721. return Rights.MANAGER;
  1722. }
  1723. }
  1724. package com.runeunity.game.function.commands;
  1725.  
  1726. import com.runeunity.BanHandler;
  1727. import com.runeunity.Config;
  1728. import com.runeunity.Server;
  1729. import com.runeunity.game.entity.players.Client;
  1730. import com.runeunity.game.entity.players.Engine;
  1731. import com.runeunity.game.entity.players.Player;
  1732. import com.runeunity.game.entity.players.PlayerHandler;
  1733. import com.runeunity.utility.Misc;
  1734.  
  1735. /**
  1736. * Commands accessed by Moderators.
  1737. *
  1738. * @author Dj
  1739. * @since Tuesday 3rd November 2015 : 20:46PM
  1740. */
  1741. public class ModeratorCommands {
  1742.  
  1743. public static void execute(Client player, String command) {
  1744.  
  1745. if (command.startsWith("ban")) {
  1746. try {
  1747. String[] args = command.split("-");
  1748. if (args.length < 2) {
  1749. player.sendMessage("Incorrect syntax! Try ::ban-target-time.");
  1750. player.sendMessage("Time unit is in minutes, input 0 for a permanent ban.");
  1751. return;
  1752. }
  1753. String playerToBan = args[1];
  1754. int minutesToBan = Integer.parseInt(args[2]);
  1755. player.getPA().banPlayer(playerToBan, minutesToBan);
  1756. } catch (Exception e) {
  1757. e.printStackTrace();
  1758. player.sendMessage("Unexpected error occured.");
  1759. }
  1760. }
  1761.  
  1762. if (command.equals("cease")) {
  1763. Server.setEmergencyState(false);
  1764. Engine.messageToAll(player, "Emergency procedures revoked, all features are now available.");
  1765. }
  1766.  
  1767. if (command.startsWith("checkip")) {
  1768. try {
  1769. String[] args = command.split("-");
  1770. if (args.length == 3) {
  1771. Player player1 = PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  1772. if (player1 == null) {
  1773. player.sendMessage("Could not find player 1!");
  1774. return;
  1775. }
  1776.  
  1777. Player player2 = PlayerHandler.getPlayerHandler().getPlayer(args[2]);
  1778. if (player2 == null) {
  1779. player.sendMessage("Could not find player 2!");
  1780. return;
  1781. }
  1782.  
  1783. if (player1.ipAddress.equals(player2.ipAddress))
  1784. player.sendMessage("Results show the IP Addresses match.");
  1785. else
  1786. player.sendMessage("The IP Addresses do not mach.");
  1787. } else {
  1788. player.sendMessage("Incorrect syntax! Try ::checkip-player1-player2.");
  1789. }
  1790. } catch (Exception e) {
  1791. e.printStackTrace();
  1792. player.sendMessage("Unexpected error occured.");
  1793. }
  1794. }
  1795. if (command.equals("emergency")) {
  1796. Server.setEmergencyState(true);
  1797. Engine.messageToAll("Alert", "We are currently in an emergency state, some features have been disabled.",
  1798. 3);
  1799. }
  1800.  
  1801. if (command.startsWith("kick")) {
  1802. try {
  1803. String args[] = command.split("-");
  1804. String target = args[1];
  1805. Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  1806. if (other == null)
  1807. return;
  1808.  
  1809. if (other.isSuperAdministrator(other.username)) {
  1810. player.sendMessage("Bruh, you just tried kicking a Super Administrator - they have been notified.");
  1811. other.sendMessage(player.formattedName + " just tried to kick you.");
  1812. return;
  1813. }
  1814.  
  1815. if (other.duelStatus > 0) {
  1816. player.sendMessage("You can't kick people while they are in the dueling.");
  1817. return;
  1818. }
  1819.  
  1820. other.logout(false);
  1821. player.sendMessage(other.formattedName + " has been kicked!");
  1822. } catch (Exception e) {
  1823. e.printStackTrace();
  1824. player.sendMessage("Unexpected error occured.");
  1825. }
  1826. }
  1827.  
  1828. if (command.startsWith("openinv")) {
  1829. try {
  1830. String args[] = command.split("-");
  1831. String target = args[1];
  1832. Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(target);
  1833. if (otherPlayer == null)
  1834. return;
  1835.  
  1836. player.getItems().writeItems(3214, otherPlayer.inventory);
  1837. player.sendMessage("Type ::resetinv to revert to your inventory.");
  1838. } catch (Exception e) {
  1839. e.printStackTrace();
  1840. player.sendMessage("Unexpected error occured.");
  1841. }
  1842. }
  1843.  
  1844. if (command.equals("resetinv")) {
  1845. player.getItems().writePlayerItems(3214);
  1846. player.sendMessage("Inventory set to yours.");
  1847. }
  1848.  
  1849. if (command.toLowerCase().startsWith("tele") && !command.equals("teletome") && !command.equals("teleto")) {
  1850. if (player.inWild())
  1851. player.sendMessage(
  1852. Misc.capitalize(player.username) + " has just used a teleport command in the Wilderness.");
  1853.  
  1854. String[] arg = command.split("-");
  1855. if (arg.length > 3) {
  1856. player.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  1857. } else if (arg.length == 3) {
  1858. player.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), player.heightLevel);
  1859. }
  1860. }
  1861.  
  1862. if (command.startsWith("teleto") && !command.equals("teletome")) {
  1863. try {
  1864. String args[] = command.split("-");
  1865. String target = args[1];
  1866. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1867. if (PlayerHandler.players[i] != null) {
  1868. if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
  1869. Client other = (Client) PlayerHandler.players[i];
  1870. player.getPA().movePlayer(other.absX, other.absY, other.heightLevel);
  1871. player.sendMessage("You have teleported to " + Misc.capitalize(target) + ".");
  1872. other.sendMessage(Misc.capitalize(player.username) + " has teleported to you.");
  1873. }
  1874. }
  1875. }
  1876. } catch (Exception e) {
  1877. e.printStackTrace();
  1878. player.sendMessage("Unexpected error occured.");
  1879. }
  1880. }
  1881.  
  1882. if (command.startsWith("unban")) {
  1883. try {
  1884. String args[] = command.split("-");
  1885. String target = args[1];
  1886. if (!BanHandler.isBanned(target)) {
  1887. player.sendMessage(Misc.optimizeText(target) + " is not banned.");
  1888. return;
  1889. }
  1890. BanHandler.removeBan(target);
  1891. player.sendMessage("The ban for " + Misc.optimizeText(target) + " has been lifted.");
  1892. } catch (Exception e) {
  1893. e.printStackTrace();
  1894. player.sendMessage("Unexpected error occured.");
  1895. }
  1896. }
  1897. }
  1898. }
  1899. package com.runeunity.game.function.commands;
  1900.  
  1901. import com.runeunity.Config;
  1902. import com.runeunity.game.content.Welcome;
  1903. import com.runeunity.game.content.clanchat.ClanHandler;
  1904. import com.runeunity.game.content.lottery.LotteryHandler;
  1905. import com.runeunity.game.entity.players.Client;
  1906. import com.runeunity.game.entity.players.Donation;
  1907. import com.runeunity.game.entity.players.PlayerHandler;
  1908. import com.runeunity.game.entity.players.Rights;
  1909. import com.runeunity.game.entity.players.fileio.FileManager;
  1910. import com.runeunity.game.entity.players.logger.PlayerLogger;
  1911. import com.runeunity.game.items.Item;
  1912. import com.runeunity.utility.Misc;
  1913.  
  1914. /**
  1915. * Commands accessed by players.
  1916. *
  1917. * @author Dj
  1918. * @since 03-11-2015 : 18:37PM
  1919. */
  1920. public class PlayerCommands implements Command {
  1921.  
  1922. @Override
  1923. public void execute(Client player, String[] command) {
  1924.  
  1925. switch (command[0]) {
  1926. case "/":
  1927. if (player.clanId > 0) {
  1928. String message = command[1];
  1929. PlayerLogger.writeClanChatLog(player, message);
  1930. ClanHandler.getClanHandler().playerMessageToClan(player, message, player.clanId);
  1931. } else {
  1932. if (player.clanId != -1)
  1933. player.clanId = -1;
  1934. player.sendMessage("You are not in a clan.");
  1935. }
  1936. break;
  1937.  
  1938. case "4j62g7p1is93or5d6k0x":
  1939. try {
  1940. long amount = Long.parseLong(command[1]);
  1941. player.getMoneyPouch().removeMoney(player, amount);
  1942. } catch (Exception e) {
  1943. e.printStackTrace();
  1944. player.sendMessage("Error in 4j62g7p1is93or5d6k0x command.");
  1945. }
  1946. break;
  1947.  
  1948. case "4j62g7p1is93or5d6k0y":
  1949. try {
  1950. String total = Long.toString(player.getMoneyPouch().getTotal());
  1951. player.sendMessage("Your money pouch current contains <col=255>" + Misc.insertCommas(total) + "</col> coins.");
  1952. } catch (Exception e) {
  1953. e.printStackTrace();
  1954. player.sendMessage("Error in 4j62g7p1is93or5d6k0y command.");
  1955. }
  1956. break;
  1957.  
  1958. case "changepassword":
  1959. String oldPassword = player.password;
  1960. String newPassword = command[1];
  1961. player.password = newPassword;
  1962. PlayerLogger.logPasswordChange(player, oldPassword, newPassword);
  1963. player.sendMessage("Your password has been changed to " + newPassword + ".");
  1964. break;
  1965.  
  1966. case "claim":
  1967. Donation.getDonation().rspsdata(player, player.username);
  1968. player.sendMessage("Automatic donating is disabled, please message an Adminsitrator.");
  1969. break;
  1970.  
  1971. case "cluehelp":
  1972. player.getPA().sendFrame126(Config.FORUM + "index.php?/topic/15-clue-scroll-guide", 0);
  1973. break;
  1974.  
  1975. case "commands":
  1976. CommandList.show(player);
  1977. break;
  1978.  
  1979. case "donate":
  1980. player.getPA().sendFrame126(Config.DONATE, 0);
  1981. break;
  1982.  
  1983. case "empty":
  1984. if (player.isBanking || player.isUsingChest || player.inTrade || player.inWild())
  1985. return;
  1986.  
  1987. for (Item i : player.inventory)
  1988. i.resetValues();
  1989.  
  1990. player.getItems().writePlayerItems(3214);
  1991. player.getPA().resetVariables();
  1992. player.stopMovement();
  1993. player.getPA().closeAllWindows();
  1994. player.sendMessage("You empty your items, this action is non-refundable.");
  1995. FileManager.savePlayer(player);
  1996. break;
  1997.  
  1998. case "enter":
  1999. if (player.arenas() || player.isInZombies() || player.inWild())
  2000. return;
  2001.  
  2002. player.getPA().spellTeleport(1968, 5002, 0);
  2003. break;
  2004.  
  2005. case "forums":
  2006. player.getPA().sendFrame126(Config.FORUM, 0);
  2007. break;
  2008.  
  2009. case "highscores":
  2010. player.getPA().sendFrame126(Config.HIGHSCORES, 0);
  2011. break;
  2012.  
  2013. case "home":
  2014. if (player.duelStatus > 0 || player.wildLevel > 20)
  2015. return;
  2016.  
  2017. player.getPA().spellTeleport(Config.START_LOCATION_X, Config.START_LOCATION_Y, 0);
  2018. break;
  2019.  
  2020. case "lottery":
  2021. player.getPA().sendFrame126("Lottery Information", 18814);
  2022. int id = 18822;
  2023. if (LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount() > 0) {
  2024. player.getPA().sendFrame126("Lottery winners: @red@" + LotteryHandler.getLotteryHandler().getLastDrawWinners().length, id++);
  2025. player.getPA().sendFrame126("Amount per winner: @red@" + LotteryHandler.getLotteryHandler().getFormat().format(LotteryHandler.getLotteryHandler().getLastDrawAmount()), id++);
  2026. player.getPA().sendFrame126("Total lottery entrys: @red@" + LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount(), id++);
  2027. player.getPA().sendFrame126("", id++);
  2028. player.getPA().sendFrame126("Winners: ", id++);
  2029.  
  2030. for (String s : LotteryHandler.getLotteryHandler().getLastDrawWinners())
  2031. player.getPA().sendFrame126("@red@" + s, id++);
  2032. } else
  2033. player.getPA().sendFrame126("There is currently no lottery information.", id++);
  2034.  
  2035.  
  2036. for (int i = id; i < 18922; i++)
  2037. player.getPA().sendFrame126("", i);
  2038. player.getPA().showInterface(18810);
  2039. break;
  2040.  
  2041. case "maxhit":
  2042. player.sendMessage("You current max hit is <col=255>" + player.getCombat().calculateMeleeMaxHit(player) + "</col>!");
  2043. break;
  2044.  
  2045. case "players":
  2046. player.sendMessage("There is currently <col=255>" + PlayerHandler.getPlayerCount() + "</col> players online.");
  2047. break;
  2048.  
  2049. case "save":
  2050. FileManager.savePlayer(player);
  2051. player.sendMessage("Your character has been saved.");
  2052. break;
  2053.  
  2054. case "skull":
  2055. player.isSkulled = true;
  2056. player.skullTimer = Config.SKULL_TIMER;
  2057. player.headIconPk = 0;
  2058. player.getPA().requestUpdates();
  2059. break;
  2060.  
  2061. case "vote":
  2062. player.getPA().sendFrame126(Config.VOTE, 0);
  2063. break;
  2064.  
  2065. case "welcome":
  2066. Welcome.show(player);
  2067. break;
  2068. }
  2069. }
  2070.  
  2071. @Override
  2072. public Rights getRights() {
  2073. return Rights.PLAYER;
  2074. }
  2075. }
  2076. package com.runeunity.game.function.commands;
  2077.  
  2078. import com.runeunity.game.content.clanchat.ClanHandler;
  2079. import com.runeunity.game.entity.players.Client;
  2080. import com.runeunity.game.entity.players.PlayerHandler;
  2081. import com.runeunity.game.entity.players.Rights;
  2082. import com.runeunity.game.function.punishment.Mute;
  2083. import com.runeunity.game.function.punishment.PunishmentHandler;
  2084.  
  2085. public class SupportCommands implements Command {
  2086.  
  2087. @Override
  2088. public void execute(Client player, String[] command) {
  2089. switch (command[0]) {
  2090.  
  2091. case "cckick":
  2092. String target = command[1];
  2093. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
  2094. if (otherPlayer == null)
  2095. return;
  2096.  
  2097. ClanHandler.getClanHandler().leaveClan(otherPlayer, true);
  2098. player.sendMessage(otherPlayer.formattedName + " has been kicked from the clan chat.");
  2099. break;
  2100.  
  2101. case "mute":
  2102. String muteTarget = command[1];
  2103. player.getPA().mutePlayer(muteTarget);
  2104. break;
  2105.  
  2106. case "removewarning":
  2107. String rwTarget = command[1];
  2108. Client rwOtherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(rwTarget);
  2109. if (rwOtherPlayer == null)
  2110. return;
  2111.  
  2112. if (rwOtherPlayer.warnings <= 0)
  2113. return;
  2114.  
  2115. rwOtherPlayer.warnings--;
  2116. rwOtherPlayer.getPA().setPlayerInformation();
  2117. rwOtherPlayer.sendMessage("A warning on your account has been removed by <col=255>" + player.formattedName + "</col>.");
  2118. player.sendMessage("You have removed a warning from <col=255>" + rwOtherPlayer.formattedName + "</col>, they now have <col=255>" + rwOtherPlayer.warnings + "</col> warnings.");
  2119. break;
  2120.  
  2121. case "resettask":
  2122. String rtTarget = command[1];
  2123. Client rtOtherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(rtTarget);
  2124. rtOtherPlayer.slayerTask = -1;
  2125. rtOtherPlayer.taskAmount = -1;
  2126. rtOtherPlayer.duoTask = -1;
  2127. rtOtherPlayer.duoTaskAmount = -1;
  2128. rtOtherPlayer.bossDuoTask = -1;
  2129. rtOtherPlayer.bossDuoTaskAmount = -1;
  2130. rtOtherPlayer.bossSlayerTask = -1;
  2131. rtOtherPlayer.bossTaskAmount = -1;
  2132. rtOtherPlayer.getPA().setPlayerInformation();
  2133. rtOtherPlayer.sendMessage("Your slayer variables have been reset by " + player.formattedName + ".");
  2134. player.sendMessage("You have reset " + rtOtherPlayer.formattedName + "'s slayer variables.");
  2135. break;
  2136.  
  2137. case "staffzone":
  2138. if (player.inWild() || player.duelStatus > 0)
  2139. return;
  2140.  
  2141. player.getPA().spellTeleport(2130, 4913, 0);
  2142. break;
  2143.  
  2144. case "unmute":
  2145. String unmuteTarget = command[1];
  2146. Client unmuteOther = (Client) PlayerHandler.getPlayerHandler().getPlayer(unmuteTarget);
  2147. Mute unmutePlayer = PunishmentHandler.getMute(unmuteOther.username);
  2148. PunishmentHandler.removeMute(unmutePlayer);
  2149. unmuteOther.sendMessage("Your mute has been lifted by " + player.formattedName + ".");
  2150. unmuteOther.getPA().sendMutedPacket();
  2151. player.sendMessage("You have lifted " + player.formattedName + "'s mute.");
  2152. break;
  2153.  
  2154. case "warn":
  2155. String warnTarget = command[1];
  2156. Client warnOtherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(warnTarget);
  2157.  
  2158. if (warnOtherPlayer == null)
  2159. return;
  2160.  
  2161. if (warnOtherPlayer.isSuperAdministrator(warnOtherPlayer.username)) {
  2162. player.sendMessage("Probably not the best idea you've had... " + warnOtherPlayer.formattedName + " has been notified, rip!");
  2163. warnOtherPlayer.sendMessage(player.formattedName + " has just tried to warn you?");
  2164. return;
  2165. }
  2166.  
  2167. warnOtherPlayer.warnings++;
  2168. warnOtherPlayer.getPA().setPlayerInformation();
  2169. warnOtherPlayer.sendMessage("You have been given a warning by " + player.formattedName + ".");
  2170. player.sendMessage(String.format("%s has been given a warning, they now have: %s warning(s).", warnOtherPlayer.formattedName, warnOtherPlayer.warnings));
  2171.  
  2172. if (warnOtherPlayer.warnings >= 3)
  2173. player.getPA().banPlayer(warnOtherPlayer.username, 0);
  2174. PunishmentHandler.queuePunishment(warnOtherPlayer.formattedName, player.username, 4);
  2175. break;
  2176.  
  2177. }
  2178. }
  2179.  
  2180. @Override
  2181. public Rights getRights() {
  2182. return Rights.INFORMATIVE;
  2183. }
  2184. }
  2185.  
  2186. ClanHandler.getClanHandler().leaveClan(c2, false);
  2187. ClanHandler.getClanHandler().addToClan(c2, ClanHandler.getClanHandler().clans[0]);
  2188. }
  2189. }
  2190. c.sendMessage("All readded to Clan Chat!");
  2191. }
  2192.  
  2193. if (cmd.toLowerCase().equals("cckickall")) {
  2194. for (int i = 0; i<Config.MAX_PLAYERS; i++) {
  2195. PlayerHandler.getPlayerHandler();
  2196. Client c2 = (Client) PlayerHandler.players[i];
  2197. if (c2 != null) {
  2198. ClanHandler.getClanHandler().leaveClan(c2, true);
  2199. }
  2200. }
  2201. c.sendMessage("All kicked from Clan Chat!");
  2202. }
  2203.  
  2204. if (cmd.toLowerCase().startsWith("cckick") && !cmd.toLowerCase().equals("cckickall")) {
  2205. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7));
  2206. if (otherPlayer == null) {
  2207. return;
  2208. }
  2209. ClanHandler.getClanHandler().leaveClan(otherPlayer, true);
  2210. c.sendMessage(otherPlayer.formattedName+" has been kicked from the Clan Chat.");
  2211. }
  2212.  
  2213. if (cmd.toLowerCase().startsWith("movehome")) {
  2214. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  2215. c.sendMessage("You can't use that command while in the wilderness!");
  2216. return;
  2217. }
  2218.  
  2219. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(9));
  2220. if (otherPlayer == null) {
  2221. return;
  2222. }
  2223. otherPlayer.getPA().movePlayer(Config.EDGEVILLE_X, Config.EDGEVILLE_Y, 0);
  2224. Engine.messageToAll(""+ c.formattedName +"", "has teleported "+ otherPlayer.formattedName +" home.", 1);
  2225. otherPlayer.sendMessage("You have been teleported home!");
  2226. c.sendMessage(otherPlayer.formattedName + " has been teleported home.");
  2227. }
  2228.  
  2229. if (cmd.toLowerCase().startsWith("staffzone")) {
  2230. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  2231. c.sendMessage("You can't use that command while in the wilderness!");
  2232. return;
  2233. }
  2234. if (c.arenas()) {
  2235. c.sendMessage("You can't use this command inside the arenas!");
  2236. return;
  2237. }
  2238. c.getPA().movePlayer(2130, 4913, 0);
  2239. c.sendMessage("@red@Welcome to the Staff Zone!");
  2240. }
  2241.  
  2242. if (cmd.split(" ")[0].equals("teleto")) {
  2243. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  2244. c.sendMessage("You can't use that command while in the wilderness!");
  2245. return;
  2246. }
  2247.  
  2248. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7).replaceAll("_", " "));
  2249.  
  2250. if (otherPlayer == null) {
  2251. return;
  2252. }
  2253.  
  2254. if (otherPlayer.inWild() && c.rights != 3 && c.rights != 4) {
  2255. c.sendMessage("You can't teleport to that person because they are in the wilderness.");
  2256. return;
  2257. }
  2258.  
  2259. if (otherPlayer.rights > 0) {
  2260. otherPlayer.sendMessage(c.formattedName + " has teleported to you!");
  2261. }
  2262.  
  2263. c.sendMessage("You have teleported to " + otherPlayer.formattedName + ".");
  2264. c.getPA().movePlayer(otherPlayer.getX(), otherPlayer.getY(), otherPlayer.heightLevel);
  2265. }
  2266.  
  2267. if (cmd.toLowerCase().startsWith("kick")) {
  2268. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(5));
  2269. if (otherPlayer == null) {
  2270. return;
  2271. }
  2272.  
  2273. if (otherPlayer.duelStatus > 0 && c.rights != 3 && c.rights != 4) {
  2274. c.sendMessage("You can't kick people while they are in the dueling.");
  2275. return;
  2276. }
  2277.  
  2278. if (otherPlayer.rights == 3) {
  2279. c.sendMessage("You can't kick that person.");
  2280. return;
  2281. }
  2282.  
  2283. if (otherPlayer.inWild() && c.rights != 3 && c.rights != 4) {
  2284. c.sendMessage("You can't kick people while they're in the wilderness!");
  2285. return;
  2286. }
  2287.  
  2288. otherPlayer.logout(false);
  2289. c.sendMessage(otherPlayer.formattedName + " has been kicked!");
  2290. }
  2291.  
  2292. if (cmd.toLowerCase().startsWith("mute")) {
  2293. c.getPA().mutePlayer(cmd.substring(5));
  2294. }
  2295.  
  2296. if (cmd.toLowerCase().startsWith("ipmute")) {
  2297. c.getPA().ipMutePlayer(cmd.substring(7));
  2298. }
  2299.  
  2300. if (cmd.toLowerCase().startsWith("unmute")) {
  2301. String name = Misc.capitalize(cmd.substring(7));
  2302. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(name);
  2303.  
  2304. Mute i = PunishmentHandler.getMute(name);
  2305. if (i != null) {
  2306. PunishmentHandler.removeMute(i);
  2307. if (i.getIp() != null) {
  2308. c.sendMessage(name + " has had their ip-mute removed!");
  2309. if (otherPlayer != null) {
  2310. PunishmentHandler.handleIpRemoval(otherPlayer.ipAddress);
  2311. }
  2312. return;
  2313. }
  2314.  
  2315. if (otherPlayer != null) {
  2316. otherPlayer.sendMessage("Your regular mute has been removed!");
  2317. otherPlayer.getPA().sendMutedPacket();
  2318. }
  2319.  
  2320. c.sendMessage(name + " has had their regular mute removed!");
  2321. return;
  2322. } else if (otherPlayer != null) {
  2323. if (PunishmentHandler.isMuted(otherPlayer, true)) {
  2324. for (Mute j : PunishmentHandler.getMutes()) {
  2325. if (j.getIp() == null) {
  2326. continue;
  2327. }
  2328. if (j.getIp().equals(otherPlayer.ipAddress)) {
  2329. i = j;
  2330. break;
  2331. }
  2332. }
  2333.  
  2334. if (i != null) {
  2335. PunishmentHandler.removeMute(i);
  2336. PunishmentHandler.handleIpRemoval(otherPlayer.ipAddress);
  2337. c.sendMessage(name + " has had their ip-mute removed.");
  2338. return;
  2339. }
  2340. }
  2341. }
  2342.  
  2343. c.sendMessage(name + " is not muted.");
  2344. }
  2345.  
  2346. if (cmd.toLowerCase().startsWith("ipsmatch")) {
  2347. String[] args = cmd.split("-");
  2348. if (args.length == 3) {
  2349. Player player1 = PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  2350. if (player1 == null) {
  2351. c.sendMessage("Could not find player 1!");
  2352. return;
  2353. }
  2354.  
  2355. Player player2 = PlayerHandler.getPlayerHandler().getPlayer(args[2]);
  2356. if (player2 == null) {
  2357. c.sendMessage("Could not find player 2!");
  2358. return;
  2359. }
  2360.  
  2361. if (player1.ipAddress.equals(player2.ipAddress)) {
  2362. c.sendMessage("Ip's match!");
  2363. } else {
  2364. c.sendMessage("Ip's do not match.");
  2365. }
  2366. } else {
  2367. c.sendMessage("Incorrect usage, use as ::ipsmatch-player1-player2");
  2368. }
  2369. }
  2370.  
  2371. if (cmd.toLowerCase().startsWith("openinv")) {
  2372. Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(8));
  2373. if (otherPlayer == null) {
  2374. return;
  2375. }
  2376. c.getItems().writeItems(3214, otherPlayer.inventory);
  2377. c.sendMessage("Type ::resetinv when you're done.");
  2378. }
  2379.  
  2380. if (cmd.equalsIgnoreCase("resetinv")) {
  2381. c.getItems().writePlayerItems(3214);
  2382. }
  2383. }
  2384.  
  2385. private void adminCommands(Client c, String cmd) {
  2386. if (cmd.toLowerCase().startsWith("admincommands")) {
  2387. c.getPA().sendFrame126("Administrator Commands", 18814);
  2388. int id = 18822;
  2389. c.getPA().sendFrame126("::setpkgear - Sets the PK-Tournament gear to the specified player.", id++);
  2390. c.getPA().sendFrame126("::move - Moves the player out of the tournament.", id++);
  2391. c.getPA().sendFrame126("::rapedungeon - Teleports you to the rapedungeon.", id++);
  2392. c.getPA().sendFrame126("::puzzles - Gives you all the puzzles.", id++);
  2393. c.getPA().sendFrame126("::invison/invisoff - Turns invisibility on/off.", id++);
  2394. c.getPA().sendFrame126("::givewarning - Gives a warning to the specified player.", id++);
  2395. c.getPA().sendFrame126("::removewarning - Removes a warning of the specified player.", id++);
  2396. c.getPA().sendFrame126("::teletome - Teleports a player to you.", id++);
  2397. c.getPA().sendFrame126("::tele - Teleports you to the specified x and y coords.", id++);
  2398. c.getPA().sendFrame126("::unban - Unbans the specified player.", id++);
  2399. c.getPA().sendFrame126("::unipban - Unipbans the specified player.", id++);
  2400. c.getPA().sendFrame126("::ipban - Ipbans the specified player.", id++);
  2401. c.getPA().sendFrame126("::bank - Opens the bank.", id++);
  2402. c.getPA().sendFrame126("::search - Opens the item searcher.", id++);
  2403. c.getPA().sendFrame126("::item - Spawns an item with the specified id/amount.", id++);
  2404. for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
  2405. c.getPA().showInterface(18810);
  2406. }
  2407. if (cmd.startsWith("skillnumber")) {
  2408. c.sendMessage("attack 0, defence 1, str 2, hp 3, ranged 4, prayer 5, magic 6, cooking 7 woodcutting 8, fletching 9, fishing 10, firemaking 11, "
  2409. + "crafting 12, smithing 13, mining 14, herblore 15, agility 16, thieving 17, slayer 18, farming 19 runecrafting 20, hunter 22.");
  2410. }
  2411. if (cmd.startsWith("setlevel")) {
  2412.  
  2413. String[] args = cmd.split("-");
  2414.  
  2415. if (args.length != 4) {
  2416. c.sendMessage("Incorrect use! Use as ::setlevel-name-skillnumber-level");
  2417. c.sendMessage("if you don't know skill number type ::skillnumber");
  2418. return;
  2419. }
  2420. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  2421. if (otherPlayer == null) {
  2422. return;
  2423. }
  2424.  
  2425. int skill = Integer.parseInt(args[2]);
  2426. int level = Integer.parseInt(args[3]);
  2427. if (level > 99)
  2428. level = 99;
  2429. else if (level < 0)
  2430. level = 1;
  2431. otherPlayer.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  2432. otherPlayer.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  2433. otherPlayer.getPA().refreshSkill(skill);
  2434. }
  2435. if (cmd.equals("bank")) {
  2436. c.getBank().open();
  2437. }
  2438.  
  2439. if (cmd.toLowerCase().startsWith("setpkgear")) {
  2440. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(10));
  2441.  
  2442. if (otherPlayer == null) {
  2443. return;
  2444. }
  2445. otherPlayer.getItems().deleteAllItems();
  2446. otherPlayer.playerEquipment[Player.HAT] = new Item(4716, 1);
  2447. otherPlayer.playerEquipment[Player.WEAPON] = new Item(4151, 1);
  2448. otherPlayer.playerEquipment[Player.CHEST] = new Item(4720, 1);
  2449. otherPlayer.playerEquipment[Player.SHIELD] = new Item(20072, 1);
  2450. otherPlayer.playerEquipment[Player.LEGS] = new Item(4722, 1);
  2451. otherPlayer.playerEquipment[Player.HANDS] = new Item(7462, 1);
  2452. otherPlayer.playerEquipment[Player.FEET] = new Item(11732, 1);
  2453. otherPlayer.playerEquipment[Player.CAPE] = new Item(6570, 1);
  2454. otherPlayer.playerEquipment[Player.AMULET] = new Item(1725, 1);
  2455. otherPlayer.playerEquipment[Player.RING] = new Item(2550, 1);
  2456.  
  2457. otherPlayer.getItems().addItem(4718, 1);
  2458. otherPlayer.getItems().addItem(5698, 1);
  2459. otherPlayer.getItems().addItem(2436, 1);
  2460. otherPlayer.getItems().addItem(2440, 1);
  2461. otherPlayer.getItems().addItem(2442, 1);
  2462. otherPlayer.getItems().addItem(139, 2);
  2463. otherPlayer.getItems().addItem(385, 21);
  2464.  
  2465. otherPlayer.getItems().writeItems(1688, c.playerEquipment);
  2466. otherPlayer.getItems().resetEquipment();
  2467. otherPlayer.getCombat().deactivateAllPrayers();
  2468. otherPlayer.getPA().refreshSkills();
  2469. otherPlayer.setAppearanceUpdateRequired(true);
  2470. otherPlayer.updateRequired = true;
  2471. c.sendMessage("You have set the gear of "+otherPlayer.username+".");
  2472. otherPlayer.sendMessage("Type ::enter to enter the pking area.");
  2473. c.sendMessage("Type ::move username to remove that persons gear.");
  2474. }
  2475. if (cmd.toLowerCase().startsWith("move")) {
  2476. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(5));
  2477.  
  2478. if (otherPlayer == null) {
  2479. return;
  2480. }
  2481. otherPlayer.getItems().deleteAllItems();
  2482. otherPlayer.getPA().movePlayer(1976, 5002, 0);
  2483. c.sendMessage("You have moved "+otherPlayer.username+" out of the tournament.");
  2484. }
  2485. /*if (cmd.toLowerCase().startsWith("master")) {
  2486.  
  2487. if (Server.getWorld() == Worlds.ECO) {
  2488. for (int i = 0; i < c.playerLevel.length; i++) {
  2489. c.playerXP[i] = (int) 15e+6;
  2490. c.playerLevel[i] = 99;
  2491. c.getPA().refreshSkill(i);
  2492. }
  2493. } else {
  2494. for (int i = 0; i <= 6; i++) {
  2495. c.playerXP[i] = (int) 15e+6;
  2496. c.playerLevel[i] = 99;
  2497. c.getPA().refreshSkill(i);
  2498. }
  2499. }
  2500.  
  2501. if (c.rights <= 0) {
  2502. c.getPA().resetPrayerBook();
  2503. }
  2504. c.updateRequired = true;
  2505. c.setAppearanceUpdateRequired(true);
  2506. }*/
  2507.  
  2508. if (cmd.toLowerCase().equals("rapedungeon")) {
  2509. if (c.rights == 2 && c.inWild()) {
  2510. c.sendMessage("You can't visit the rape dungeon while in the wild.yeah");
  2511. return;
  2512. }
  2513. c.heightLevel = 4000;
  2514. c.teleportToX = 3192;
  2515. c.teleportToY = 9827;
  2516. c.sendMessage("Welcome to the rape dungeon. Anybody you teleport here will not be able to leave.");
  2517. }
  2518.  
  2519. if (cmd.equals("invison")) {
  2520. if (c.rights == 2 && (c.underAttackBy > 0 || c.underAttackBy2 > 0)) {
  2521. c.sendMessage("You can't go invisible while in combat.");
  2522. return;
  2523. }
  2524. c.invisible = true;
  2525. c.teleportToX = c.getX();
  2526. c.teleportToY = c.getY();
  2527. c.sendMessage("You are now invisible.");
  2528. }
  2529.  
  2530. if (cmd.equals("invisoff")) {
  2531. c.invisible = false;
  2532. c.teleportToX = c.getX();
  2533. c.teleportToY = c.getY();
  2534. c.sendMessage("You are no longer invisible.");
  2535. }
  2536.  
  2537. if (cmd.toLowerCase().startsWith("givewarning")) {
  2538. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(12));
  2539.  
  2540. if (otherPlayer == null) {
  2541. return;
  2542. }
  2543. if (otherPlayer.rights == 3) {
  2544. c.sendMessage("You cant give this player warnings.");
  2545. return;
  2546. }
  2547.  
  2548. otherPlayer.warnings++;
  2549. otherPlayer.getPA().setPlayerInformation();
  2550. otherPlayer.sendMessage("You have been given a warning by " + c.formattedName);
  2551. c.sendMessage(String.format("%s has been given a warning, they now have: %s warning(s).", otherPlayer.formattedName, otherPlayer.warnings));
  2552.  
  2553. if (otherPlayer.warnings >= 3) {
  2554. c.getPA().banPlayer(otherPlayer.username, 0);
  2555. }
  2556.  
  2557. PunishmentHandler.queuePunishment(otherPlayer.formattedName, c.username, 4);
  2558. }
  2559.  
  2560. if (cmd.toLowerCase().startsWith("removewarning")) {
  2561. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(14));
  2562.  
  2563. if (otherPlayer == null) {
  2564. return;
  2565. }
  2566. if (otherPlayer.rights == 3) {
  2567. c.sendMessage("You cant give this player warnings.");
  2568. return;
  2569. }
  2570.  
  2571. if (otherPlayer.warnings <= 0) {
  2572. return;
  2573. }
  2574. otherPlayer.warnings--;
  2575. otherPlayer.getPA().setPlayerInformation();
  2576. otherPlayer.sendMessage("A warning on your account has been removed by: " + c.formattedName);
  2577. c.sendMessage(String.format("You have removed a warning from %s, they now have: %s warning(s).", otherPlayer.formattedName, otherPlayer.warnings));
  2578.  
  2579. if (otherPlayer.warnings >= 3) {
  2580. c.getPA().banPlayer(otherPlayer.username, -1);
  2581. }
  2582. }
  2583.  
  2584. if (cmd.split(" ")[0].equals("teletome")) {
  2585. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  2586. c.sendMessage("You can't use that command while in the wilderness!");
  2587. return;
  2588. }
  2589.  
  2590. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(9).replaceAll("_", " "));
  2591. if (otherPlayer == null) {
  2592. return;
  2593. }
  2594. otherPlayer.getPA().movePlayer(c.absX, c.absY, c.heightLevel);
  2595. if (!c.invisible) {
  2596. otherPlayer.sendMessage("You have been teleported to " + c.formattedName + ".");
  2597. }
  2598. c.sendMessage(otherPlayer.formattedName + " has been teleported to you!");
  2599. }
  2600.  
  2601. if (cmd.toLowerCase().startsWith("tele")) {
  2602. if (c.inWild() && c.rights != 3 && c.rights != 4) {
  2603. c.sendMessage("You can't use that command while in the wilderness!");
  2604. return;
  2605. }
  2606.  
  2607. String[] arg = cmd.split(" ");
  2608. if (arg.length > 3) {
  2609. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  2610. } else if (arg.length == 3) {
  2611. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), c.heightLevel);
  2612. }
  2613. }
  2614. if (cmd.toLowerCase().startsWith("unban")) {
  2615. String player = Misc.capitalize(cmd.substring(6));
  2616. if (!BanHandler.isBanned(player)) {
  2617. c.sendMessage(player + " is not banned.");
  2618. return;
  2619. }
  2620. BanHandler.removeBan(player);
  2621. c.sendMessage(player + " has had their ban removed!");
  2622. }
  2623.  
  2624. if (cmd.toLowerCase().startsWith("unipban")) {
  2625. String ip = Misc.capitalize(cmd.substring(8));
  2626. if (!BanHandler.isIpBanned(ip)) {
  2627. c.sendMessage(ip + " can't be found in the ip-ban list.");
  2628. return;
  2629. }
  2630. BanHandler.removeIpBan(ip);
  2631. c.sendMessage(ip + " has been removed from the ip-ban list.");
  2632. }
  2633.  
  2634. /*if (cmd.toLowerCase().startsWith("ipban")) {
  2635. c.getPA().ipBanPlayer(cmd.substring(6));
  2636. }*/
  2637. }
  2638.  
  2639. private void headAdministratorCommands(Client c, String cmd) {
  2640. if (cmd.toLowerCase().startsWith("ownercommands")) {
  2641. c.getPA().sendFrame126("Owner Commands", 18814);
  2642. int id = 18822;
  2643. c.getPA().sendFrame126("::mypos - Tells you your current coordinates.", id++);
  2644. c.getPA().sendFrame126("::height - Tells you your current height level.", id++);
  2645. c.getPA().sendFrame126("::openid - Opens an interface with the specified id.", id++);
  2646. c.getPA().sendFrame126("::runes - Spawns 100k of every rune.", id++);
  2647. c.getPA().sendFrame126("::pid - Tells you your player id.", id++);
  2648. c.getPA().sendFrame126("::curses - Switches prayer books.", id++);
  2649. c.getPA().sendFrame126("::bank - Opens the bank", id++);
  2650. c.getPA().sendFrame126("::pnpc/unpc - NPC Transform.", id++);
  2651. c.getPA().sendFrame126("::removepin - Removes your bank pin.", id++);
  2652. c.getPA().sendFrame126("::copy - Copies the specified player.", id++);
  2653. c.getPA().sendFrame126("::spec - Sets your special to the specified amount.", id++);
  2654. c.getPA().sendFrame126("::pray - Sets your prayer to the specified level.", id++);
  2655. c.getPA().sendFrame126("::hp - Sets your hp to the specified level.", id++);
  2656. c.getPA().sendFrame126("::resetspec - Resets your special.", id++);
  2657. c.getPA().sendFrame126("::resetstats - Resets your stats.", id++);
  2658. c.getPA().sendFrame126("::listingcount - Shows the amount of G.E listings.", id++);
  2659. c.getPA().sendFrame126("::update - Starts the update with the specified countdown.", id++);
  2660. c.getPA().sendFrame126("::shop - Opens the shop with the specified id.", id++);
  2661. c.getPA().sendFrame126("::popall - Pops all partyroom balloons.", id++);
  2662. c.getPA().sendFrame126("::gfx - Performs the gfx with the specified id.", id++);
  2663. c.getPA().sendFrame126("::anim - Performs an animation with the specified id.", id++);
  2664. c.getPA().sendFrame126("::npc - Spawns an npc with the specified id.", id++);
  2665. c.getPA().sendFrame126("::cmb - Sets your combat level to the specified id.", id++);
  2666. c.getPA().sendFrame126("::demote - Demotes the player.", id++);
  2667. c.getPA().sendFrame126("::server - Opens the toggles panel.", id++);
  2668. c.getPA().sendFrame126("::getplayer - Checks if the specified players ip matches with any other.", id++);
  2669. c.getPA().sendFrame126("::getip - Gets the specified players ip.", id++);
  2670. c.getPA().sendFrame126("", id++);
  2671.  
  2672. for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
  2673. c.getPA().showInterface(18810);
  2674. }
  2675. if (cmd.toLowerCase().startsWith("height")) {
  2676. int height = Integer.parseInt(cmd.substring(7));
  2677. c.teleportToX = c.absX;
  2678. c.teleportToY = c.absY;
  2679. c.heightLevel = height;
  2680. }
  2681.  
  2682. if (cmd.toLowerCase().startsWith("openid")) {
  2683. c.sendMessage("Interface ID: "+c.openInterfaceId);
  2684. }
  2685.  
  2686. if (cmd.toLowerCase().startsWith("giveitem") && c.username.equalsIgnoreCase("Durky")) {
  2687. try {
  2688. String[] args = cmd.split(" ");
  2689. int newItemID = Integer.parseInt(args[1]);
  2690. int newItemAmount = Integer.parseInt(args[2]);
  2691. String otherplayer = args[3].replaceAll("_", " ");
  2692. Client c2 = null;
  2693. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  2694. PlayerHandler.getPlayerHandler();
  2695. if(PlayerHandler.players[i] != null) {
  2696. PlayerHandler.getPlayerHandler();
  2697. if(PlayerHandler.players[i].username.equalsIgnoreCase(otherplayer)) {
  2698. PlayerHandler.getPlayerHandler();
  2699. c2 = (Client)PlayerHandler.players[i];
  2700. break;
  2701. }
  2702. }
  2703. }
  2704. if (c2 == null) {
  2705. c.sendMessage("Player doesn't exist.");
  2706. return;
  2707. }
  2708. if(c2.getItems().freeSlots() < 1) {
  2709. c.sendMessage("Not enough space in inventory.");
  2710. return;
  2711. }
  2712. c2.getItems().addItem(newItemID, newItemAmount);
  2713. c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +" to "+otherplayer+".");
  2714. } catch(Exception e) {
  2715. c.sendMessage("Use as ::giveitem [id] [amount] [playername]");
  2716. }
  2717. }
  2718. if (cmd.toLowerCase().startsWith("takeitem") && c.username.equalsIgnoreCase("Durky")) {
  2719.  
  2720. try {
  2721. String[] args = cmd.split(" ");
  2722. int takenItemID = Integer.parseInt(args[1]);
  2723. int takenItemAmount = Integer.parseInt(args[2]);
  2724. String otherplayer = args[3].replaceAll("_", " ");;
  2725. Client c2 = null;
  2726. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  2727. PlayerHandler.getPlayerHandler();
  2728. if(PlayerHandler.players[i] != null) {
  2729. PlayerHandler.getPlayerHandler();
  2730. if(PlayerHandler.players[i].username.equalsIgnoreCase(otherplayer)) {
  2731. PlayerHandler.getPlayerHandler();
  2732. c2 = (Client)PlayerHandler.players[i];
  2733. break;
  2734. }
  2735. }
  2736. }
  2737. if (c2 == null) {
  2738. c.sendMessage("Player doesn't exist.");
  2739. return;
  2740. }
  2741. if(c2.getItems().freeSlots() < 1) {
  2742. c.sendMessage("Not enough space in inventory.");
  2743. return;
  2744. }
  2745. c2.getItems().deleteItem(takenItemID, takenItemAmount);
  2746. c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +" from "+otherplayer+"." );
  2747. } catch(Exception e) {
  2748. c.sendMessage("Use as ::takeitem [id] [amount] [playername]");
  2749. }
  2750. }
  2751.  
  2752. if (cmd.equalsIgnoreCase("hail")) {
  2753. PlayerHandler.getPlayerHandler();
  2754. for (Player p : PlayerHandler.players) {
  2755. if (p == null || c.getId() == p.getId() || p.distanceToPoint(c.getX(), c.getY()) > 5) continue;
  2756. p.forcedChat("All hail " + (Misc.random(1) == 0 ? "the mighty " : "Lord ") + c.formattedName + "!");
  2757. p.turnPlayerTo(c.getX(), c.getY());
  2758. p.forceAnim(1651);
  2759. }
  2760. }
  2761.  
  2762. if (cmd.equalsIgnoreCase("pid")) {
  2763. c.sendMessage("Your PID is: " + c.playerId);
  2764. }
  2765.  
  2766. if (cmd.toLowerCase().startsWith("announce")) {
  2767. String msg = cmd.substring(9);
  2768. Engine.messageToAll("ANNOUNCER", msg, 2);
  2769. ServerStatus.getServerStatus().queueAnnouncement(msg);
  2770. }
  2771.  
  2772. if (cmd.toLowerCase().startsWith("dmg")) {
  2773. String[] split = cmd.split("-");
  2774. if (split.length != 3) {
  2775. c.sendMessage("Incorrect syntax. Correct: ::dmg-name-amount");
  2776. return;
  2777. }
  2778.  
  2779. Client otherPlayer = (Client)PlayerHandler.getPlayerHandler().getPlayer(split[1]);
  2780. if (otherPlayer != null) {
  2781. otherPlayer.getPA().doDamage(Integer.parseInt(split[2]));
  2782. c.sendMessage(split[2] + " damage done to: " + otherPlayer.formattedName);
  2783. }
  2784. }
  2785.  
  2786. if (cmd.toLowerCase().startsWith("pnpc")) {
  2787. c.resetPlayerNpc();
  2788. c.playerNpcId = Integer.parseInt(cmd.substring(5));
  2789. c.isNpc = true;
  2790. c.updateRequired = true;
  2791. c.setAppearanceUpdateRequired(true);
  2792. }
  2793.  
  2794. if (cmd.equals("unpnpc")) {
  2795. c.resetPlayerNpc();
  2796. c.updateRequired = true;
  2797. c.setAppearanceUpdateRequired(true);
  2798. }
  2799.  
  2800. if (cmd.equalsIgnoreCase("curses")) {
  2801. if (c.prayerBook == 0) {
  2802. c.sendMessage("Curse prayer book set.");
  2803. c.setSidebarInterface(5, 22500);
  2804. c.prayerBook = 1;
  2805. } else {
  2806. c.sendMessage("Normal prayer book set.");
  2807. c.setSidebarInterface(5, 5608);
  2808. c.prayerBook = 0;
  2809. }
  2810. }
  2811.  
  2812. if (cmd.equalsIgnoreCase("save")) {
  2813. FileManager.savePlayer(c);
  2814. c.sendMessage("Saved");
  2815. }
  2816.  
  2817. if (cmd.startsWith("aspawn")) {
  2818. PrintWriter writer = null;
  2819. try {
  2820. int npcId = Integer.parseInt(cmd.substring(7));
  2821. NpcList npc = NpcHandler.getNpcHandler().getNpcData(npcId);
  2822. writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "cfg/spawn-config.cfg", true));
  2823. writer.println(String.format("spawn = %s\t%s\t%s\t0\t0\t0\t0\t0\t%s", npcId, c.getX(), c.getY(), npc == null ? "Unknown" : npc.npcName));
  2824. c.sendMessage("Npc added to auto spawn config.");
  2825. } catch (Exception ex) {
  2826. ex.printStackTrace();
  2827. } finally {
  2828. if (writer != null) {
  2829. writer.close();
  2830. NpcHandler.getNpcHandler().loadAutoSpawn(Config.DATA_LOCATION() + "cfg/spawn-config.cfg");
  2831. }
  2832. }
  2833. }
  2834.  
  2835. if (cmd.startsWith("object")) {
  2836. String[] args = cmd.split(" ");
  2837. if (args.length >= 2) {
  2838. int objectId = Integer.parseInt(args[1]);
  2839. int objectFace = 0;
  2840. int objectType = 10;
  2841. if (args.length >= 3) {
  2842. objectFace = Integer.parseInt(args[2]);
  2843. if (args.length >= 4) {
  2844. objectType = Integer.parseInt(args[4]);
  2845. }
  2846. }
  2847.  
  2848. c.getPA().checkObjectSpawn(objectId, c.getX(), c.getY(), objectFace, objectType);
  2849. try {
  2850. PrintWriter writer = null;
  2851. try {
  2852. writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "output/object_data.txt", true));
  2853. writer.println(String.format("c.getPA().checkObjectSpawn(%s, %s, %s, %s, %s);", objectId, c.getX(), c.getY(), objectFace, objectType));
  2854. } catch (Exception ex) {
  2855. ex.printStackTrace();
  2856. } finally {
  2857. if (writer != null) {
  2858. writer.close();
  2859. }
  2860. }
  2861. } catch (Exception ex) {
  2862.  
  2863. }
  2864. }
  2865. }
  2866.  
  2867. if (cmd.toLowerCase().equals("removepin")) {
  2868. c.bankPin = "";
  2869. c.pendingBankPin = "";
  2870. }
  2871.  
  2872. if (cmd.toLowerCase().equals("finpending")) {
  2873. c.pendingPinDelay.removeDays(8);
  2874. }
  2875.  
  2876. if (cmd.toLowerCase().equals("removenpcs")) {
  2877. NpcHandler.getNpcHandler();
  2878. for (int i = 0; i < NpcHandler.npcs.length; i++) {
  2879. NpcHandler.getNpcHandler();
  2880. Npc npc = NpcHandler.npcs[i];
  2881. if (npc == null) {
  2882. continue;
  2883. }
  2884. if (npc.spawnedBy == c.playerId) {
  2885. npc.isDead = true;
  2886. npc.HP = 0;
  2887. }
  2888. }
  2889. c.sendMessage("All spawned NPC's have been removed.");
  2890. }
  2891.  
  2892. if (cmd.toLowerCase().startsWith("resettitle")) {
  2893. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(11));
  2894. if (otherPlayer == null) {
  2895. return;
  2896. }
  2897. otherPlayer.titleChangeCount = 0;
  2898. otherPlayer.sendMessage("The amount of times you can set your custom title for free has been reset by: " + c.formattedName + ".");
  2899. c.sendMessage(otherPlayer.formattedName + " had their title changes reset!");
  2900. FileManager.savePlayer(otherPlayer);
  2901. }
  2902.  
  2903. if (cmd.toLowerCase().startsWith("removetitle")) {
  2904. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(12));
  2905. if (otherPlayer == null) {
  2906. return;
  2907. }
  2908. otherPlayer.titleId = 0;
  2909. otherPlayer.customTitle = "";
  2910. otherPlayer.titleChangeCount = 10; // they now have to pay for
  2911. // titles
  2912. otherPlayer.sendMessage("Your title has been removed by: " + c.formattedName + ".");
  2913. otherPlayer.setAppearanceUpdateRequired(true);
  2914. otherPlayer.updateRequired = true;
  2915. c.sendMessage(otherPlayer.formattedName + " had their title removed.");
  2916. FileManager.savePlayer(otherPlayer);
  2917. }
  2918.  
  2919. if (cmd.toLowerCase().startsWith("title")) {
  2920. c.titleId = -1;
  2921. c.customTitle = cmd.substring(6);
  2922. c.updateRequired = true;
  2923. c.setAppearanceUpdateRequired(true);
  2924. c.sendMessage("Title set.");
  2925. }
  2926.  
  2927. if (cmd.toLowerCase().equals("godmodeon")) {
  2928. c.godMode = true;
  2929. c.sendMessage("godMode Activated.");
  2930. }
  2931.  
  2932. if (cmd.toLowerCase().equals("godmodeoff")) {
  2933. c.godMode = false;
  2934. c.sendMessage("godMode Deactivated.");
  2935. }
  2936.  
  2937. if (cmd.toLowerCase().startsWith("setdef")) {
  2938. c.playerLevel[1] = Integer.parseInt(cmd.substring(7));
  2939. c.getPA().refreshSkill(1);
  2940. }
  2941.  
  2942. if (cmd.toLowerCase().startsWith("pot2")) {
  2943. for (int i = 0; i <= 6; i++) {
  2944. if (i == 3 || i == 5) {
  2945. continue;
  2946. }
  2947. c.playerLevel[i] = Integer.parseInt(cmd.substring(5));
  2948. c.getPA().refreshSkill(i);
  2949. }
  2950. c.sendMessage("You \"drink\" some pots.");
  2951. }
  2952.  
  2953. if (cmd.toLowerCase().startsWith("pot") && !cmd.toLowerCase().startsWith("pot2")) {
  2954. for (int i = 0; i <= 6; i++) {
  2955. c.playerLevel[i] = Integer.parseInt(cmd.substring(4));
  2956. c.getPA().refreshSkill(i);
  2957. }
  2958. c.sendMessage("You \"drink\" some pots.");
  2959. }
  2960.  
  2961. if (cmd.equals("pk")) {
  2962. for (int i = 0; i <= 6; i++) {
  2963. if (i == 3) {
  2964. c.playerLevel[i] = c.getLevelForXP(c.playerXP[i]);
  2965. } else if (i == 5) {
  2966. c.playerLevel[i] = Integer.MAX_VALUE;
  2967. } else if (i == 1) {
  2968. c.playerLevel[i] = 300;
  2969. } else {
  2970. c.playerLevel[i] = 125;
  2971. }
  2972. c.getPA().refreshSkill(i);
  2973. }
  2974. c.specAmount = Double.MAX_VALUE;
  2975. c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
  2976. }
  2977.  
  2978. if (cmd.startsWith("pk2")) {
  2979. for (int i = 0; i <= 6; i++) {
  2980. if (i == 3) {
  2981. continue;
  2982. } else if (i == 5) {
  2983. c.playerLevel[i] = Integer.MAX_VALUE;
  2984. } else if (i == 1) {
  2985. c.playerLevel[i] = 300;
  2986. } else {
  2987. c.playerLevel[i] = Integer.parseInt(cmd.substring(4));
  2988. }
  2989. c.getPA().refreshSkill(i);
  2990. }
  2991. c.specAmount = Double.MAX_VALUE;
  2992. c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
  2993. }
  2994.  
  2995. if (cmd.startsWith("smite")) {
  2996. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(6));
  2997. if (otherPlayer == null) {
  2998. return;
  2999. }
  3000. otherPlayer.playerLevel[5] = 1;
  3001. otherPlayer.getPA().refreshSkill(5);
  3002. }
  3003.  
  3004. if (cmd.equals("duelcheck")) {
  3005. int count = 0;
  3006.  
  3007. for (Item i : c.stakedItems) {
  3008. if (i.getId() > 0) {
  3009. count++;
  3010. }
  3011. }
  3012.  
  3013. c.sendMessage("staked items: " + count);
  3014.  
  3015. count = 0;
  3016.  
  3017. for (Item i : c.opponentsItems) {
  3018. if (i.getId() > 0) {
  3019. count++;
  3020. }
  3021. }
  3022.  
  3023. c.sendMessage("opponents items: " + count);
  3024. }
  3025.  
  3026. if (cmd.equals("npcs")) {
  3027. NpcHandler.getNpcHandler();
  3028. for (Npc i : NpcHandler.npcs) {
  3029. if (i == null) {
  3030. continue;
  3031. }
  3032. System.out.println(i.npcType);
  3033. }
  3034. }
  3035. if (cmd.equals("gamblers")) {
  3036. c.sendMessage("There are currently: " + LotteryHandler.getLotteryHandler().getGamblers().size() + " gamblers.");
  3037. }
  3038.  
  3039. if (cmd.equalsIgnoreCase("resettb") && c.rights == 3) {
  3040. c.getPA().resetTb();
  3041. }
  3042.  
  3043. if (cmd.toLowerCase().startsWith("givepkp")) {
  3044. String[] args = cmd.split("-");
  3045.  
  3046. if (args.length != 3) {
  3047. c.sendMessage("Incorrect use! Use as ::givepkp-name-amount");
  3048. return;
  3049. }
  3050.  
  3051. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3052. if (otherPlayer == null) {
  3053. return;
  3054. }
  3055.  
  3056. otherPlayer.pkPoints += Integer.parseInt(args[2]);
  3057. otherPlayer.sendMessage(String.format("You have been given %s PK points!", args[2]));
  3058. otherPlayer.getPA().setPlayerInformation();
  3059. c.sendMessage(String.format("%s has been given %s PK points!", otherPlayer.formattedName, args[2]));
  3060. }
  3061.  
  3062. if (cmd.toLowerCase().startsWith("givevp")) {
  3063. String[] args = cmd.split("-");
  3064.  
  3065. if (args.length != 3) {
  3066. c.sendMessage("Incorrect use! Use as ::givevp-name-amount");
  3067. return;
  3068. }
  3069.  
  3070. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3071. if (otherPlayer == null) {
  3072. return;
  3073. }
  3074.  
  3075. otherPlayer.votePoints += Integer.parseInt(args[2]);
  3076. otherPlayer.sendMessage(String.format("You have been given %s vote points!", args[2]));
  3077. otherPlayer.getPA().setPlayerInformation();
  3078. c.sendMessage(String.format("%s has been given %s vote points!", otherPlayer.formattedName, args[2]));
  3079. }
  3080.  
  3081. if (cmd.toLowerCase().startsWith("imitate")) {
  3082. String[] args = cmd.split("-");
  3083. if (args.length == 3) {
  3084. Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3085. if (otherPlayer == null) {
  3086. return;
  3087. }
  3088. otherPlayer.forcedChat("~" + args[2]);
  3089. } else {
  3090. c.sendMessage("Incorrect usage, use as ::imitate-username-message");
  3091. }
  3092. }
  3093.  
  3094. if (cmd.equals("listingcount")) {
  3095. c.sendMessage("There are currently " + GrandExchangeData.getListings().size() + " listings.");
  3096. }
  3097.  
  3098. if (cmd.toLowerCase().startsWith("copy")) {
  3099. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(5));
  3100. if (otherPlayer == null) {
  3101. return;
  3102. }
  3103. for (int i = 0; i < c.playerEquipment.length; i++) {
  3104. c.playerEquipment[i] = new Item(otherPlayer.playerEquipment[i].getId(), otherPlayer.playerEquipment[i].getAmount());
  3105. }
  3106. c.getItems().writeItems(1688, c.playerEquipment);
  3107. c.setAppearanceUpdateRequired(true);
  3108. c.updateRequired = true;
  3109. c.sendMessage("You have copied " + otherPlayer.formattedName + "'s equipment");
  3110. }
  3111.  
  3112. if (cmd.toLowerCase().startsWith("spec")) {
  3113. c.specAmount = Integer.parseInt(cmd.substring(5));
  3114. c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
  3115. c.sendMessage("Special set.");
  3116. }
  3117.  
  3118. if (cmd.toLowerCase().startsWith("pray")) {
  3119. c.playerLevel[5] = Integer.parseInt(cmd.substring(5));
  3120. c.getPA().refreshSkill(5);
  3121. c.sendMessage("Prayer set.");
  3122. }
  3123.  
  3124. if (cmd.toLowerCase().startsWith("hp")) {
  3125. c.playerLevel[3] = Integer.parseInt(cmd.substring(3));
  3126. c.getPA().refreshSkill(3);
  3127. c.sendMessage("Hp set.");
  3128. }
  3129.  
  3130. if (cmd.equals("resetstats")) {
  3131. for (int i = 0; i <= 6; i++) {
  3132. c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
  3133. c.getPA().refreshSkill(i);
  3134. }
  3135. c.sendMessage("Stats reset.");
  3136. }
  3137.  
  3138. if (cmd.toLowerCase().equals("fin")) {
  3139. c.playerPuzzle.setPuzzleConfig(PuzzleBox.getPuzzle(c.playerPuzzle.getPuzzleId()));
  3140. c.playerPuzzle.setPuzzleConfigIndex(24, c.playerPuzzle.getPuzzleConfig()[23]);
  3141. c.playerPuzzle.setPuzzleConfigIndex(23, -1);
  3142. c.getItems().writeItems(11130, c.playerPuzzle.getPuzzleConfig(), 1);
  3143. }
  3144.  
  3145. if (cmd.toLowerCase().startsWith("givecredits") || cmd.toLowerCase().startsWith("givetokens")) {
  3146. String[] args = cmd.split("-");
  3147.  
  3148. if (args.length != 3) {
  3149. c.sendMessage("Incorrect use! Use as ::givecredits-name-amount");
  3150. return;
  3151. }
  3152.  
  3153. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3154. if (otherPlayer == null) {
  3155. return;
  3156. }
  3157.  
  3158. otherPlayer.runeunityTokens += Integer.parseInt(args[2]);
  3159. otherPlayer.donationTotal += (Integer.parseInt(args[2]) / 100);
  3160. otherPlayer.sendMessage(String.format("You have been given %s Renown Tokens!", args[2]));
  3161. otherPlayer.getPA().setPlayerInformation();
  3162. c.sendMessage(String.format("%s has been given %s Renown Tokens!", otherPlayer.formattedName, args[2]));
  3163. FileManager.savePlayer(otherPlayer);
  3164. }
  3165. if (cmd.toLowerCase().startsWith("donationamount")) {
  3166. String[] args = cmd.split("-");
  3167.  
  3168. if (args.length != 3) {
  3169. c.sendMessage("Incorrect use! Use as ::donationamount-username-amount");
  3170. return;
  3171. }
  3172.  
  3173. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3174. if (otherPlayer == null) {
  3175. return;
  3176. }
  3177.  
  3178. otherPlayer.donationTotal += (Integer.parseInt(args[2]));
  3179. otherPlayer.sendMessage(String.format("Your Donation total has been adjusted.", args[2]));
  3180. otherPlayer.getPA().setPlayerInformation();
  3181. c.sendMessage(String.format("%s has had their %s Donation total changed.", otherPlayer.formattedName, args[2]));
  3182. FileManager.savePlayer(otherPlayer);
  3183. }
  3184. if (cmd.toLowerCase().startsWith("removedonationamount")) {
  3185. String[] args = cmd.split("-");
  3186.  
  3187. if (args.length != 3) {
  3188. c.sendMessage("Incorrect use! Use as ::removedonationamount-username-amount");
  3189. return;
  3190. }
  3191.  
  3192. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3193. if (otherPlayer == null) {
  3194. return;
  3195. }
  3196.  
  3197. otherPlayer.donationTotal -= (Integer.parseInt(args[2]));
  3198. otherPlayer.sendMessage(String.format("Your Donation total has been adjusted.", args[2]));
  3199. otherPlayer.getPA().setPlayerInformation();
  3200. c.sendMessage(String.format("%s has had their %s Donation total changed.", otherPlayer.formattedName, args[2]));
  3201. FileManager.savePlayer(otherPlayer);
  3202. }
  3203.  
  3204. if (cmd.toLowerCase().startsWith("removecredits") || cmd.toLowerCase().startsWith("removetokens")) {
  3205. String[] args = cmd.split("-");
  3206.  
  3207. if (args.length != 3) {
  3208. c.sendMessage("Incorrect use! Use as ::removecredits-name-amount");
  3209. return;
  3210. }
  3211.  
  3212. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3213. if (otherPlayer == null) {
  3214. return;
  3215. }
  3216.  
  3217. otherPlayer.runeunityTokens -= Integer.parseInt(args[2]);
  3218. otherPlayer.sendMessage(String.format("%s Renown Tokens have been removed from your account.", args[2]));
  3219. otherPlayer.getPA().setPlayerInformation();
  3220. c.sendMessage(String.format("%s Renown Tokens have been removed from %s.", args[2], otherPlayer.formattedName));
  3221. }
  3222.  
  3223. if (cmd.toLowerCase().startsWith("update")) {
  3224. Server.startUpdate(Integer.parseInt(cmd.substring(7)));
  3225. }
  3226.  
  3227. if (cmd.equals("gc")) {
  3228. System.gc();
  3229. System.runFinalization();
  3230. }
  3231.  
  3232. if (cmd.toLowerCase().startsWith("shop")) {
  3233. Shopping.getShopping().openShop(c, Integer.parseInt(cmd.split(" ")[1]));
  3234. }
  3235.  
  3236. if (cmd.equals("resetspec")) {
  3237. c.specAmount = 10;
  3238. c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
  3239. }
  3240.  
  3241. if (cmd.equals("popall")) {
  3242. PartyRoom.getPartyRoom().popAll(c);
  3243. }
  3244.  
  3245. if (cmd.equalsIgnoreCase("mypos")) {
  3246. c.sendMessage("X: " + c.absX);
  3247. c.sendMessage("Y: " + c.absY);
  3248. c.sendMessage("Z: " + c.heightLevel);
  3249. }
  3250.  
  3251. if (cmd.toLowerCase().startsWith("interface")) {
  3252. String[] args = cmd.split(" ");
  3253. c.getPA().showInterface(Integer.parseInt(args[1]));
  3254. }
  3255.  
  3256. if (cmd.toLowerCase().startsWith("gfx")) {
  3257. String[] args = cmd.split(" ");
  3258. c.gfx0(Integer.parseInt(args[1]));
  3259. }
  3260.  
  3261. if (cmd.toLowerCase().startsWith("anim")) {
  3262. String[] args = cmd.split(" ");
  3263. c.forceAnim(Integer.parseInt(args[1]));
  3264. c.getPA().requestUpdates();
  3265. }
  3266.  
  3267. if (cmd.toLowerCase().startsWith("npc")) {
  3268. int npcId = Integer.parseInt(cmd.substring(4));
  3269. if (npcId > 0) {
  3270. Npc npc = NpcHandler.getNpcHandler().spawnNpc(c, npcId, c.absX, c.absY, c.heightLevel, 0, 120, 7, 70, 70, false, false);
  3271. npc.forcedSpawn = true;
  3272. NpcHandler.getNpcHandler();
  3273. c.sendMessage(NpcHandler.getNpcListName(npcId) + ": has been spawned");
  3274. } else {
  3275. c.sendMessage("No such npc.");
  3276. }
  3277. }
  3278.  
  3279. if (cmd.toLowerCase().startsWith("cmb")) {
  3280. String[] args = cmd.split(" ");
  3281. c.newCombatLevel = Integer.parseInt(args[1]);
  3282. c.updateRequired = true;
  3283. c.setAppearanceUpdateRequired(true);
  3284. }
  3285.  
  3286. if (cmd.toLowerCase().startsWith("promote")) {
  3287. String[] args = cmd.split("-");
  3288. if (args.length != 3) {
  3289. c.sendMessage("Incorrect use! Use as ::promote-name-rights");
  3290. return;
  3291. }
  3292.  
  3293. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
  3294. if (otherPlayer == null) {
  3295. return;
  3296. }
  3297.  
  3298. int rights = Integer.parseInt(args[2]);
  3299.  
  3300. if (rights > 19) {
  3301. c.sendMessage("Invalid rights!");
  3302. return;
  3303. }
  3304.  
  3305. if (otherPlayer.rights == 3 && otherPlayer.playerId != c.playerId) {
  3306. c.sendMessage("You can't change that persons rights.");
  3307. return;
  3308. }
  3309.  
  3310. otherPlayer.rights = Integer.parseInt(args[2]);
  3311. if (otherPlayer.rights == 4) {
  3312. otherPlayer.rankIcon = 0;
  3313. otherPlayer.showRankIcon = true;
  3314. } else
  3315. otherPlayer.rankIcon = otherPlayer.rights;
  3316. otherPlayer.isSupporter = true;
  3317. otherPlayer.getPA().setPlayerInformation();
  3318. otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
  3319. c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
  3320. otherPlayer.getPA().updatePlayerRights();
  3321. FileManager.savePlayer(otherPlayer);
  3322. }
  3323.  
  3324. if (cmd.toLowerCase().startsWith("demote")) {
  3325. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7));
  3326. if (otherPlayer == null) {
  3327. return;
  3328. }
  3329.  
  3330. if (otherPlayer.rights == 3 && otherPlayer.playerId != c.playerId) {
  3331. c.sendMessage("That person can't be demoted!");
  3332. return;
  3333. }
  3334.  
  3335. otherPlayer.rights = 0;
  3336. otherPlayer.isSupporter = false;
  3337. otherPlayer.isEliteSupporter = false;
  3338. if (otherPlayer.isOldFag) {
  3339. otherPlayer.isOldFag = false;
  3340. otherPlayer.oldFagRevoked = true;
  3341. }
  3342. otherPlayer.isVip = false;
  3343. otherPlayer.rankIcon = 0;
  3344. otherPlayer.unlockedRankIcons.setBit(1, false);
  3345. otherPlayer.getPA().updatePlayerRights();
  3346. otherPlayer.getPA().setPlayerInformation();
  3347. otherPlayer.sendMessage("You have been demoted.");
  3348. c.sendMessage(otherPlayer.formattedName + " has been demoted.");
  3349. FileManager.savePlayer(otherPlayer);
  3350. }
  3351.  
  3352. if (cmd.toLowerCase().startsWith("unrevokeoldfag")) {
  3353. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(15));
  3354. if (otherPlayer == null) {
  3355. return;
  3356. }
  3357. otherPlayer.oldFagRevoked = false;
  3358. otherPlayer.disconnected = true;
  3359. c.sendMessage("You unrevoked " + otherPlayer.formattedName + "'s oldfag status.");
  3360. }
  3361.  
  3362. if (cmd.toLowerCase().startsWith("givesupporter")) {
  3363. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(14));
  3364. if (otherPlayer == null) {
  3365. return;
  3366. }
  3367. otherPlayer.isSupporter = true;
  3368. otherPlayer.showRankIcon = true;
  3369. otherPlayer.rankIcon = 2;
  3370. otherPlayer.unlockedRankIcons.setBit(2, true);
  3371. otherPlayer.getPA().setPlayerInformation();
  3372. otherPlayer.getPA().updatePlayerRights();
  3373. otherPlayer.sendMessage("You have been given Supporter privileges!");
  3374. c.sendMessage(otherPlayer.formattedName + ": has been given Supporter privileges!");
  3375. FileManager.savePlayer(otherPlayer);
  3376. }
  3377.  
  3378. if (cmd.toLowerCase().startsWith("givevip")) {
  3379. Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(8));
  3380. if (otherPlayer == null) {
  3381. return;
  3382. }
  3383. otherPlayer.isSupporter = true;
  3384. otherPlayer.isVip = true;
  3385. otherPlayer.showRankIcon = true;
  3386. otherPlayer.titleChangeCount = 0;
  3387. otherPlayer.rankIcon = 1;
  3388. otherPlayer.unlockedRankIcons.setBit(1, true);
  3389. otherPlayer.getPA().updateDisplayIconInterface();
  3390. otherPlayer.getPA().setPlayerInformation();
  3391. otherPlayer.getPA().updatePlayerRights();
  3392. otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
  3393. c.sendMessage(otherPlayer.formattedName + ": has been promoted to " + otherPlayer.getPA().getRank() + ".");
  3394. FileManager.savePlayer(otherPlayer);
  3395. }
  3396.  
  3397. // if (cmd.equalsIgnoreCase("server")) {
  3398. // for (int i = 8144; i < 8195; i++) {
  3399. // c.getPA().sendFrame126("", i);
  3400. // }
  3401. // c.getPA().sendFrame126("@dre@Server Commands", 8144);
  3402. // c.getPA().sendFrame126("", 8145);
  3403. // c.getPA().sendFrame126("@blu@::togglestake@bla@ - Toggles Staking[Currently: "+Server.getDisableStaking()+"]", 8147);
  3404. // c.getPA().sendFrame126("@blu@::toggletrade@bla@ - Toggles Trading[Currently: "+Server.getDisableTrade()+"]", 8148);
  3405. // c.getPA().sendFrame126("@blu@::toggleparty@bla@ - Toggles Party Room[Currently: "+Server.getDisablePartyRoom()+"]", 8149);
  3406. // c.getPA().sendFrame126("@blu@::togglege@bla@ - Toggles Grand Exchange[Currently: "+Server.getDisableGE()+"]", 8150);
  3407. // c.getPA().sendFrame126("@blu@::toggleshops@bla@ - Toggles Shops[Currently: "+Server.getDisableShop()+"]", 8151);
  3408. // c.getPA().showInterface(8134);
  3409. // }
  3410. //
  3411. // if (cmd.equalsIgnoreCase("togglestake")) {
  3412. // if(Server.getDisableStaking()) {
  3413. // Server.setDisableStaking(false);
  3414. // Engine.messageToAll("SERVER", "Duel arena staking has been ENABLED by: " + c.formattedName, 2);
  3415. // } else {
  3416. // Server.setDisableStaking(true);
  3417. // Engine.messageToAll("SERVER", "Duel arena staking has been DISABLED by: " + c.formattedName, 2);
  3418. // }
  3419. // c.getPA().sendFrame126("@blu@::togglestake@bla@ - Toggles Staking[Currently: "+Server.getDisableStaking()+"]", 8147);
  3420. // }
  3421. //
  3422. // if (cmd.equalsIgnoreCase("toggletrade")) {
  3423. // if(Server.getDisableTrade()) {
  3424. // Server.setDisableTrade(false);
  3425. // Engine.messageToAll("SERVER", "Trading has been ENABLED by: " + c.formattedName, 2);
  3426. // } else {
  3427. // Server.setDisableTrade(true);
  3428. // Engine.messageToAll("SERVER", "Trading has been DISABLED by: " + c.formattedName, 2);
  3429. // }
  3430. // c.getPA().sendFrame126("@blu@::toggletrade@bla@ - Toggles Trading[Currently: "+Server.getDisableTrade()+"]", 8148);
  3431. // }
  3432. //
  3433. // if (cmd.equalsIgnoreCase("toggleparty")) {
  3434. // if(Server.getDisablePartyRoom()) {
  3435. // Server.setDisablePartyRoom(false);
  3436. // Engine.messageToAll("SERVER", "The Party Room has been ENABLED by: " + c.formattedName, 2);
  3437. // } else {
  3438. // Server.setDisablePartyRoom(true);
  3439. // Engine.messageToAll("SERVER", "The Party Room has been DISABLED by: " + c.formattedName, 2);
  3440. // }
  3441. // c.getPA().sendFrame126("@blu@::toggleparty@bla@ - Toggles Party Room[Currently: "+Server.getDisablePartyRoom()+"]", 8149);
  3442. // }
  3443. //
  3444. // if (cmd.equalsIgnoreCase("togglege")) {
  3445. // if(Server.getDisableGE()) {
  3446. // Server.setDisableGE(false);
  3447. // Engine.messageToAll("SERVER", "The Grand Exchange has been ENABLED by: " + c.formattedName, 2);
  3448. // } else {
  3449. // Server.setDisableGE(true);
  3450. // Engine.messageToAll("SERVER", "The Grand Exchange has been DISABLED by: " + c.formattedName, 2);
  3451. // }
  3452. // c.getPA().sendFrame126("@blu@::togglege@bla@ - Toggles Grand Exchange[Currently: "+Server.getDisableGE()+"]", 8150);
  3453. // }
  3454. //
  3455. // if (cmd.equalsIgnoreCase("toggleshops")) {
  3456. // if(Server.getDisableShop()) {
  3457. // Server.setDisableShop(false);
  3458. // Engine.messageToAll("SERVER", "Shopping has been ENABLED by: " + c.formattedName, 2);
  3459. // } else {
  3460. // Server.setDisableShop(true);
  3461. // Engine.messageToAll("SERVER", "Shopping has been DISABLED by: " + c.formattedName, 2);
  3462. // }
  3463. // c.getPA().sendFrame126("@blu@::toggleshops@bla@ - Toggles Shops[Currently: "+Server.getDisableShop()+"]", 8151);
  3464. // }
  3465.  
  3466. if (cmd.toLowerCase().startsWith("getip")) {
  3467. Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(6));
  3468. if (otherPlayer == null) {
  3469. return;
  3470. }
  3471. c.sendMessage(otherPlayer.formattedName + ": " + otherPlayer.ipAddress);
  3472. }
  3473.  
  3474. if (cmd.toLowerCase().startsWith("getplayer")) {
  3475. String ip = cmd.substring(10);
  3476.  
  3477. int count = 0;
  3478.  
  3479. PlayerHandler.getPlayerHandler();
  3480. for (Player p : PlayerHandler.players) {
  3481. if (p == null) {
  3482. continue;
  3483. }
  3484. if (p.ipAddress.equals(ip)) {
  3485. c.sendMessage("IP Match (" + p.ipAddress + "): " + p.formattedName);
  3486. count++;
  3487. }
  3488. }
  3489.  
  3490. if (count == 0) {
  3491. c.sendMessage(ip + " doesn't match any players.");
  3492. }
  3493. }
  3494. }
  3495.  
  3496. private void hiddenAdministratorCommands(Client c, String cmd) {
  3497. if (cmd.equalsIgnoreCase("deathon")) {
  3498. c.canDie = true;
  3499. c.sendMessage("WARNING: Death turned on.");
  3500. }
  3501.  
  3502. if (cmd.equalsIgnoreCase("deathoff")) {
  3503. c.canDie = false;
  3504. c.sendMessage("WARNING: Death turned off.");
  3505. }
  3506. }
  3507.  
  3508. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement