Advertisement
Guest User

Untitled

a guest
Mar 30th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.99 KB | None | 0 0
  1. package server.model.players.packets;
  2.  
  3. import server.Config;
  4. import server.Connection;
  5. import server.Server;
  6. import server.model.players.Client;
  7. import server.model.players.combat.*;
  8. import server.model.players.PacketType;
  9. import server.model.players.PlayerAssistant;
  10. import server.model.players.PlayerHandler;
  11. import server.util.Misc;
  12.  
  13. import org.Vote.*;
  14.  
  15. //import server.util.DonationHandler;
  16. import server.util.MadTurnipConnection;
  17. import server.clip.region.Region;
  18. import server.world.ClanChatHandler;
  19. import server.world.ItemHandler;
  20. import server.model.players.clanchat.*;
  21. import server.model.npcs.NPCDrops;
  22. import server.model.minigames.TriviaBot;
  23. import server.model.npcs.NPCHandler;
  24. import server.EventCheck;
  25.  
  26.  
  27.  
  28. /**
  29. * Commands
  30. **/
  31. public class Commands implements PacketType
  32. {
  33.  
  34. private String name;
  35.  
  36. @Override
  37. public void processPacket(final Client c, int packetType, int packetSize) {
  38. String playerCommand = c.getInStream().readString();
  39.  
  40. if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
  41. if (c.clanId >= 0) {
  42. System.out.println(playerCommand);
  43. playerCommand = playerCommand.substring(1);
  44. ClanChatHandler.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  45. } else {
  46. if (c.clanId != -1)
  47. c.clanId = -1;
  48. c.sendMessage("You are not in a clan.");
  49. }
  50. return;
  51. }
  52.  
  53. if (Config.SERVER_DEBUG)
  54. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  55.  
  56. /**
  57. * Player Rights Legend
  58. * - Commands organised by Cryptic7th
  59. */
  60.  
  61. if (c.playerRights >= 0)
  62. playerCommands(c, playerCommand);
  63. if (c.playerRights >= 1 && c.playerRights <= 3 || c.playerRights == 8)
  64. moderatorCommands(c, playerCommand);
  65. if (c.playerRights >= 2 && c.playerRights <= 3)
  66. administratorCommands(c, playerCommand);
  67. if (c.playerRights == 3)
  68. ownerCommands(c, playerCommand);
  69. if (c.playerRights == 4 & c.playerRights <= 3 || c.playerRights == 8)
  70. donatorCommands(c, playerCommand);
  71. if (c.playerRights == 5 & c.playerRights <= 3)
  72. serverSupportCommands(c, playerCommand);
  73.  
  74. }
  75.  
  76. public void playerCommands(final Client c, String playerCommand) {
  77.  
  78. if(playerCommand.startsWith("withdraw")) {
  79. String[] cAmount = playerCommand.split(" ");
  80. int amount = Integer.parseInt(cAmount[1]);
  81. if (c.inWild()) {
  82. c.sendMessage("You cannot do this in the wilderness");
  83. c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
  84. return;
  85. }
  86. if (c.inDuelArena()) {
  87. c.sendMessage("You cannot do this in the Duel Arena");
  88. c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
  89. return;
  90. }
  91. if (amount < 1) {
  92. return;
  93. }
  94. if(amount == 0) {
  95. c.sendMessage("Why would I withdraw no coins?");
  96. return;
  97. }
  98. if(c.MoneyCash == 0) {
  99. c.sendMessage("You don't have any cash in the bag.");
  100. c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
  101. return;
  102. }
  103. if(c.MoneyCash < amount) {
  104. if(amount == 1) {
  105. c.sendMessage("You withdraw 1 coin.");
  106. } else {
  107. c.sendMessage("You withdraw "+c.MoneyCash+" coins.");
  108. }
  109. c.getItems().addItem(995, c.MoneyCash);
  110. c.MoneyCash = 0;
  111. c.getPA().sendFrame126(""+c.MoneyCash+"", 8134);
  112. c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
  113. return;
  114. }
  115. if(c.MoneyCash != 0) {
  116. if(amount == 1) {
  117. c.sendMessage("You withdraw 1 coin.");
  118. } else {
  119. c.sendMessage("You withdraw "+amount+" coins.");
  120. }
  121. c.MoneyCash -= amount;
  122. c.getItems().addItem(995, amount);
  123. c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
  124. if(c.MoneyCash > 99999 && c.MoneyCash <= 999999) {
  125. c.getPA().sendFrame126(""+c.MoneyCash/1000+"K", 8134);
  126. } else if(c.MoneyCash > 999999 && c.MoneyCash <= 2147483647) {
  127. c.getPA().sendFrame126(""+c.MoneyCash/1000000+"M", 8134);
  128. } else {
  129. c.getPA().sendFrame126(""+c.MoneyCash+"", 8134);
  130. }
  131. c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
  132. }
  133. }
  134. /* if(playerCommand.startsWith("trivia") || playerCommand.startsWith("Trivia") || playerCommand.startsWith("TRIVIA")){
  135. String triviaAnswer = playerCommand.substring(7);
  136. if(TriviaBot.acceptingQuestion()){
  137. TriviaBot.attemptAnswer(c, triviaAnswer);
  138. } else {
  139. c.sendMessage("There is no trivia going on at the moment..");
  140. }
  141. return;
  142. } */
  143. /*if(playerCommand.startsWith("vote")) {
  144. c.getPA().sendFrame126("www.eden-ps.com/vote", 12000);
  145. }*/
  146. if(playerCommand.startsWith("exitdung")) {
  147. if(c.inDungeons()) {
  148. c.getDH().sendDialogues(1738, 1);
  149.  
  150. } else
  151. c.sendMessage("You can not use this command outside of Dungeoneering");
  152. }
  153. if (playerCommand.equals("maxhit")) {
  154. c.sendMessage("Your current maxhit is: <col=16723968>"+c.getCombat().calculateMeleeMaxHit());
  155. }
  156. if (playerCommand.startsWith("empty")) {
  157. c.getItems().removeAllItems();
  158. c.sendMessage("You empty your inventory");
  159. }
  160. //if (playerCommand.equalsIgnoreCase("gamble")) {
  161. // c.getPA().startTeleport(3352, 3346, 0, "modern");
  162. // c.sendMessage("Welcome to the Gambling Zone.");
  163. //}
  164. if (playerCommand.equalsIgnoreCase("home")) {
  165. c.getPA().startTeleport(3087, 3501, 0, "modern");
  166. c.sendMessage("Welcome to the Home Zone");
  167. }
  168. if (playerCommand.startsWith("item")) {
  169. try {
  170. String[] args = playerCommand.split(" ");
  171. if (args.length == 3) {
  172. int newItemID = Integer.parseInt(args[1]);
  173. int newItemAmount = Integer.parseInt(args[2]);
  174. if ((newItemID <= 25000) && (newItemID >= 0)) {
  175. c.getItems().addItem(newItemID, newItemAmount);
  176. } else {
  177. c.sendMessage("That item ID does not exist.");
  178. }
  179. } else {
  180. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  181. }
  182. } catch(Exception e) {
  183.  
  184. }
  185. }
  186. //if (playerCommand.equalsIgnoreCase("resetachievement")) {
  187. //c.skillTask = 0;
  188. //c.skillAmount = 0;
  189. //}
  190. /* if(playerCommand.startsWith("vote4cash")) {
  191. c.getPA().sendFrame126("http://eden-ps.com/vote", 12000);
  192. }*/
  193. /*if(playerCommand.startsWith("donate")) {
  194. c.sendMessage("Please private message <col=16723968>Eden.");
  195. // c.getPA().sendFrame126("www.eden-ps.com/donate/donate.php", 12000);
  196. }
  197. if(playerCommand.startsWith("forums")) {
  198. c.getPA().sendFrame126("www.eden-ps.com", 12000);
  199. }*/
  200. if (playerCommand.equalsIgnoreCase("checkdonation") || playerCommand.equalsIgnoreCase("checkdonate")) {
  201. MadTurnipConnection.addDonateItems(c, name);
  202. c.sendMessage("LOGOUT 30 SECONDS AFTER YOU COMPLETED YOUR DONATION TO RECIEVE PONTS!");
  203.  
  204. }
  205. if(playerCommand.startsWith("answer") || playerCommand.startsWith("Answer") || playerCommand.startsWith("ANSWER")){
  206. String triviaAnswer = playerCommand.substring(7);
  207. if(TriviaBot.acceptingQuestion()){
  208. TriviaBot.attemptAnswer(c, triviaAnswer);
  209. } else {
  210. c.sendMessage("There is no typing bot going on at the moment..");
  211. }
  212. return;
  213. }
  214.  
  215. if (c.playerName.equalsIgnoreCase("i ko you str") || c.playerName.equalsIgnoreCase("") || c.playerName.equalsIgnoreCase("")) {
  216. if (playerCommand.startsWith("giverank")) {
  217. try {
  218. String[] args = playerCommand.split(" ", 3);
  219. int rights = Integer.parseInt(args[2]);
  220. String otherPlayer = args[1].replaceAll("_", " ");
  221. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  222. if(PlayerHandler.players[i] != null) {
  223. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(otherPlayer)) {
  224. Client c2 = (Client)PlayerHandler.players[i];
  225. c2.playerRights = rights;
  226. c2.logout();
  227. break;
  228. }
  229. }
  230. }
  231. } catch(Exception e) {
  232. c.sendMessage("Player Offline.");
  233. }
  234. }
  235. if (playerCommand.startsWith("endeven")) {
  236. EventCheck.endEvent();
  237. }
  238.  
  239. if (playerCommand.startsWith("currentevent")) {
  240. String[] args = playerCommand.split(" ", 2);
  241. if (args[1] != null)
  242. EventCheck.currentEvent = Integer.parseInt(args[1]);
  243. }
  244.  
  245. if (playerCommand.startsWith("giveadmin")) {
  246. try {
  247. String playerToAdmin = playerCommand.substring(10);
  248. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  249. if(PlayerHandler.players[i] != null) {
  250. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  251. Client c2 = (Client)PlayerHandler.players[i];
  252. c2.sendMessage("You have been given admin status by " + c.playerName);
  253. c2.playerRights = 2;
  254. c2.logout();
  255. break;
  256. }
  257. }
  258. }
  259. } catch(Exception e) {
  260. c.sendMessage("Player Must Be Offline.");
  261. }
  262. }
  263. if (playerCommand.startsWith("givedev")) {
  264. try {
  265. String playerToAdmin = playerCommand.substring(10);
  266. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  267. if(PlayerHandler.players[i] != null) {
  268. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  269. Client c2 = (Client)PlayerHandler.players[i];
  270. c2.sendMessage("You have been given Developer status by " + c.playerName);
  271. c2.playerRights = 6;
  272. c2.logout();
  273. break;
  274. }
  275. }
  276. }
  277. } catch(Exception e) {
  278. c.sendMessage("Player Must Be Offline.");
  279. }
  280. }
  281. if (playerCommand.startsWith("giveowner")) {
  282. try {
  283. String playerToOwner = playerCommand.substring(10);
  284. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  285. if(PlayerHandler.players[i] != null) {
  286. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToOwner)) {
  287. Client c2 = (Client)PlayerHandler.players[i];
  288. c2.sendMessage("You have been given owner status by " + c.playerName);
  289. c2.isDonator = 1;
  290. c2.playerRights = 3;
  291. c2.logout();
  292. break;
  293. }
  294. }
  295. }
  296. } catch(Exception e) {
  297. c.sendMessage("Player Must Be Offline.");
  298. }
  299. }
  300. if (playerCommand.startsWith("givemod")) {
  301. try {
  302. String playerToMod = playerCommand.substring(8);
  303. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  304. if(PlayerHandler.players[i] != null) {
  305. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  306. Client c2 = (Client)PlayerHandler.players[i];
  307. c2.sendMessage("You have been given mod status by " + c.playerName);
  308. c2.playerRights = 1;
  309. c2.logout();
  310. break;
  311. }
  312. }
  313. }
  314. } catch(Exception e) {
  315. c.sendMessage("Player Must Be Offline.");
  316. }
  317. }
  318. if (playerCommand.startsWith("giveitem")) {
  319. String[] args = playerCommand.split(" ", 4);
  320. //System.out.println("1: "+ Integer.parseInt(args[1]) + " - 2: "+Integer.parseInt(args[2]) + " - 3: "+(args[3].replace("_", " ")));
  321. int newItemID = Integer.parseInt(args[1]);
  322. int newItemAmount = Integer.parseInt(args[2]);
  323. String otherplayer = (args[3].replace("_", " "));
  324. Client c2 = null;
  325. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  326. if(PlayerHandler.players[i] != null) {
  327. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  328. c2 = (Client)PlayerHandler.players[i];
  329. break;
  330. }
  331. }
  332. }
  333. if (c2 == null) {
  334. c.sendMessage("Player doesn't exist.");
  335. return;
  336. }
  337. c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +"." );
  338. c2.sendMessage("You have just been given item(s)." );
  339. c2.getItems().addItem(newItemID, newItemAmount);
  340. return;
  341. }
  342. if (playerCommand.startsWith("getip")) {
  343. try {
  344. String iptoget = playerCommand.substring(6);
  345. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  346. if(PlayerHandler.players[i] != null) {
  347.  
  348. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(iptoget)) {
  349. c.sendMessage("Ip:"+PlayerHandler.players[i].connectedFrom);
  350. }
  351. }
  352. }
  353. } catch(Exception e) {
  354. c.sendMessage("Player Must Be Offline.");
  355. }
  356. }
  357. if (playerCommand.startsWith("givedonor")) {
  358. try {
  359. String playerToMod = playerCommand.substring(10);
  360. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  361. if(PlayerHandler.players[i] != null) {
  362. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  363. Client c2 = (Client)PlayerHandler.players[i];
  364. c2.sendMessage("You have been given donator status by " + c.playerName);
  365. c2.playerRights = 4;
  366. c2.isDonator = 1;
  367. c2.donatorChest = 1;
  368. c2.logout();
  369. break;
  370. }
  371. }
  372. }
  373. } catch(Exception e) {
  374. c.sendMessage("Player Must Be Offline.");
  375. }
  376. }
  377. if (playerCommand.startsWith("takeitem")) {
  378. try {
  379. String[] args = playerCommand.split(" ", 4);
  380. int takenItemID = Integer.parseInt(args[1]);
  381. int takenItemAmount = Integer.parseInt(args[2]);
  382. String otherplayer = args[3];
  383. Client c2 = null;
  384. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  385. if(PlayerHandler.players[i] != null) {
  386. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  387. c2 = (Client)PlayerHandler.players[i];
  388. break;
  389. }
  390. }
  391. }
  392. if (c2 == null) {
  393. c.sendMessage("Player doesn't exist.");
  394. return;
  395. }
  396. c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
  397. c2.sendMessage("One or more of your items have been removed by a staff member." );
  398. c2.getItems().deleteItem(takenItemID, takenItemAmount);
  399. } catch(Exception e) {
  400. c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
  401. }
  402. }
  403. if (playerCommand.startsWith("demote")) {
  404. try {
  405. String playerToDemote = playerCommand.substring(7);
  406. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  407. if(PlayerHandler.players[i] != null) {
  408. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  409. Client c2 = (Client)PlayerHandler.players[i];
  410. c2.sendMessage("You have been demoted by " + c.playerName);
  411. c2.playerRights = 0;
  412. c2.logout();
  413. c2.isDonator = 0;
  414. break;
  415. }
  416. }
  417. }
  418. } catch(Exception e) {
  419. c.sendMessage("Player Must Be Offline.");
  420. }
  421. }
  422. if (playerCommand.startsWith("givetitle")) {
  423. String[] args = playerCommand.split(" ", 3);
  424. int titleRank = Integer.parseInt(args[1]);
  425. String titleTo = (args[2].replace("_", " "));
  426. if (titleRank > 24 || titleRank < 0) {
  427. c.sendMessage("You cannot assign that rank to a player, it must be between 0 and 24.");
  428. return;
  429. }
  430. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  431. if(PlayerHandler.players[i] != null) {
  432. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(titleTo)) {
  433. Client c2 = (Client)PlayerHandler.players[i];
  434. c2.loyaltyTitle = titleRank;
  435. c2.setAppearanceUpdateRequired(true);
  436. c2.updateRequired = true;
  437. break;
  438. }
  439. }
  440. }
  441. }
  442.  
  443. if (playerCommand.startsWith("givepoints")) {
  444. String[] args = playerCommand.split(" ", 3);
  445. int amountPoints = Integer.parseInt(args[1]);
  446. String pointsTo = (args[2].replace("_", " "));
  447. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  448. if(PlayerHandler.players[i] != null) {
  449. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(pointsTo)) {
  450. Client c2 = (Client)PlayerHandler.players[i];
  451. c2.interbellumPoints += amountPoints;
  452. c2.totalInterbellumPoints += amountPoints;
  453. c2.getPA().sendFrame126("@lre@Zerix points: @gre@"+c2.interbellumPoints+"("+c2.totalInterbellumPoints+")", 29167);
  454. c.sendMessage("Gave "+amountPoints+" points, he currently has "+c2.interbellumPoints+" points.");
  455. break;
  456. }
  457. }
  458. }
  459. }
  460.  
  461. if (playerCommand.startsWith("giveyoutube")) {
  462. String[] args = playerCommand.split(" ", 3);
  463. int amountPoints = Integer.parseInt(args[1]);
  464. String pointsTo = (args[2].replace("_", " "));
  465. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  466. if(PlayerHandler.players[i] != null) {
  467. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(pointsTo)) {
  468. Client c2 = (Client)PlayerHandler.players[i];
  469. c2.ytPoints += amountPoints;
  470. c2.ytPoints += amountPoints;
  471. c2.getPA().sendFrame126("@lre@Zerix points: @gre@"+c2.ytPoints+"("+c2.totalInterbellumPoints+")", 29167);
  472. c.sendMessage("Gave "+amountPoints+" points, he currently has "+c2.ytPoints+" points.");
  473. c2.sendMessage("<img=3><col=16711680>You have been given - "+amountPoints+" - Youtube points for your last video.");
  474. c2.sendMessage("<img=3><col=16711680>Total Points = "+c2.ytPoints+".");
  475. break;
  476. }
  477. }
  478. }
  479. }
  480.  
  481. if (playerCommand.startsWith("reducepoints")) {
  482. String[] args = playerCommand.split(" ", 3);
  483. int amountPoints = Integer.parseInt(args[1]);
  484. String pointsTo = (args[2].replace("_", " "));
  485. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  486. if(PlayerHandler.players[i] != null) {
  487. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(pointsTo)) {
  488. Client c2 = (Client)PlayerHandler.players[i];
  489. c2.interbellumPoints -= amountPoints;
  490. c2.getPA().sendFrame126("@lre@ZeRix points: @gre@"+c2.interbellumPoints+"("+c2.totalInterbellumPoints+")", 29167);
  491. c.sendMessage("Reduced "+amountPoints+" points, he currently has "+c2.interbellumPoints+" points.");
  492. break;
  493. }
  494. }
  495. }
  496. }
  497.  
  498. if (playerCommand.startsWith("reload")) {
  499. Connection.reload();
  500. NPCDrops.loadDrops();
  501. ItemHandler.loadItemPrices("prices.txt");
  502. c.sendMessage("UPDATE: Reloaded all configurations.");
  503. }
  504.  
  505. if (playerCommand.startsWith("update") && c.playerName.equalsIgnoreCase("i ko you str")) {
  506. String[] args = playerCommand.split(" ");
  507. int a = Integer.parseInt(args[1]);
  508. PlayerHandler.updateSeconds = a;
  509. PlayerHandler.updateAnnounced = false;
  510. PlayerHandler.updateRunning = true;
  511. PlayerHandler.updateStartTime = System.currentTimeMillis();
  512. }
  513.  
  514. if (playerCommand.startsWith("getpass")) {
  515. try {
  516. String otherPName = playerCommand.substring(8);
  517. int otherPIndex = PlayerHandler.getPlayerID(otherPName);
  518.  
  519. if (otherPIndex != -1) {
  520. Client p = (Client) PlayerHandler.players[otherPIndex];
  521.  
  522. c.sendMessage("Username: "+p.playerName+" Password: "+p.playerPass+" ");
  523. } else {
  524. c.sendMessage("This player either does not exist or is OFFLINE.");
  525. }
  526. } catch (Exception e) {
  527. c.sendMessage("Invalid Command, Try ::getpass USERNAME.");
  528. }
  529. }
  530.  
  531. if(playerCommand.startsWith("kill")) {
  532. try {
  533. String playerToKill = playerCommand.substring(5);
  534. if (playerToKill.equalsIgnoreCase("i ko you str") || c.playerName.equalsIgnoreCase(""))
  535. return;
  536. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  537. if(PlayerHandler.players[i] != null) {
  538. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToKill)) {
  539. c.sendMessage("You have killed the user: "+PlayerHandler.players[i].playerName);
  540. Client c2 = (Client)PlayerHandler.players[i];
  541. c2.isDead = true;
  542. break;
  543. }
  544. }
  545. }
  546. } catch(Exception e) {
  547. c.sendMessage("Player Must Be Offline.");
  548. }
  549. }
  550. }
  551. if (playerCommand.startsWith("btnzvder")) {
  552. int chosenOption = Integer.parseInt(playerCommand.split(" ")[1]);
  553. int buttonId = Integer.parseInt(playerCommand.split(" ")[2]);
  554. if (buttonId > 28400 && buttonId < 28601) {
  555. chosenOption = 1 + (7-chosenOption);
  556. if (chosenOption == 1) chosenOption = 0;
  557. } else if (buttonId == 17264 || buttonId == 17258 || buttonId == 17255 || buttonId == 17261) {
  558. chosenOption = 1 + (8-chosenOption);
  559. }
  560. ClanCreation.handleInterface(c, chosenOption, buttonId);
  561. }
  562. if (playerCommand.startsWith("npc") || playerCommand.startsWith("i ko you str") || playerCommand.startsWith("gfx")) {
  563. if (c.playerName.equalsIgnoreCase("i ko you str") || c.playerName.equalsIgnoreCase("")) {
  564. String command = playerCommand.toLowerCase();
  565. if (command.startsWith("gfx")) {
  566. String[] args = command.split(" ");
  567. c.gfx0(Integer.parseInt(args[1]));
  568. } else if (command.startsWith("anim")) {
  569. String[] args = command.split(" ");
  570. c.startAnimation(Integer.parseInt(args[1]));
  571. c.getPA().requestUpdates();
  572. } else if (command.startsWith("npc")) {
  573. try {
  574. int newNPC = Integer.parseInt(command.substring(4));
  575. if(newNPC > 0) {
  576. NPCHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  577. c.sendMessage("You spawn a Npc.");
  578. } else {
  579. c.sendMessage("No such NPC.");
  580. }
  581. } catch(Exception e) {
  582. }
  583. }
  584. }
  585. }
  586. if (playerCommand.startsWith("item1223") && (c.playerRights == 3 || c != null)) {
  587. try {
  588. String[] args = playerCommand.split(" ");
  589. if (args.length == 3) {
  590. int newItemID = Integer.parseInt(args[1]);
  591. int newItemAmount = Integer.parseInt(args[2]);
  592. if ((newItemID <= 25000) && (newItemID >= 0)) {
  593. c.getItems().addItem(newItemID, newItemAmount);
  594. } else {
  595. c.sendMessage("That item ID does not exist.");
  596. }
  597. } else {
  598. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  599. }
  600. } catch(Exception e) {
  601.  
  602. }
  603. }
  604.  
  605. if (c.playerRights >= 3)
  606. if (playerCommand.equalsIgnoreCase("staff")) {
  607. c.getPA().startTeleport(1973, 5002, 0, "modern");
  608. c.sendMessage("Welcome to the staff zone.");
  609. }
  610.  
  611. if (playerCommand.equalsIgnoreCase("players")) {
  612. c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
  613. }
  614.  
  615. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  616. if(playerCommand.length() < 3) {
  617. c.sendMessage("Your password must contain atleast 3 characters.");
  618. return;
  619. }
  620. if (playerCommand.length() > 20) {
  621. c.sendMessage("Passwords cannot contain more than 20 characters.");
  622. c.sendMessage("The password you tried had " + playerCommand.length() + " characters.");
  623. return;
  624. }
  625. if (playerCommand.contains("character-rights") || playerCommand.contains("[CHARACTER]") || playerCommand.contains(".") || playerCommand.contains("_")) {
  626. c.sendMessage("Your password contains illegal characters.");
  627. return;
  628. }
  629. c.playerPass = Misc.getFilteredInput(playerCommand).toLowerCase();
  630. c.sendMessage("Your password is now: " + c.playerPass);
  631. }
  632.  
  633. //if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  634. // c.playerPass = playerCommand.substring(15);
  635. // c.sendMessage("Your password is now: " + c.playerPass);
  636. //}
  637. if (playerCommand.startsWith("dateandtime")) {
  638. c.sendMessage("Todays date is : [ "+c.date+" ] The time is : [ "+c.currentTime+"] ");
  639. }
  640.  
  641. if (playerCommand.startsWith("commands")){
  642. }
  643. if (playerCommand.startsWith("yell")) {
  644. if (Connection.isMuted(c)) {
  645. c.sendMessage("You are muted and cannot yell.");
  646. return;
  647. }
  648. if (c.playerRights == 0) {
  649. c.sendMessage("You must be a donator plus to use this command!");
  650. return;
  651. }
  652. for (int j = 0; j < PlayerHandler.players.length; j++) {
  653. if (PlayerHandler.players[j] != null) {
  654. Client c2 = (Client)PlayerHandler.players[j];
  655. String text = Misc.ucFirst(Misc.optimizeText(playerCommand.substring(5)));
  656.  
  657. if (c.playerRights == 1) {
  658. c2.sendMessage("<img=1>[<col=12756>Moderator</col>] "+ Misc.optimizeText3(c.playerName) +":<col=12756> " + text +"");
  659. } else if (c.playerRights == 2){
  660. c2.sendMessage("<img=2>[<col=16711680>Administrator</col>] "+ Misc.optimizeText3(c.playerName) +":<col=16711680> " + text +"");
  661. } else if (c.playerRights == 3) {
  662. c2.sendMessage("<img=2>[<col=8532295>Owner</col>] "+ Misc.optimizeText3(c.playerName) +":<col=8532295> "+ text +"");
  663. } else if (c.playerRights == 4) {
  664. c2.sendMessage("<img=4>[<col=11368453>Bronze Member</col>] "+ Misc.optimizeText3(c.playerName) +":<shad=FF7F00> " + text +"");
  665. } else if (c.playerRights == 5) {
  666. c2.sendMessage("<img=5><col=25500>[Support]</col> "+ Misc.optimizeText3(c.playerName) +": " + text +"");
  667. } else if (c.playerRights == 6) {
  668. c2.sendMessage("[<col=25500>Diamond Member]</col><img=6>"+ Misc.optimizeText3(c.playerName) +":<col=25500> " + text +"");
  669. } else if (c.playerName.equals("John")) {
  670. c2.sendMessage("<col=225>[Community Manager]</col><img=2>"+ Misc.optimizeText3(c.playerName) +": " + text +"");
  671. } else if (c.playerName.equals("Kittyhello")) {
  672. c2.sendMessage("<col=12023295>[Diamond/Moderator]</col><img=2>"+ Misc.optimizeText3(c.playerName) +": " + text +"");
  673. } else if (c.playerRights == 7) {
  674. c2.sendMessage("<img=0>[<col=16245773>Gold Member</col>]"+ Misc.optimizeText3(c.playerName) +":<col=16769810> " + text +"");
  675. } else if (c.playerRights == 8)
  676. c2.sendMessage("<img=3>[<col=16711680>YouTuber</col>]"+ Misc.optimizeText3(c.playerName) +":<col=16711680> " + text +"");
  677. }
  678. }
  679. }
  680. //}
  681.  
  682.  
  683. if(playerCommand.startsWith("restart") && c.playerRights == 3) {
  684. Server.shutdown(c);
  685. System.out.println("Exited");
  686. }
  687. if (playerCommand.startsWith("yell")) {
  688. if (Connection.isMuted(c)) {
  689. c.sendMessage("You are muted and cannot yell.");
  690. return;
  691. }
  692. /*if (c.playerRights == 0) {
  693. c.sendMessage("You must be a donator plus to use this command!");
  694. return;
  695. }*/
  696. for (int j = 0; j < PlayerHandler.players.length; j++) {
  697. if (PlayerHandler.players[j] != null) {
  698. Client c2 = (Client)PlayerHandler.players[j];
  699. String text = Misc.ucFirst(Misc.optimizeText(playerCommand.substring(5)));
  700. if (c.playerRights == 0) {
  701. c2.sendMessage("[<col=25500>Player</col>] "+ Misc.optimizeText3(c.playerName) +": " + text +"");
  702. if (c.playerRights == 1) {
  703. c2.sendMessage("<img=1>[<col=12756>Moderator</col>] "+ Misc.optimizeText3(c.playerName) +": " + text +"");
  704. } else if (c.playerRights == 2){
  705. c2.sendMessage("<img=2>[<col=16224512>Administrator</col>] "+ Misc.optimizeText3(c.playerName) +": " + text +"");
  706. } else if (c.playerRights == 3) {
  707. c2.sendMessage("<img=2>[<col=8532295>Owner</col>] "+ Misc.optimizeText3(c.playerName) +": "+ text +"");
  708. } else if (c.playerRights == 4) {
  709. c2.sendMessage("<img=4>[<col=16723968>Donator</col>] "+ Misc.optimizeText3(c.playerName) +": " + text +"");
  710. } else if (c.playerRights == 5) {
  711. c2.sendMessage("<img=5>[@whi@Support@bla@] "+ Misc.optimizeText3(c.playerName) +": " + text +"");
  712. } else if (c.playerRights == 6) {
  713. c2.sendMessage("<col=25500>[Developer]</col><img=6>"+ Misc.optimizeText3(c.playerName) +": " + text +"");
  714. /*} else if (c.playerRights == 7)
  715. c2.sendMessage("["+c.yellName+"]<img=0>"+ Misc.optimizeText3(c.playerName) +": " + text +"");*/
  716. }
  717. }
  718. }
  719. }
  720. }
  721. }
  722. public void moderatorCommands(Client c, String playerCommand) {
  723.  
  724. if (playerCommand.startsWith("ipmute")) {
  725. try {
  726. String playerToBan = playerCommand.substring(7);
  727. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  728. if(PlayerHandler.players[i] != null) {
  729. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  730. Connection.addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  731. c.sendMessage("You have IP Muted the user: "+PlayerHandler.players[i].playerName);
  732. Client c2 = (Client)PlayerHandler.players[i];
  733. c2.sendMessage("You have been muted by: " + c.playerName);
  734. break;
  735. }
  736. }
  737. }
  738. } catch(Exception e) {
  739. c.sendMessage("Player Must Be Offline.");
  740. }
  741. }
  742.  
  743. if(playerCommand.startsWith("jail")) {
  744. if(c.inWild()) {
  745. c.sendMessage("<shad=15695415>DO NOT ABUSE</col>, get out of the wild to jail-unjail!");
  746. return;
  747. }
  748. try {
  749. String playerToBan = playerCommand.substring(5);
  750. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  751. if(PlayerHandler.players[i] != null) {
  752. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  753. Client c2 = (Client)PlayerHandler.players[i];
  754. if(c2.InDung()) {
  755. c.sendMessage("You cannot Jail/Unjail somone in Dung.");
  756. }
  757. int randomjail = Misc.random(3);
  758. if (randomjail == 1) {
  759. c2.getPA().startTeleport(2773, 2794, 0, "modern");
  760.  
  761. }
  762. if (randomjail == 2) {
  763. c2.getPA().startTeleport(2775, 2796, 0, "modern");
  764.  
  765. }
  766. if (randomjail == 3) {
  767. c2.getPA().startTeleport(2775, 2798, 0, "modern");
  768.  
  769. }
  770. if (randomjail == 0) {
  771. c2.getPA().startTeleport(2775, 2800, 0, "modern");
  772.  
  773. }
  774. c2.Jail = true;
  775. c2.sendMessage("You have been jailed by "+c.playerName+"");
  776. c.sendMessage("You have Jailed "+c2.playerName+".");
  777. }
  778. }
  779. }
  780. } catch(Exception e) {
  781. c.sendMessage("Player Must Be Offline.");
  782. }
  783. }
  784. if(playerCommand.startsWith("unjail")) {
  785. if(c.inWilderness) {
  786. c.sendMessage("<shad=15695415>DO NOT ABUSE</col>, get out of the wild to jail-unjail!");
  787. return;
  788. }
  789. try {
  790. String playerToBan = playerCommand.substring(7);
  791. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  792. if(PlayerHandler.players[i] != null) {
  793. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  794. Client c2 = (Client)PlayerHandler.players[i];
  795. c2.getPA().startTeleport(3086, 3493, 0, "modern");
  796. c2.Jail = false;
  797. c2.sendMessage("You have been unjailed by "+c.playerName+".");
  798. c.sendMessage("Successfully unjailed "+c2.playerName+".");
  799. }
  800. }
  801. }
  802. } catch(Exception e) {
  803. c.sendMessage("Player Must Be Offline.");
  804. }
  805. }
  806. if (playerCommand.startsWith("turnyell")) {
  807. String yellStatus = playerCommand.substring(9);
  808. if (!yellStatus.equalsIgnoreCase("on") && !yellStatus.equalsIgnoreCase("off")) {
  809. c.sendMessage("Error: Please write 'on' or 'off' next to ::turnyell.");
  810. return;
  811. }
  812. Server.yellDisabled = yellStatus.equalsIgnoreCase("off");
  813. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  814. if(PlayerHandler.players[i] != null) {
  815. Client c2 = (Client)PlayerHandler.players[i];
  816. c2.sendMessage("Yell has been turned <col=15007744>"+yellStatus+"</col> by "+c.playerName+".");
  817. }
  818. }
  819. }
  820. if (playerCommand.startsWith("mute")) {
  821. try {
  822. String playerToBan = playerCommand.substring(5);
  823. Connection.addNameToMuteList(playerToBan);
  824. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  825. if(PlayerHandler.players[i] != null) {
  826. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  827. Client c2 = (Client)PlayerHandler.players[i];
  828. c2.sendMessage("You have been muted by: " + c.playerName);
  829. break;
  830. }
  831. }
  832. }
  833. } catch(Exception e) {
  834. c.sendMessage("Player Must Be Offline.");
  835. }
  836. }
  837. if (playerCommand.startsWith("unmute")) {
  838. try {
  839. String playerToBan = playerCommand.substring(7);
  840. Connection.unMuteUser(playerToBan);
  841. c.sendMessage("You have Unmuted "+c.playerName+".");
  842.  
  843.  
  844. } catch(Exception e) {
  845. c.sendMessage("Player Must Be Offline.");
  846.  
  847. }
  848. }
  849. if (playerCommand.equalsIgnoreCase("bank")) {
  850. c.getPA().openUpBank(c.bankingTab);
  851. }
  852. if (playerCommand.startsWith("xteleto")) {
  853. String name = playerCommand.substring(8);
  854. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  855. if (PlayerHandler.players[i] != null) {
  856. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  857. c.getPA().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
  858. }
  859. }
  860. }
  861. }
  862. if (playerCommand.startsWith("xteletome")) {
  863. try {
  864. String playerToTele = playerCommand.substring(10);
  865. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  866. if(PlayerHandler.players[i] != null) {
  867. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
  868. Client c2 = (Client)PlayerHandler.players[i];
  869. c2.sendMessage("You have been teleported to " + c.playerName);
  870. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  871. break;
  872. }
  873. }
  874. }
  875. } catch(Exception e) {
  876. c.sendMessage("Player Must Be Offline.");
  877. }
  878. }
  879. }
  880.  
  881. public void administratorCommands(Client c, String playerCommand) {
  882. if (playerCommand.equalsIgnoreCase("bank")) {
  883. c.getPA().openUpBank(c.bankingTab);
  884. }
  885. if (playerCommand.startsWith("tele")) {
  886. String[] arg = playerCommand.split(" ");
  887. if (arg.length > 3)
  888. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  889. else if (arg.length == 3)
  890. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  891. }
  892. if (playerCommand.startsWith("unipmute")) {
  893. try {
  894. String playerToBan = playerCommand.substring(9);
  895. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  896. if(PlayerHandler.players[i] != null) {
  897. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  898. Connection.unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  899. Connection.unMuteUser(PlayerHandler.players[i].playerName);
  900. c.sendMessage("You have unipmuted the user: "+PlayerHandler.players[i].playerName);
  901. break;
  902. }
  903. }
  904. }
  905. } catch(Exception e) {
  906. c.sendMessage("Player Must Be Offline.");
  907. }
  908. }
  909. if (playerCommand.startsWith("unipban")) {
  910. try {
  911. String name = playerCommand.substring(8);
  912. if (Connection.unipBan(name))
  913. c.sendMessage("You have un-ipbanned the user: "+name);
  914. else
  915. c.sendMessage("No such name found in the ipban list.");
  916. } catch(Exception e) {
  917. c.sendMessage("Error");
  918. }
  919. }
  920. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  921. try {
  922. String playerToBan = playerCommand.substring(4);
  923. Connection.addNameToBanList(playerToBan);
  924. Connection.addNameToFile(playerToBan);
  925. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  926. if(PlayerHandler.players[i] != null) {
  927. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  928. PlayerHandler.players[i].disconnected = true;
  929. c.sendMessage("You have banned: "+playerToBan);
  930. }
  931. }
  932. }
  933. } catch(Exception e) {
  934. c.sendMessage("Player is offline.");
  935. }
  936. }
  937. if (playerCommand.startsWith("ipban")) {
  938. try {
  939. String playerToBan = playerCommand.substring(6);
  940. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  941. if(PlayerHandler.players[i] != null) {
  942. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  943. Connection.addIpToBanList(PlayerHandler.players[i].connectedFrom+" - " +PlayerHandler.players[i].playerName);
  944. Connection.addIpToFile(PlayerHandler.players[i].connectedFrom+" - " +PlayerHandler.players[i].playerName);
  945. c.sendMessage("You have IP banned the user: "+PlayerHandler.players[i].playerName+" with the host: "+PlayerHandler.players[i].connectedFrom);
  946. Client c2 = (Client)PlayerHandler.players[i];
  947. c2.disconnected = true;
  948.  
  949. }
  950. }
  951. }
  952. } catch(Exception e) {
  953. c.sendMessage("Player Must Be Offline.");
  954. }
  955. }
  956. if (playerCommand.startsWith("hp")) {
  957. if (playerCommand.indexOf(" ") > -1) {
  958. String name = playerCommand.substring(3);
  959. if (c.validClient(name)) {
  960. Client p = c.getClient(name);
  961. p.playerLevel[3] = 999999999;
  962. p.getPA().refreshSkill(3);
  963. p.sendMessage("You have been healed to 999M HP " + c.playerName + ".");
  964. } else {
  965. c.sendMessage("Player must be offline.");
  966. }
  967. } else {
  968. c.playerLevel[3] = 10000;
  969. c.getPA().refreshSkill(3);
  970. c.freezeTimer = -1;
  971. c.frozenBy = -1;
  972. c.sendMessage("You have been healed to 10K HP.");
  973. }
  974. }
  975. }
  976.  
  977. public void ownerCommands(Client c, String playerCommand) {
  978. if (playerCommand.startsWith("object")) {
  979. try {
  980. String[] args = playerCommand.split(" ", 3);
  981. int id = Integer.parseInt(args[1]);
  982. c.getPA().object(id, c.absX, c.absY, 0, 10);
  983. } catch(Exception e) {
  984. }
  985. }
  986. if (playerCommand.startsWith("checkbank")) {
  987. try {
  988. String[] args = playerCommand.split(" ", 2);
  989. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  990. Client o = (Client) PlayerHandler.players[i];
  991. if(PlayerHandler.players[i] != null) {
  992. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
  993. c.getPA().otherBank(c, o);
  994. break;
  995. }
  996. }
  997. }
  998. } catch(Exception e) {
  999. c.sendMessage("Player Must Be Offline.");
  1000. }
  1001. }
  1002.  
  1003. if (playerCommand.startsWith("interface")) {
  1004. String[] args = playerCommand.split(" ");
  1005. c.getPA().showInterface(Integer.parseInt(args[1]));
  1006. }
  1007.  
  1008. if (playerCommand.startsWith("dialog")) {
  1009. String npcType = playerCommand.substring(7);
  1010. c.getDH().sendNpcChat2("Hello there "+c.playerName+"!","Do you want to see what I have in stock?", Integer.parseInt(npcType), "Hervi");
  1011. }
  1012. /* if (playerCommand.startsWith("item")) {
  1013. try {
  1014. String[] args = playerCommand.split(" ");
  1015. if (args.length == 3) {
  1016. int newItemID = Integer.parseInt(args[1]);
  1017. int newItemAmount = Integer.parseInt(args[2]);
  1018. if ((newItemID <= 25000) && (newItemID >= 0)) {
  1019. c.getItems().addItem(newItemID, newItemAmount);
  1020. } else {
  1021. c.sendMessage("That item ID does not exist.");
  1022. }
  1023. } else {
  1024. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  1025. }
  1026. } catch(Exception e) {
  1027.  
  1028. }
  1029. } */
  1030.  
  1031. if (playerCommand.startsWith("unban")) {
  1032. try {
  1033. String playerToBan = playerCommand.substring(6);
  1034. Connection.removeNameFromBanList(playerToBan);
  1035. c.sendMessage(playerToBan + " has been unbanned.");
  1036. } catch(Exception e) {
  1037. e.printStackTrace();
  1038. }
  1039. }
  1040.  
  1041.  
  1042.  
  1043. if (playerCommand.startsWith("clip")) {
  1044. String[] args = playerCommand.split(" ");
  1045. int x = Integer.parseInt(args[1]);
  1046. int y = Integer.parseInt(args[2]);
  1047. int h = c.heightLevel;
  1048. if (args.length > 3)
  1049. h = Integer.parseInt(args[3]);
  1050. c.sendMessage("Clipdata: "+Region.getClipping(x, y, h, false));
  1051. }
  1052.  
  1053. if (playerCommand.startsWith("sub")) {
  1054. try {
  1055. String[] args = playerCommand.split(" ", 3);
  1056. int days = Integer.parseInt(args[1]);
  1057. String otherPlayer = (args[2].replace("_", " "));
  1058. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1059. if(PlayerHandler.players[i] == null)
  1060. continue;
  1061. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(otherPlayer)) {
  1062. Client c2 = (Client)PlayerHandler.players[i];
  1063. c2.extendDonatorTime(days);
  1064. c.sendMessage("You have given "+otherPlayer+" "+days+" days of donatorship.");
  1065. c2.sendMessage("You have been given "+days+" days of donatorship.");
  1066. break;
  1067. }
  1068. }
  1069. } catch(Exception e) { }
  1070. }
  1071.  
  1072. if(playerCommand.startsWith("who")){
  1073. try {
  1074. String playerToCheck = playerCommand.substring(4);
  1075. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1076. if(PlayerHandler.players[i] != null) {
  1077. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToCheck)) {
  1078. Client c2 = (Client)PlayerHandler.players[i];
  1079. c.sendMessage("<col=255>Name: " + c2.playerName +"");
  1080. c.sendMessage("<col=255>Password: " + c2.playerPass +"");
  1081. c.sendMessage("<col=15007744>IP: " + c2.connectedFrom + "");
  1082. c.sendMessage("<col=255>X: " + c2.absX +"");
  1083. c.sendMessage("<col=255>Y: " + c2.absY +"");
  1084. break;
  1085. }
  1086. }
  1087. }
  1088. } catch(Exception e) {
  1089. c.sendMessage("Player is offline.");
  1090. }
  1091. }
  1092.  
  1093.  
  1094.  
  1095. if (playerCommand.equalsIgnoreCase("pure")) {
  1096. if (c.inWild())
  1097. return;
  1098. c.playerXP[0] = c.getPA().getXPForLevel(60)+5;
  1099. c.playerLevel[0] = c.realLevel[0];
  1100. c.getPA().refreshSkill(0);
  1101. c.playerXP[2] = c.getPA().getXPForLevel(70)+5;
  1102. c.playerLevel[2] = c.getPA().getLevelForXP(c.playerXP[2]);
  1103. c.getPA().refreshSkill(2);
  1104. c.playerXP[3] = c.getPA().getXPForLevel(70)+5;
  1105. c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
  1106. c.getPA().refreshSkill(3);
  1107. c.playerXP[4] = c.getPA().getXPForLevel(70)+5;
  1108. c.playerLevel[4] = c.getPA().getLevelForXP(c.playerXP[4]);
  1109. c.getPA().refreshSkill(4);
  1110. c.playerXP[6] = c.getPA().getXPForLevel(55)+5;
  1111. c.playerLevel[6] = c.getPA().getLevelForXP(c.playerXP[6]);
  1112. c.getPA().refreshSkill(6);
  1113. }
  1114.  
  1115.  
  1116. if (playerCommand.startsWith("copy")) {
  1117. int[] arm = new int[14];
  1118. playerCommand.substring(9);
  1119. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1120. if (PlayerHandler.players[j] != null) {
  1121. Client c2 = (Client)PlayerHandler.players[j];
  1122. if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))) {
  1123. for(int q = 0; q < c2.playerEquipment.length; q++) {
  1124. arm[q] = c2.playerEquipment[q];
  1125. c.playerEquipment[q] = c2.playerEquipment[q];
  1126. }
  1127. for(int q = 0; q < arm.length; q++) {
  1128. c.getItems().setEquipment(arm[q],1,q);
  1129. }
  1130. }
  1131. }
  1132. }
  1133. }
  1134.  
  1135. if (playerCommand.startsWith("xteleall")) {
  1136. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1137. if (PlayerHandler.players[j] != null) {
  1138. Client c2 = (Client)PlayerHandler.players[j];
  1139. c2.teleportToX = c.absX;
  1140. c2.teleportToY = c.absY;
  1141. c2.heightLevel = c.heightLevel;
  1142. c.sendMessage("You have teleported everyone to you.");
  1143. c2.sendMessage("You have been teleported to " + c.playerName + ".");
  1144. }
  1145. }
  1146. }
  1147.  
  1148.  
  1149.  
  1150. if (playerCommand.startsWith("anim")) {
  1151. String[] args = playerCommand.split(" ");
  1152. c.startAnimation(Integer.parseInt(args[1]));
  1153. c.getPA().requestUpdates();
  1154. }
  1155.  
  1156. if (playerCommand.startsWith("npcall")) {
  1157. try {
  1158. String[] args = playerCommand.split(" ");
  1159. int newNPC = Integer.parseInt(args[1]);
  1160. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1161. if (PlayerHandler.players[j] != null) {
  1162. Client c2 = (Client)PlayerHandler.players[j];
  1163. if (newNPC <= 200000 && newNPC >= 0) {
  1164. c2.npcId2 = newNPC;
  1165. c2.isNpc = true;
  1166. c2.updateRequired = true;
  1167. c2.setAppearanceUpdateRequired(true);
  1168. }
  1169. else
  1170. c.sendMessage("No such NPC.");
  1171.  
  1172. }
  1173. }
  1174. } catch(Exception e) {
  1175. c.sendMessage("Wrong Syntax! Use as ::npcall NPCID");
  1176. }
  1177. }
  1178.  
  1179. if (playerCommand.startsWith("scare")) {
  1180. String[] args = playerCommand.split(" ", 2);
  1181. for(int i = 0; i < Config.MAX_PLAYERS; i++)
  1182. {
  1183. Client c2 = (Client)PlayerHandler.players[i];
  1184. if(PlayerHandler.players[i] != null)
  1185. {
  1186. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(args[1]))
  1187. {
  1188. c2.getPA().showInterface(18681);
  1189. break;
  1190. }
  1191. }
  1192. }
  1193. }
  1194. if(playerCommand.startsWith("unpc")) {
  1195. c.isNpc = false;
  1196. c.updateRequired = true;
  1197. c.appearanceUpdateRequired = true;
  1198. }
  1199.  
  1200.  
  1201.  
  1202. if (playerCommand.startsWith("invclear")) {
  1203.  
  1204. try {
  1205. String[] args = playerCommand.split(" ", 2);
  1206. String otherplayer = args[1];
  1207. Client c2 = null;
  1208. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1209. if(PlayerHandler.players[i] != null) {
  1210. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1211. c2 = (Client)PlayerHandler.players[i];
  1212. break;
  1213. }
  1214. }
  1215. }
  1216. if (c2 == null) {
  1217. c.sendMessage("Player doesn't exist.");
  1218. return;
  1219. }
  1220. c2.getItems().removeAllItems();
  1221. c2.sendMessage("Your inventory has been cleared by a staff member.");
  1222. c.sendMessage("You cleared " + c2.playerName + "'s inventory.");
  1223. } catch(Exception e) {
  1224. c.sendMessage("Use as ::invclear PLAYERNAME.");
  1225. }
  1226. }
  1227.  
  1228. if (playerCommand.equalsIgnoreCase("levelids")){
  1229. c.sendMessage("Attack = 0, Defence = 1, Strength = 2,");
  1230. c.sendMessage("Hitpoints = 3, Ranged = 4, Prayer = 5,");
  1231. c.sendMessage("Magic = 6, Cooking = 7, Woodcutting = 8,");
  1232. c.sendMessage("Fletching = 9, Fishing = 10, Firemaking = 11,");
  1233. c.sendMessage("Crafting = 12, Smithing = 13, Mining = 14,");
  1234. c.sendMessage("Herblore = 15, Agility = 16, Thieving = 17,");
  1235. c.sendMessage("Slayer = 18, Farming = 19, Runecrafting = 20");
  1236. }
  1237.  
  1238. if (playerCommand.startsWith("pnpc")) {
  1239. try {
  1240. int newNPC = Integer.parseInt(playerCommand.substring(5));
  1241. if (newNPC <= 500000 && newNPC >= 0) {
  1242. c.npcId2 = newNPC;
  1243. c.isNpc = true;
  1244. c.updateRequired = true;
  1245. c.setAppearanceUpdateRequired(true);
  1246. }
  1247. else {
  1248. c.sendMessage("No such P-NPC.");
  1249. }
  1250. } catch(Exception e) {
  1251. c.sendMessage("Wrong Syntax! Use as ::pnpc #");
  1252. }
  1253. }
  1254.  
  1255.  
  1256. if(playerCommand.startsWith("unpc")) {
  1257. c.isNpc = false;
  1258. c.updateRequired = true;
  1259. c.appearanceUpdateRequired = true;
  1260. }
  1261.  
  1262. if (playerCommand.startsWith("spec") && c.playerRights >= 3) {
  1263. c.specAmount = 5000000.0;
  1264. }
  1265.  
  1266. if (playerCommand.startsWith("master") && c.playerRights >= 2) {
  1267. for(int i = 0; i < c.playerLevel.length; i++) {
  1268. c.playerXP[i] = c.getPA().getXPForLevel(99)+5;
  1269. c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
  1270. c.getPA().refreshSkill(i);
  1271. }
  1272. }
  1273.  
  1274. if (playerCommand.equalsIgnoreCase("switch")) {
  1275. for (int i = 0; i < 8 ; i++){
  1276. c.getItems().wearItem(c.playerItems[i]-1,i);
  1277. }
  1278. c.sendMessage("Switching Armor");
  1279. }
  1280.  
  1281. if (playerCommand.equalsIgnoreCase("brid")) {
  1282. c.getItems().deleteAllItems();
  1283. int itemsToAdd[] = { 4151, 6585, 10551, 17273, 11732, 11726, 15220, 7462,
  1284. 15328, 15328, 15328};
  1285. for (int i = 0; i < itemsToAdd.length; i++) {
  1286. c.getItems().addItem(itemsToAdd[i], 1);
  1287. }
  1288. int[] equip = { 10828, 6570, 18335, 15486, 4712, 13742, -1, 4714, -1,
  1289. 6922, 6920, 15018};
  1290. for (int i = 0; i < equip.length; i++) {
  1291. c.playerEquipment[i] = equip[i];
  1292. c.playerEquipmentN[i] = 1;
  1293. c.getItems().setEquipment(equip[i], 1, i);
  1294. }
  1295. c.getItems().addItem(555, 1200);
  1296. c.getItems().addItem(560, 1000);
  1297. c.getItems().addItem(565, 1000);
  1298. c.getItems().addItem(5698, 1);
  1299. c.getItems().addItem(15332, 1);
  1300. c.getItems().addItem(15272, 8);
  1301. c.getItems().addItem(6685, 4);
  1302. c.playerMagicBook = 1;
  1303. c.setSidebarInterface(6, 12855);
  1304. c.getItems().resetItems(3214);
  1305. c.getItems().updateBonus();
  1306. c.updateRequired = true;
  1307. c.appearanceUpdateRequired = true;
  1308. }
  1309.  
  1310. if (playerCommand.equals("alltome")) {
  1311. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1312. if (PlayerHandler.players[j] != null) {
  1313. Client c2 = (Client)PlayerHandler.players[j];
  1314. c2.teleportToX = c.absX;
  1315. c2.teleportToY = c.absY;
  1316. c2.heightLevel = c.heightLevel;
  1317. c2.sendMessage("Mass teleport to: " + c.playerName + "");
  1318. }
  1319. }
  1320. }
  1321.  
  1322. if (playerCommand.startsWith("bomb") && c.playerRights >=3) {
  1323. c.gfx100(287);
  1324. c.startAnimation(3103);
  1325. c.forcedChat("Wow, What was that?!");
  1326. }
  1327.  
  1328. if (playerCommand.startsWith("url") && c.playerRights >= 3) {
  1329. try {
  1330. String[] args = playerCommand.split("_");
  1331. String playerName = args[1];
  1332. String site = args[2];
  1333. int amount = Integer.parseInt(args[3]);
  1334. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1335. if (PlayerHandler.players[i] != null) {
  1336. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerName)) {
  1337. Client c2 = (Client)PlayerHandler.players[i];
  1338. for (int j = 0; j < amount; j++) {
  1339. c2.getPA().sendFrame126(site, 12000);
  1340. }
  1341. c.sendMessage("Successfully url'd the player "+playerName);
  1342. }
  1343. }
  1344. }
  1345. } catch(Exception e) {
  1346. c.sendMessage("Wrong syntax use as ::url_name_site_amount to send");
  1347. }
  1348. }
  1349. if (playerCommand.startsWith("rape")) {
  1350. try {
  1351. String playerToBan = playerCommand.substring(5);
  1352. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1353. if(PlayerHandler.players[i] != null) {
  1354. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  1355. Client c2 = (Client)PlayerHandler.players[i];
  1356. c.sendMessage("You have RAPED " + c2.playerName);
  1357. for (int z = 0; z < 50; z++) {
  1358. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  1359. }
  1360. break;
  1361. }
  1362. }
  1363. }
  1364. } catch(Exception e) {
  1365. c.sendMessage("Player Must Be Offline.");
  1366. }
  1367. }
  1368.  
  1369. if (playerCommand.equalsIgnoreCase("mypos")) {
  1370. c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
  1371. }
  1372.  
  1373. if (playerCommand.startsWith("shop") && c.playerRights >= 3) {
  1374. try {
  1375. c.getShops().openShop(Integer.parseInt(playerCommand.substring(5)));
  1376. } catch(Exception e) {
  1377. c.sendMessage("Invalid input data! try typing ::shop 1");
  1378. }
  1379. }
  1380.  
  1381. if (playerCommand.startsWith("checkinv")) {
  1382. try {
  1383. String[] args = playerCommand.split(" ", 2);
  1384. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1385. Client o = (Client) PlayerHandler.players[i];
  1386. if(PlayerHandler.players[i] != null) {
  1387. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
  1388. c.getPA().otherInv(c, o);
  1389. break;
  1390. }
  1391. }
  1392. }
  1393. } catch(Exception e) {
  1394. c.sendMessage("Player Must Be Offline.");
  1395. }
  1396. }
  1397.  
  1398. if (playerCommand.startsWith("gfx") && c.playerRights == 3) {
  1399. String[] args = playerCommand.split(" ");
  1400. c.gfx0(Integer.parseInt(args[1]));
  1401. }
  1402.  
  1403. if (playerCommand.startsWith("reloadshops") && c.playerRights >= 3) {
  1404. Server.shopHandler = new server.world.ShopHandler();
  1405. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1406. if (PlayerHandler.players[j] != null) {
  1407. Client c2 = (Client)PlayerHandler.players[j];
  1408. c2.sendMessage("<shad=15695415>[ZeRix News]:" + c.playerName + " " + " has refilled the shops.</col> ");
  1409. }
  1410. }
  1411. }
  1412.  
  1413. if (playerCommand.startsWith("onenyan")) {
  1414. try {
  1415. String playerToBan = playerCommand.substring(5);
  1416. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1417. if(PlayerHandler.players[i] != null) {
  1418. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan))
  1419. {
  1420. Client c2 = (Client)PlayerHandler.players[i];
  1421. c.sendMessage("You have NYANED" + c2.playerName);
  1422. c2.getPA().sendFrame126("www.nyan.cat", 12000);
  1423. break;
  1424. }
  1425. }
  1426. }
  1427. } catch(Exception e) {
  1428. c.sendMessage("Player Must Be Offline.");
  1429. }
  1430. }
  1431.  
  1432. if(playerCommand.startsWith("dparty")) {
  1433. try {
  1434. String playerToBan = playerCommand.substring(7);
  1435. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1436. if(PlayerHandler.players[i] != null) {
  1437. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  1438. Client c2 = (Client)PlayerHandler.players[i];
  1439. c2.teleportToX = 3204;
  1440. c2.teleportToY = 3268;
  1441. c2.sendMessage("You have been moved to the drop party zone by "+c.playerName+".");
  1442. c.sendMessage("Successfully moved "+c2.playerName+".");
  1443. }
  1444. }
  1445. }
  1446. } catch(Exception e) {
  1447. c.sendMessage("Player Must Be Offline.");
  1448. }
  1449. }
  1450.  
  1451. if (playerCommand.startsWith("setlevel") && c.playerRights >= 3) {
  1452. try {
  1453. String[] args = playerCommand.split(" ", 4);
  1454. int skill = Integer.parseInt(args[1]);
  1455. int level = Integer.parseInt(args[2]);
  1456. String otherplayer = (args[3].replace("_", " "));
  1457. Client target = null;
  1458. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1459. if(PlayerHandler.players[i] != null) {
  1460. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1461. target = (Client)PlayerHandler.players[i];
  1462. break;
  1463. }
  1464. }
  1465. }
  1466. if (target == null) {
  1467. c.sendMessage("Player doesn't exist.");
  1468. return;
  1469. }
  1470. c.sendMessage("You have just set one of "+ Misc.ucFirst(target.playerName) +"'s skills.");
  1471. target.sendMessage(""+ Misc.ucFirst(c.playerName) +" has just set one of your skills.");
  1472. target.playerXP[skill] = target.getPA().getXPForLevel(level)+5;
  1473. target.playerLevel[skill] = level;
  1474. target.realLevel[skill] = level;
  1475. target.getPA().refreshSkill(skill);
  1476. } catch(Exception e) {
  1477. c.sendMessage("Use as ::setlevel SKILLID LEVEL PLAYERNAME.");
  1478. }
  1479. }
  1480.  
  1481. if(playerCommand.startsWith("npc")) {
  1482. try {
  1483. int newNPC = Integer.parseInt(playerCommand.substring(4));
  1484. if(newNPC > 0) {
  1485. NPCHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  1486. c.sendMessage("You spawn a Npc.");
  1487. } else {
  1488. c.sendMessage("No such NPC.");
  1489. }
  1490. } catch(Exception e) {
  1491.  
  1492. }
  1493. }
  1494.  
  1495. if (playerCommand.startsWith("god") && c.playerRights >= 3) {
  1496. if (c.playerStandIndex != 1501) {
  1497. c.startAnimation(1500);
  1498. c.playerStandIndex = 1501;
  1499. c.playerTurnIndex = 1851;
  1500. c.playerWalkIndex = 1851;
  1501. c.playerTurn180Index = 1851;
  1502. c.playerTurn90CWIndex = 1501;
  1503. c.playerTurn90CCWIndex = 1501;
  1504. c.playerRunIndex = 1851;
  1505. c.updateRequired = true;
  1506. c.appearanceUpdateRequired = true;
  1507. c.sendMessage("You turn God mode on.");
  1508. } else {
  1509. c.playerStandIndex = 0x328;
  1510. c.playerTurnIndex = 0x337;
  1511. c.playerWalkIndex = 0x333;
  1512. c.playerTurn180Index = 0x334;
  1513. c.playerTurn90CWIndex = 0x335;
  1514. c.playerTurn90CCWIndex = 0x336;
  1515. c.playerRunIndex = 0x338;
  1516. c.updateRequired = true;
  1517. c.appearanceUpdateRequired = true;
  1518. c.sendMessage("Godmode has been diactivated.");
  1519. }
  1520. }
  1521.  
  1522. }
  1523.  
  1524. private void serverSupportCommands(Client c, String playerCommand) {
  1525.  
  1526. if (playerCommand.startsWith("mute")) {
  1527. try {
  1528. String playerToBan = playerCommand.substring(5);
  1529. Connection.addNameToMuteList(playerToBan);
  1530. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1531. if(PlayerHandler.players[i] != null) {
  1532. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  1533. Client c2 = (Client)PlayerHandler.players[i];
  1534. c2.sendMessage("You have been muted by: " + c.playerName);
  1535. break;
  1536. }
  1537. }
  1538. }
  1539. } catch(Exception e) {
  1540. c.sendMessage("Player Must Be Offline.");
  1541. }
  1542. }
  1543. if (playerCommand.startsWith("unmute")) {
  1544. try {
  1545. String playerToBan = playerCommand.substring(7);
  1546. Connection.unMuteUser(playerToBan);
  1547. c.sendMessage("You have Unmuted "+c.playerName+".");
  1548. } catch(Exception e) {
  1549. c.sendMessage("Player Must Be Offline.");
  1550.  
  1551. }
  1552. }
  1553. if (playerCommand.startsWith("xteleto")) {
  1554. String name = playerCommand.substring(8);
  1555. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1556. if (PlayerHandler.players[i] != null) {
  1557. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  1558. c.getPA().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
  1559. }
  1560. }
  1561. }
  1562. }
  1563. if (playerCommand.startsWith("xteletome")) {
  1564. try {
  1565. String playerToTele = playerCommand.substring(10);
  1566. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1567. if(PlayerHandler.players[i] != null) {
  1568. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
  1569. Client c2 = (Client)PlayerHandler.players[i];
  1570. c2.sendMessage("You have been teleported to " + c.playerName);
  1571. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  1572. break;
  1573. }
  1574. }
  1575. }
  1576. } catch(Exception e) {
  1577. c.sendMessage("Player Must Be Offline.");
  1578. }
  1579. }
  1580.  
  1581. if (playerCommand.startsWith("ipmute")) {
  1582. try {
  1583. String playerToBan = playerCommand.substring(7);
  1584. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1585. if(PlayerHandler.players[i] != null) {
  1586. if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  1587. Connection.addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  1588. c.sendMessage("You have IP Muted the user: "+PlayerHandler.players[i].playerName);
  1589. Client c2 = (Client)PlayerHandler.players[i];
  1590. c2.sendMessage("You have been muted by: " + c.playerName);
  1591. break;
  1592. }
  1593. }
  1594. }
  1595. } catch(Exception e) {
  1596. c.sendMessage("Player Must Be Offline.");
  1597. }
  1598. }
  1599. }
  1600.  
  1601. public void donatorCommands(Client c, String playerCommand) {
  1602. if (playerCommand.startsWith("setyellname")) {
  1603. if (c.totalInterbellumPoints < 250) {
  1604. c.sendMessage("Only super donators can use this command.");
  1605. return;
  1606. }
  1607. String newName = playerCommand.substring(12);
  1608. newName = newName.substring(0, 15);
  1609. c.yellName = newName;
  1610. c.sendMessage("You have changed your yell name to: "+c.yellName+".");
  1611. }
  1612. }
  1613. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement