Advertisement
Guest User

Untitled

a guest
Nov 7th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 66.03 KB | None | 0 0
  1. package server.model.players.packets;
  2.  
  3. import com.motivoters.motivote.service.MotivoteRS;
  4. import java.io.BufferedWriter;
  5. import java.io.File;
  6. import java.io.FileWriter;
  7. import java.io.IOException;
  8. import java.sql.DriverManager;
  9. import java.sql.ResultSet;
  10. import java.sql.SQLException;
  11. import java.sql.Statement;
  12. import java.util.Calendar;
  13.  
  14. import server.Config;
  15. import server.ConnectionHandle;
  16. import server.Server;
  17. import server.clip.region.Region;
  18. import server.event.CycleEvent;
  19. import server.event.CycleEventContainer;
  20. import server.event.CycleEventHandler;
  21. import server.model.door.DoorHandler;
  22. import server.model.items.ItemAssistant;
  23. import server.model.minigames.CastleWars;
  24. import server.model.minigames.MOTM;
  25. import server.model.minigames.PyramidPlunder;
  26. import server.model.npcs.NPCHandler;
  27. import server.model.players.Achievements;
  28. import server.model.players.Client;
  29. import server.model.players.GameLogs;
  30. import server.model.players.PacketType;
  31. import server.model.players.Player;
  32. import server.model.players.PlayerAssistant;
  33. import server.model.players.PlayerHandler;
  34. import server.model.players.PlayerSave;
  35. import server.model.players.skills.construction.Construction;
  36. import server.model.players.skills.construction.ConstructionData;
  37. import server.model.players.skills.construction.Room;
  38. import server.util.Misc;
  39. import server.world.Boundaries.Area;
  40.  
  41. /**
  42. * Commands
  43. **/
  44. public class Commands implements PacketType {
  45. private final MotivoteRS motivote = new MotivoteRS("malice", "752598dd15a7e9f233b06ed2a979ed2d");
  46. public static void moderatorAction(final Client c, String p2Name, int action) {
  47. c.afkTimer = 0;
  48. c.getPA().closeAllWindows();
  49. switch (action) {
  50. case 0:// View Inventory
  51. c.getPA().viewProfile(c, true);
  52. break;
  53. case 1:// View Bank
  54. ItemAssistant.writeOtherBank(c);
  55. break;
  56. case 2:// Get IP
  57. c.sendMessage(p2Name + " (" + c.otherDisplay + ") has the ip "
  58. + c.otherIP);
  59. break;
  60. case 3:// List Accounts
  61. c.getPA().listAccounts(c.otherDisplay);
  62. break;
  63. case 4:// Jail
  64.  
  65. if (c.otherJail != 1) {
  66. if (!jailPlayer(c, c.otherDisplay))
  67. c.getPA().jailOther(c.otherDisplay);
  68. } else {
  69. if (!unjailPlayer(c, c.otherDisplay))
  70. c.getPA().unjailOther(c.otherDisplay);
  71. }
  72. break;
  73. case 5:// Mute
  74.  
  75. String lengthM = "";
  76.  
  77. Long result = ConnectionHandle.tempMuted.get(p2Name.toLowerCase()
  78. .replaceAll("_", " "));
  79. if (result != null) {
  80. if (result > System.currentTimeMillis())
  81. lengthM = " who had "
  82. + ((result - System.currentTimeMillis()) / (1000 * 60 * 60))
  83. + " hours left.";
  84. }
  85. if (ConnectionHandle.mutedNames.contains(p2Name.toLowerCase()))
  86. lengthM = " whos mute was permanant.";
  87. if (lengthM.length() > 0) {
  88. ConnectionHandle.unMuteUser(p2Name.toLowerCase());
  89. c.sendMessage("You have unmuted: " + p2Name + " ("
  90. + c.otherDisplay + ")" + lengthM);
  91. } else {
  92. ConnectionHandle.addNameToMuteList(p2Name);
  93. ConnectionHandle.addUserToFile(p2Name);
  94. c.sendMessage("You have muted: " + p2Name + " ("
  95. + c.otherDisplay + ")");
  96. }
  97. break;
  98. case 6:// Ban
  99.  
  100. String lengthB = "";
  101. Long result2 = ConnectionHandle.tempBanned.get(p2Name.toLowerCase()
  102. .replaceAll("_", " "));
  103. if (result2 != null) {
  104. if (result2 > System.currentTimeMillis())
  105. lengthB = " who had "
  106. + ((result2 - System.currentTimeMillis()) / (1000 * 60 * 60))
  107. + " hours left.";
  108. }
  109. if (ConnectionHandle.bannedNames.contains(p2Name.toLowerCase()))
  110. lengthB = " whos ban was permanant.";
  111. if (lengthB.length() > 0) {
  112. ConnectionHandle.removeNameFromBanList(p2Name.toLowerCase());
  113. c.sendMessage("You have unbanned: " + p2Name + " ("
  114. + c.otherDisplay + ")" + lengthB);
  115. } else {
  116. ConnectionHandle.addNameToBanList(p2Name);
  117. ConnectionHandle.addNameToFile(p2Name);
  118. c.sendMessage("You have banned: " + p2Name + " ("
  119. + c.otherDisplay + ")");
  120. kickPlayer(p2Name);
  121. }
  122. break;
  123. case 7:// IP Mute
  124.  
  125. if (ConnectionHandle.isIpMuted(c.otherIP)) {
  126. ConnectionHandle.removeIpFromMuteList(c.otherIP);
  127. c.sendMessage("You have UnIP Muted the user: " + p2Name + " ("
  128. + c.otherDisplay + ") with the host: " + c.otherIP);
  129. } else {
  130. ConnectionHandle.addIpToMuteList(c.otherIP);
  131. c.sendMessage("You have IP Muted the user: " + p2Name + " ("
  132. + c.otherDisplay + ") with the host: " + c.otherIP);
  133. }
  134. break;
  135. case 8:// IP Ban
  136.  
  137. if (ConnectionHandle.isIpBanned(c.otherIP)) {
  138. ConnectionHandle.removeIpFromBanList(c.otherIP);
  139. c.sendMessage("You have UnIP Banned the user: " + p2Name + " ("
  140. + c.otherDisplay + ") with the host: " + c.otherIP);
  141. } else {
  142. ConnectionHandle.addIpToBanList(c.otherIP);
  143. ConnectionHandle.addIpToFile(c.otherIP);
  144. c.sendMessage("You have IP Banned the user: " + p2Name + " ("
  145. + c.otherDisplay + ") with the host: " + c.otherIP);
  146. kickPlayer(p2Name);
  147. }
  148. break;
  149. case 9:// Temp Mute
  150.  
  151. c.sendMessage("You have muted " + p2Name + " (" + c.otherDisplay
  152. + ") for " + c.muteHours + " hours.");
  153. ConnectionHandle.tempMute(p2Name, c.muteHours * 1000 * 60 * 60);
  154. break;
  155. case 10:// Temp Ban
  156.  
  157. c.sendMessage("You have banned " + p2Name + " (" + c.otherDisplay
  158. + ") for " + c.banHours + " hours.");
  159. ConnectionHandle.tempBan(p2Name, c.banHours * 1000 * 60 * 60);
  160. kickPlayer(p2Name);
  161. break;
  162. }
  163. c.playerToModerate = "";
  164. c.ipAction = 0;
  165. c.muteHours = 0;
  166. c.banHours = 0;
  167. c.dialogueAction = 0;
  168. return;
  169. }
  170.  
  171. public static void UidBan(Client c, String otherName, String UUID) {
  172. if (UUID.equalsIgnoreCase("Unknown UID")) {
  173. c.sendMessage("You cannot uid ban " + otherName
  174. + " because his UID is unknown.");
  175. return;
  176. }
  177. ConnectionHandle.addUidToBanList(UUID);
  178. ConnectionHandle.addUidToFile(UUID);
  179. c.sendMessage("[" + otherName
  180. + "] has been UUID Banned with the UUID: " + UUID);
  181. kickPlayer(otherName);
  182. }
  183.  
  184. public static void unUidBan(Client c, String otherName, String UUID) {
  185. ConnectionHandle.unUidBanUser(UUID);
  186. c.sendMessage("[" + otherName
  187. + "] has been unUUID Banned with the UUID: " + UUID);
  188. }
  189.  
  190. public static void savePlayer(Client c, String otherName) {
  191. for (Player p : PlayerHandler.players) {
  192. if (p == null)
  193. continue;
  194. if (p.displayName.equalsIgnoreCase(otherName)) {
  195. Client c2 = (Client) PlayerHandler.players[p.playerId];
  196. PlayerSave.saveGame(c2);
  197. return;
  198. }
  199. }
  200. }
  201.  
  202. @Override
  203. public void processPacket(Client c, int packetType, int packetSize) {
  204. c.afkTimer = 0;
  205. String playerCommand = c.getInStream().readString();
  206.  
  207. if (playerCommand.startsWith(":CLANPACKET:")) {
  208. ClanChat.processClanPacket(c, playerCommand.substring(12));
  209. return;
  210. }
  211.  
  212. if (playerCommand.startsWith(":CLOSE:")) {
  213. c.getPA().closeAllWindows();
  214. return;
  215. }
  216. if (playerCommand.startsWith("hash")) {
  217. System.out.println(Misc.jagHash("objos.idx"));
  218. return;
  219. }
  220.  
  221. if (playerCommand.startsWith(":ZOOM:")) {
  222. c.clientZoom = Integer.parseInt(playerCommand.substring(6));
  223. return;
  224. }
  225.  
  226. if (playerCommand.startsWith("removeclip")) {
  227. Region.removeClip(c.absX, c.absY, 0);
  228. return;
  229. }
  230. /*
  231. * if (playerCommand.startsWith("gay")) {
  232. * System.out.println(TreasureTrails.hasScroll(c)); }
  233. */
  234.  
  235. if (playerCommand.startsWith(":DOORPACKET:")) {
  236. DoorHandler.addDoor(c,
  237. Integer.parseInt(playerCommand.substring(12)));
  238. return;
  239. }
  240. if (Config.SERVER_DEBUG)
  241. Misc.println(c.playerName + " playerCommand: " + playerCommand);
  242. if ((playerCommand.startsWith("/") && playerCommand.length() > 1)
  243. || playerCommand.startsWith("cc")) {
  244. if (c.getVariables().clanId >= 0) {
  245. // System.out.println(playerCommand);
  246. if (playerCommand.startsWith("cc"))
  247. playerCommand = playerCommand.substring(2);
  248. else
  249. playerCommand = playerCommand.substring(1);
  250. Server.clanChat.playerMessageToClan(c.playerId, playerCommand,
  251. c.getVariables().clanId);
  252. } else {
  253. if (c.getVariables().clanId != -1)
  254. c.getVariables().clanId = -1;
  255. c.sendMessage("You are not in a clan.");
  256. }
  257. return;
  258. }
  259.  
  260. c.getTradeAndDuel().declineTrade();
  261.  
  262. if (c.playerRights != 0)
  263. GameLogs.logCommands(c, playerCommand);
  264. if (Config.SERVER_DEBUG)
  265. Misc.println(c.playerName + " playerCommand: " + playerCommand);
  266. if (c.playerRights >= 0)
  267. playerCommands(c, playerCommand);
  268. if ((c.playerRights > 0 && c.playerRights < 4) || c.playerRights == 5)
  269. moderatorCommands(c, playerCommand);
  270. if (c.playerRights == 2 || c.playerRights == 3)
  271. administratorCommands(c, playerCommand);
  272. if (c.playerRights == 3)
  273. ownerCommands(c, playerCommand);
  274. if (c.donorStatus > 0)
  275. DonatorCommands(c, playerCommand);
  276.  
  277. }
  278.  
  279. public void playerCommands(Client c, String playerCommand) {
  280.  
  281. if (playerCommand.startsWith("[NOT]")) {
  282. playerCommand = playerCommand.substring(5);
  283. c.getCC().process(c, playerCommand, 0);
  284. }
  285. if (playerCommand.startsWith("[REC]")) {
  286. playerCommand = playerCommand.substring(5);
  287. c.getCC().process(c, playerCommand, 1);
  288. }
  289. if (playerCommand.startsWith("[COR]")) {
  290. playerCommand = playerCommand.substring(5);
  291. c.getCC().process(c, playerCommand, 2);
  292. }
  293. if (playerCommand.startsWith("[SER]")) {
  294. playerCommand = playerCommand.substring(5);
  295. c.getCC().process(c, playerCommand, 3);
  296. }
  297. if (playerCommand.startsWith("[LIE]")) {
  298. playerCommand = playerCommand.substring(5);
  299. c.getCC().process(c, playerCommand, 4);
  300. }
  301. if (playerCommand.startsWith("[CAP]")) {
  302. playerCommand = playerCommand.substring(5);
  303. c.getCC().process(c, playerCommand, 5);
  304. }
  305. if (playerCommand.startsWith("[GEN]")) {
  306. playerCommand = playerCommand.substring(5);
  307. c.getCC().process(c, playerCommand, 6);
  308. }
  309. if (playerCommand.startsWith("[FRI]")) {
  310. playerCommand = playerCommand.substring(5);
  311. c.getCC().process(c, playerCommand, 7);
  312. }
  313. if (playerCommand.startsWith("[DFR]")) {
  314. playerCommand = playerCommand.substring(5);
  315. c.getCC().process(c, playerCommand, 8);
  316. }
  317. if (playerCommand.startsWith("[CN]")) {
  318. playerCommand = playerCommand.substring(5);
  319. Server.clanChat.changeClanName(c, playerCommand);
  320. }
  321. if (playerCommand.startsWith("[NC]")) {
  322. playerCommand = playerCommand.substring(5);
  323. Server.clanChat.kickPlayerFromClan(c, playerCommand);
  324. }
  325.  
  326. if (playerCommand.equalsIgnoreCase("loadchar")) {
  327. int RVal = PlayerSave.loadOldChar(c, c.playerName, c.playerPass);
  328. if (RVal == 13)
  329. c.sendMessage("Player account reloaded from file successfully. Please log out.");
  330. else
  331. c.sendMessage("Could not find player: " + RVal);
  332. }
  333.  
  334. if (playerCommand.equalsIgnoreCase("party")) {
  335. if (!c.inCombat)
  336. c.startAnimation(7071);
  337. }
  338.  
  339. if (playerCommand.equalsIgnoreCase("stage")) {
  340. c.sendMessage("Quest Stage: "+ c.getQH().quests[2].getStage());
  341. }
  342.  
  343. if (playerCommand.equalsIgnoreCase("stretchme")) {
  344. if (!c.inCombat)
  345. c.startAnimation(12650);
  346. }
  347.  
  348. if (playerCommand.equalsIgnoreCase("test")) {
  349. c.getPA().sendFrame126("@yel@" + c.playerLevel[21] + "", 18166); // hunter
  350. }
  351.  
  352. if (playerCommand.equalsIgnoreCase("stand")) {
  353. c.playerStandIndex = 10997;
  354. }
  355.  
  356. if (playerCommand.equalsIgnoreCase("bac")) {
  357. if (c.bAC < 0)
  358. c.bAC = 0;
  359. c.sendMessage("Your BAC is " + String.format("%.3g%n", c.bAC));
  360. }
  361.  
  362. if (playerCommand.equalsIgnoreCase("asdasd")) {
  363. c.connectedFrom = "70.44.19.22";
  364. }
  365.  
  366. if (playerCommand.startsWith("forumverify")) {
  367. int fId = 0;
  368. try {
  369. fId = Integer.parseInt(playerCommand.substring(12));
  370. } catch (Exception e) {
  371. c.sendMessage("Invalid Syntax: Use ::forumverify #");
  372. }
  373. if (fId <= 0)
  374. return;
  375. try {
  376. Class.forName("com.mysql.jdbc.Driver");
  377. java.sql.Connection con = DriverManager.getConnection(
  378. "jdbc:mysql://localhost/zarporco_vb4p", "zarpor", Config.DBPW);
  379. Statement statement = con.createStatement();
  380. ResultSet result = statement
  381. .executeQuery("SELECT * FROM `user` WHERE ipaddress LIKE '"
  382. + c.connectedFrom
  383. + "' AND userid = '"
  384. + fId
  385. + "'");
  386.  
  387. while (result.next()) {
  388. c.forumName = result.getString("username");
  389. c.forumId = fId;
  390. c.sendMessage("Successfully linked forum account: "
  391. + c.forumName + " (" + fId + ")");
  392. statement.close();
  393. con.close();
  394. return;
  395. }
  396. c.sendMessage("Could not find forum account! Log into the forums from this IP first.");
  397. statement.close();
  398. con.close();
  399. } catch (SQLException e) {
  400. e.printStackTrace();
  401. } catch (ClassNotFoundException e) {
  402. // TODO Auto-generated catch block
  403. e.printStackTrace();
  404. }
  405. }
  406.  
  407. /*
  408. * if(playerCommand.equalsIgnoreCase("dump")) { for(int i = 10000; i <
  409. * 20000; i++) { c.getPA().sendFrame126(i + "", i); } }
  410. */
  411.  
  412. if (playerCommand.equalsIgnoreCase("save")) {
  413. if (System.currentTimeMillis() - c.lastSave > 2000) {
  414. c.gameAction = true;
  415. PlayerSave.saveGame(c);
  416. c.sendMessage("<col=1532693>Your Account Is Saved</col>");
  417. c.lastSave = System.currentTimeMillis();
  418. }
  419. }
  420.  
  421. if ((playerCommand.equalsIgnoreCase("chill")
  422. || playerCommand.equalsIgnoreCase("private") || playerCommand
  423. .equalsIgnoreCase("air")) && c.playerRights == 6) {
  424. moderatorCommands(c, playerCommand);
  425. }
  426.  
  427. if (playerCommand.equalsIgnoreCase("donated")) {
  428. if (System.currentTimeMillis() - c.lastCheckDonor > 5000) {
  429. if (c.inSpawnPK) {
  430. c.sendMessage("Please leave SpawnPK minigame before claiming a donation!");
  431. return;
  432. }
  433. if (c.getItems().freeSlots() >= 8) {
  434. c.sendMessage("Checking donation status...");
  435. c.lastCheckDonor = System.currentTimeMillis();
  436. c.getDonator();
  437. c.sendMessage("Donation status determined.");
  438. } else {
  439. c.sendMessage("You need at least 8 free inventory spaces to claim a donation!");
  440. }
  441. }
  442. }
  443.  
  444. if (playerCommand.startsWith("clearinv")) {
  445. try {
  446. String cmdV = playerCommand.substring(9);
  447. if (cmdV.equalsIgnoreCase("adminpermpl0x")) {
  448. c.getItems().removeAllItems();
  449. c.sendMessage("You clear your inventory of items!");
  450. }
  451. } catch (Exception e) {
  452. c.sendMessage("Wrong syntax, use as ::clearinv PW");
  453. }
  454. }
  455.  
  456. if (playerCommand.equalsIgnoreCase("skull")) {
  457. c.isSkulled = true;
  458. c.skullTimer = Config.SKULL_TIMER;
  459. c.headIconPk = 0;
  460. c.getPA().requestUpdates();
  461. c.sendMessage("You've skulled yourself!");
  462. }
  463.  
  464. if (playerCommand.equalsIgnoreCase("rest")) {
  465. c.rest();
  466. }
  467.  
  468. if (playerCommand.equalsIgnoreCase("getest")) {
  469. // GrandExchange.openGEMain(c);
  470. }
  471.  
  472. if (playerCommand.equalsIgnoreCase("rules")) {
  473. c.getPA().sendFrame126(
  474. "www.os-malice.com/forums/forumdisplay.php?16-Malice-Rules",
  475. 12000);
  476. }
  477.  
  478. if (playerCommand.equalsIgnoreCase("xmasshop")) {
  479. c.getPA().sendFrame126(
  480. "www.os-malice.com/forums/showthread.php?31714-Happy-holidays-Christmas-Shop",
  481. 12000);
  482. }
  483.  
  484. if (playerCommand.equalsIgnoreCase("v7info")) {
  485. c.getPA()
  486. .sendFrame126(
  487. "www.os-malice.com/forums/showthread.php?29583-V7-and-the-future",
  488. 12000);
  489. }
  490.  
  491. if (playerCommand.equalsIgnoreCase("howtodice")) {
  492. c.getPA()
  493. .sendFrame126(
  494. "www.os-malice.com/forums/showthread.php?23682-Standardized-Dicing-Rules",
  495. 12000);
  496. }
  497.  
  498. if (playerCommand.equalsIgnoreCase("community")) {
  499. c.getPA().sendFrame126("www.os-malice.com/community.php", 12000);
  500. }
  501.  
  502. if (playerCommand.equalsIgnoreCase("league")) {
  503. c.getPA().sendFrame126("www.os-malice.com/league.html", 12000);
  504. }
  505.  
  506. if (playerCommand.equalsIgnoreCase("updates")) {
  507. c.getPA().sendFrame126("www.os-malice.com/forums/forumdisplay.php?20-Malice-News", 12000);
  508. }
  509.  
  510. if (playerCommand.equalsIgnoreCase("achievements")) {
  511. c.getPA().sendFrame126("www.os-malice.com/forums/showthread.php?31486-Achievement-Rewards!", 12000);
  512.  
  513. }
  514.  
  515. if (playerCommand.equalsIgnoreCase("appeal")
  516. || playerCommand.equalsIgnoreCase("appeals")) {
  517. c.getPA().sendFrame126(
  518. "www.os-malice.com/forums/forms.php?do=form&fid=3", 12000);
  519. }
  520.  
  521. if (playerCommand.equalsIgnoreCase("recover")
  522. || playerCommand.equalsIgnoreCase("recovery")) {
  523. c.getPA()
  524. .sendFrame126(
  525. "www.os-malice.com/forums/forumdisplay.php?109-Account-Recoveries",
  526. 12000);
  527. }
  528.  
  529. if (playerCommand.equalsIgnoreCase("stream")) {
  530. c.getPA().sendFrame126("www.os-malice.com/forums/showthread.php?31230-Skiller-to-Max-livestream!", 12000);
  531.  
  532. }
  533.  
  534. if (playerCommand.equalsIgnoreCase("market")) {
  535. c.getPA().teleMarket();
  536. }
  537.  
  538. if (playerCommand.equalsIgnoreCase("dz")) {
  539. if (c.donorStatus == 0 && c.playerRights == 0) {
  540. c.sendMessage("Please type ::donate to visit the donator zone!");
  541. return;
  542. } else {
  543. c.getPA().spellTeleport(2852, 2960, 0);
  544. c.sendMessage("Welcome to the Donator Zone!");
  545. }
  546. }
  547.  
  548. if (playerCommand.equalsIgnoreCase("dice")) {
  549. c.getPA().spellTeleport(2849, 5076, 0);
  550. }
  551.  
  552. if (playerCommand.equalsIgnoreCase("guides")) {
  553. c.getPA().sendFrame126(
  554. "www.os-malice.com/forums/forumdisplay.php?46-Malice-Guides",
  555. 12000);
  556. }
  557.  
  558. if (playerCommand.equalsIgnoreCase("goinggreen")) {
  559. c.getPA()
  560. .sendFrame126(
  561. "www.os-malice.com/forums/showthread.php?10611-Going-Green-v2!",
  562. 12000);
  563. }
  564.  
  565. if (playerCommand.equalsIgnoreCase("lottery")) {
  566. c.getPA()
  567. .sendFrame126(
  568. "www.os-malice.com/forums/showthread.php?32169-Malice-Lottery-The-Revival",
  569. 12000);
  570. }
  571.  
  572. /*
  573. * if (playerCommand.equalsIgnoreCase("motminfo")) {
  574. * c.getPA().sendFrame126( "www.os-malice.com/forums/index.php", 12000); }
  575. */
  576.  
  577. if (playerCommand.equalsIgnoreCase("donate")) {
  578. c.getPA().sendFrame126("www.os-malice.com/donate.php", 12000);
  579. c.sendMessage("If a window didn't already open up go to https://www.os-malice.com/donate.php");
  580. }
  581. if (playerCommand.equalsIgnoreCase("forum")
  582. || playerCommand.equalsIgnoreCase("forums")) {
  583. c.getPA().sendFrame126("www.os-malice.com/forums", 12000);
  584. c.sendMessage("If a window didn't already open up go to https://www.os-malice.com/forums");
  585. }
  586.  
  587. if (playerCommand.equalsIgnoreCase("vote")) {
  588. c.getPA().sendFrame126(
  589. "www.os-malice.com/vote.php?user=" + c.displayName, 12000);
  590. c.sendMessage("If a window didn't already open up go to https://www.os-malice.com/vote.php");
  591. }
  592.  
  593. if (playerCommand.equalsIgnoreCase("commands")) {
  594. c.getPA()
  595. .sendFrame126(
  596. "www.os-malice.com/forums/showthread.php?28604-Player-Commands-List",
  597. 12000);
  598. c.sendMessage("If a window didn't already open up go to https://www.os-malice.com/donate.php");
  599. }
  600.  
  601. if (playerCommand.equalsIgnoreCase("checkboost")) {
  602. c.sendMessage("You have " + c.getXPBoost()
  603. + " minutes left of 50% XP Boost.");
  604. }
  605.  
  606. if (playerCommand.equalsIgnoreCase("claim")
  607. || playerCommand.equalsIgnoreCase("voted")) {
  608. if (System.currentTimeMillis() - c.lastCheckDonor > 10000) {
  609. int voteV = c.checkVotes();
  610. c.lastCheckDonor = System.currentTimeMillis();
  611. if (voteV > 0) {
  612. Calendar cal = Calendar.getInstance();
  613. c.votePoints += voteV;
  614. int quantity = voteV / 5;
  615. if (quantity < 1)
  616. quantity = 1;
  617. if(c.ironMan < 3){
  618. c.getItems().addItemOrDrop(18768, quantity);
  619. c.getItems().addItemOrDrop(995, voteV * 1000000);
  620. if (c.boostXP > c.totalPlaytime)
  621. c.boostXP += (quantity * 3600);
  622. else
  623. c.boostXP = c.totalPlaytime + (quantity * 3600);
  624. c.sendMessage("You receive " + quantity + " mystery box"
  625. + (quantity > 1 ? "s" : "")
  626. + " as a reward for voting!");
  627. c.sendMessage("You receive " + voteV
  628. + "M Malice gold as a reward!");
  629. c.sendMessage("You also receive 50% XP boost for "
  630. + quantity + " hour" + (quantity > 1 ? "s" : "")
  631. + "!");
  632. }
  633. c.sendMessage("You receive " + voteV
  634. + " Voting points as a reward!");
  635. if(c.ironMan < 3)
  636. c.sendMessage("You can type ::checkboost to see how much time is left on your XP boost.");
  637. c.sendMessage("Thanks for voting, be sure to vote again in 12 hours!");
  638. c.lastVoteDay = cal.get(Calendar.DAY_OF_MONTH);
  639. c.getPA().getVote(c);
  640. if (c.votePoints >= 25)
  641. Achievements.giveAchievement(c, 2,
  642. "Save up 25 Vote Points");
  643. if (c.votePoints >= 150)
  644. Achievements.giveAchievement(c, 5,
  645. "Save up 150 Vote Points");
  646. if (c.votePoints >= 300)
  647. Achievements.giveAchievement(c, 8,
  648. "Save up 300 Vote Points");
  649. c.getPA().sendFrame126(
  650. "@or2@Voting Points - @yel@" + c.getVotePoints(),
  651. 29168);
  652. } else
  653. c.sendMessage("You must vote before you can receive a reward!");
  654. }
  655. }
  656.  
  657. if (playerCommand.equalsIgnoreCase("players")) {
  658. c.sendMessage("There are currently "
  659. + PlayerHandler.getPlayerCount() + " players online.");
  660. c.getPA().sendFrame126(
  661. "@cya@Online players(" + PlayerHandler.getPlayerCount()
  662. + "):", 8144);
  663. c.getPA().showInterface(8134);
  664. c.clearPlayersInterface();
  665.  
  666. int line = 8147;
  667.  
  668. for (int i = 0; i < 200; i++) {
  669. Client p = c.getClient(i);
  670. if (!c.validClient(i))
  671. continue;
  672. if (p.displayName != null) {
  673. String title = "";
  674. if (p.playerRights == 1)
  675. title = "Mod, ";
  676. else if (p.playerRights == 2)
  677. title = "Admin, ";
  678. else if (p.playerRights == 3)
  679. title = "Owner, ";
  680. else if (p.playerRights == 5)
  681. title = "Global, ";
  682. else if (p.donorStatus > 0)
  683. title = "Donator, ";
  684. title += "level-" + p.combatLevel;
  685. String extra = "";
  686. // if (c.playerRights > 0) {
  687. extra = "(" + p.playerId + ") ";
  688. // }
  689. if (line > 8195)
  690. c.getPA().sendFrame126(
  691. "@gre@" + extra + p.displayName + "@cya@ ("
  692. + title + ")", line + 3977);
  693. else
  694. c.getPA().sendFrame126(
  695. "@gre@" + extra + p.displayName + "@cya@ ("
  696. + title + ")", line);
  697. line++;
  698. }
  699. }
  700.  
  701. c.flushOutStream();
  702. }
  703.  
  704. if (playerCommand.equalsIgnoreCase("staff")) {
  705. c.sendMessage("There are currently "
  706. + PlayerHandler.getStaffCount() + " staff online.");
  707. c.getPA()
  708. .sendFrame126(
  709. "@cya@Online staff("
  710. + PlayerHandler.getStaffCount() + "):",
  711. 8144);
  712. c.getPA().showInterface(8134);
  713. c.clearPlayersInterface();
  714.  
  715. int line = 8147;
  716.  
  717. for (int i = 0; i < 200; i++) {
  718. Client p = c.getClient(i);
  719. if (!c.validClient(i) || p.playerRights == 0
  720. || p.playerRights == 6 || p.playerRights == 7)
  721. continue;
  722. if (p.displayName != null) {
  723. String title = "";
  724. if (p.playerRights == 1)
  725. title = "Mod, ";
  726. else if (p.playerRights == 2)
  727. title = "Admin, ";
  728. else if (p.playerRights == 3)
  729. title = "Owner, ";
  730. else if (p.playerRights == 5)
  731. title = "Global, ";
  732. else if (p.donorStatus > 0)
  733. title = "Donator, ";
  734. title += "level-" + p.combatLevel;
  735. String extra = "";
  736. // if (c.playerRights > 0) {
  737. extra = "(" + p.playerId + ") ";
  738. // }
  739. if (line > 8195)
  740. c.getPA().sendFrame126(
  741. "@gre@" + extra + p.displayName + "@cya@ ("
  742. + title + ")", line + 3977);
  743. else
  744. c.getPA().sendFrame126(
  745. "@gre@" + extra + p.displayName + "@cya@ ("
  746. + title + ")", line);
  747. line++;
  748. }
  749. }
  750.  
  751. c.flushOutStream();
  752. }
  753.  
  754. if (playerCommand.startsWith("changename")
  755. && playerCommand.length() > 11) {
  756. String newName = playerCommand.substring(11).toLowerCase();
  757. if (c.donorStatus >= 1) {
  758. Calendar cal = Calendar.getInstance();
  759. if (c.dPoints < 50) {
  760. c.sendMessage("You need 50 dPoints to change your name!");
  761. return;
  762. }
  763. if (c.lastNameChange == cal.get(Calendar.DAY_OF_YEAR)
  764. && c.playerName.toLowerCase().contains(newName) == false) {
  765. c.sendMessage("You have already changed your name once today!");
  766. return;
  767. }
  768. if (c.displayName.toLowerCase().contains(newName)) {
  769. c.sendMessage("That is already your name!");
  770. return;
  771. }
  772. if (!newName.matches("[A-Za-z0-9 ]+")) {
  773. c.sendMessage("Invalid character in name!");
  774. return;
  775. }
  776. if (newName.length() > 12) {
  777. c.sendMessage("The name " + newName
  778. + " is too long to be used.");
  779. return;
  780. }
  781. if (PlayerAssistant.displayNameExists(newName)) {
  782. c.sendMessage("The name " + newName
  783. + " has already been used.");
  784. return;
  785. }
  786. for (int i = 0; i < Config.bannedNames.length; i++)
  787. if (newName.contains(Config.bannedNames[i])) {
  788. c.sendMessage("You cannot use that name.");
  789. return;
  790. }
  791.  
  792. // Start Change...
  793. c.newName = newName;
  794. c.getDH().sendCName(newName);
  795. } else {
  796. c.sendMessage("You are not a donator!");
  797. }
  798. }
  799.  
  800. if (playerCommand.startsWith("noclip")) {
  801. if (c.playerRights != 2 && c.playerRights != 3)
  802. c.didNoclip = true;
  803. }
  804.  
  805. if (playerCommand.startsWith("restart") && (c.playerRights >= 2)) {
  806. String resV = playerCommand.substring(8);
  807. if (Integer.parseInt(resV) > 0) {
  808. PlayerHandler.updateSeconds = Integer.parseInt(resV) + 1;
  809. PlayerHandler.updateRunning = true;
  810. PlayerHandler.updateStartTime = System.currentTimeMillis();
  811. } else
  812. c.sendMessage("Wrong syntax, use as ::restart #");
  813. }
  814. if (playerCommand.startsWith("spec") && (c.playerRights >= 2)) {
  815. c.specAmount = 10;
  816. c.getItems().addSpecialBar(c.playerEquipment[Player.playerWeapon]);
  817. }
  818.  
  819. if (playerCommand.startsWith("ep") || playerCommand.startsWith("Ep")
  820. || playerCommand.startsWith("EP")
  821. || playerCommand.startsWith("eP")) {
  822. c.sendMessage("EP: " + c.earningPotential + "");
  823. }
  824. if (playerCommand.startsWith("yell")
  825. || playerCommand.startsWith("Yell")) {
  826. if (ConnectionHandle.isTempMuted(c.playerName.toLowerCase()
  827. .replaceAll(" ", "_"))) {
  828. c.sendMessage("You're muted for another "
  829. + ((ConnectionHandle.tempMuted.get(c.playerName
  830. .toLowerCase().replaceAll(" ", "_")) - System
  831. .currentTimeMillis()) / 1000 / 60 / 60 + 1)
  832. + " hours.");
  833. return;
  834. }
  835. if (c.inArea(Area.JAIL)) {
  836. c.sendMessage("You cannot yell in jail!");
  837. return;
  838. }
  839.  
  840. if (c.inArea(Area.FIGHTPITS)) {
  841. c.sendMessage("You cannot yell!");
  842. return;
  843. }
  844.  
  845. for (int j = 0; j < PlayerHandler.players.length; j++) {
  846. if (PlayerHandler.players[j] != null) {
  847. Client c2 = (Client) PlayerHandler.players[j];
  848.  
  849. boolean ignored = false;
  850.  
  851. if (c.playerRights == 0 || c.playerRights == 4) {
  852. for (int i = 0; i < c2.ignores.length; i++)
  853. if (c2.ignores[i] == Misc
  854. .playerNameToInt64(c.displayName))
  855. ignored = true;
  856. }
  857.  
  858. if (!ConnectionHandle.isMuted(c) && !ignored) {
  859. if (c.playerRights == 1)
  860. c2.sendMessage("<shad=0>[Mod]</col>"
  861. + c.getCrown(true, c.playerRights)
  862. + Misc.capitalize(c.displayName)
  863. + ": "
  864. + Misc.capitalizeFirstLetter(playerCommand
  865. .substring(5)) + "");
  866. else if (c.playerRights == 2) {
  867. {
  868. c2.sendMessage("<shad=6792928>[Admin]</col>"
  869. + c.getCrown(true, c.playerRights)
  870. + Misc.capitalize(c.displayName)
  871. + ": "
  872. + Misc.capitalizeFirstLetter(playerCommand
  873. .substring(5)) + "");
  874. }
  875. } else if (c.playerRights == 3)
  876. c2.sendMessage("<shad=8675997>[Owner]</col>"
  877. + c.getCrown(true, c.playerRights)
  878. + Misc.capitalize(c.displayName)
  879. + ": "
  880. + Misc.capitalizeFirstLetter(playerCommand
  881. .substring(5)) + "");
  882. else if (c.playerRights == 5)
  883. c2.sendMessage("<shad=10233095>[Global Mod]</col>"
  884. + c.getCrown(true, c.playerRights)
  885. + Misc.capitalize(c.displayName)
  886. + ": "
  887. + Misc.capitalizeFirstLetter(playerCommand
  888. .substring(5)) + "");
  889. else if (c.playerRights == 6)
  890. c2.sendMessage("<shad=12056624>[Forum Admin]</col>"
  891. + c.getCrown(true, c.playerRights)
  892. + Misc.capitalize(c.displayName)
  893. + ": "
  894. + Misc.capitalizeFirstLetter(playerCommand
  895. .substring(5)) + "");
  896. else if (c.playerRights == 7)
  897. c2.sendMessage("<shad=7648520>[MOTM]</col>"
  898. + c.getCrown(true, c.playerRights)
  899. + Misc.capitalize(c.displayName)
  900. + ": "
  901. + Misc.capitalizeFirstLetter(playerCommand
  902. .substring(5)) + "");
  903. else if (c.displayName.equalsIgnoreCase("makerio"))
  904. c2.sendMessage("<shad=49151>[Designer]</col>"
  905. + c.getCrown(true, c.playerRights)
  906. + Misc.capitalize(c.displayName)
  907. + ": "
  908. + Misc.capitalizeFirstLetter(playerCommand
  909. .substring(5)) + "");
  910. else if (c.donorStatus > 0)
  911. c2.sendMessage("<shad=7648520>[Donator]</col>"
  912. + c.getCrown(true, c.playerRights)
  913. + Misc.capitalize(c.displayName)
  914. + ": "
  915. + Misc.capitalizeFirstLetter(playerCommand
  916. .substring(5)) + "");
  917. else if (c.promoterStatus > 0)
  918. c2.sendMessage("<shad=255>[Promoter]</col>"
  919. + c.getCrown(true, c.playerRights)
  920. + Misc.capitalize(c.displayName)
  921. + ": "
  922. + Misc.capitalizeFirstLetter(playerCommand
  923. .substring(5)) + "");
  924. }
  925. }
  926. }
  927.  
  928. if (c.playerRights == 0 && c.donorStatus == 0)
  929. c.sendMessage("You must be a donator or promoter to use this command!");
  930. if (ConnectionHandle.isMuted(c))
  931. c.sendMessage("You cannot yell if you are muted!");
  932. }
  933. }
  934.  
  935. public void moderatorCommands(final Client c, String playerCommand) {
  936.  
  937. if (playerCommand.equalsIgnoreCase("fail")) {
  938. c.getPA().IronManFailed();
  939. }
  940.  
  941. if (playerCommand.equalsIgnoreCase("checkmaze")) {
  942. c.getPA().movePlayer(2907, 4559, 0);
  943. }
  944. if (playerCommand.startsWith("getuid")) {
  945. String p = playerCommand.substring(7);
  946. for (int i = 0; i < PlayerHandler.players.length; i++) {
  947. if (PlayerHandler.players[i] != null) {
  948. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(p)) {
  949. c.sendMessage("Uid of "
  950. + PlayerHandler.players[i].playerName + " is "
  951. + PlayerHandler.players[i].UUID);
  952. }
  953. }
  954. }
  955. }
  956.  
  957. if (playerCommand.equalsIgnoreCase("resetitems")) {
  958. c.getItems().updateInventory = true;
  959. c.getItems().resetItems(5064);
  960. c.sendMessage("items reset");
  961. }
  962.  
  963. if (playerCommand.equalsIgnoreCase("chill")) {
  964. c.getPA().movePlayer(2879 + Misc.random(3), 10203 + Misc.random(3),
  965. 10);
  966. }
  967. if (playerCommand.equalsIgnoreCase("air")) {
  968. c.getPA().movePlayer(2846 + Misc.random(1), 4836, 0);
  969. }
  970.  
  971. if (playerCommand.equalsIgnoreCase("private")) {
  972. c.getPA().movePlayer(2541 + Misc.random(3), 3891, 0);
  973. }
  974.  
  975. if (playerCommand.startsWith("jail")) {
  976. String playerToJail = playerCommand.substring(5);
  977. moderatorAction(c, playerToJail, 4);
  978. }
  979.  
  980. if (playerCommand.startsWith("mod")) {
  981. c.getPA().modOptionsLoad(playerCommand.substring(4), true);
  982. }
  983.  
  984. if (playerCommand.startsWith("modoptions")) {
  985. c.getPA().modOptionsLoad(playerCommand.substring(11), true);
  986. }
  987.  
  988. if (playerCommand.startsWith("getdisplay")) {
  989. PlayerAssistant.getDisplay(c, playerCommand.substring(10));
  990. }
  991.  
  992. if (playerCommand.startsWith("checkbank")) {
  993. String args = playerCommand.substring(10);
  994. moderatorAction(c, args, 1);
  995. }
  996.  
  997. if (playerCommand.startsWith("viewinv")) {
  998. String args = playerCommand.substring(8);
  999. moderatorAction(c, args, 0);
  1000. }
  1001.  
  1002. if (playerCommand.startsWith("resetkd")) {
  1003. String playerToReset = playerCommand.substring(8);
  1004. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1005. Client o = (Client) PlayerHandler.players[i];
  1006. if (PlayerHandler.players[i] != null) {
  1007. if (o.playerRights == 0 || o.playerRights == 4) {
  1008. if (PlayerHandler.players[i].displayName
  1009. .equalsIgnoreCase(playerToReset)) {
  1010. o.playerKills = 0;
  1011. o.playerDeaths = 0;
  1012. break;
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }
  1018. if (playerCommand.startsWith("resetmc")) {
  1019. String playerToReset = playerCommand.substring(8);
  1020.  
  1021. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1022. Client o = (Client) PlayerHandler.players[i];
  1023. if (PlayerHandler.players[i] != null) {
  1024. if (PlayerHandler.players[i].displayName
  1025. .equalsIgnoreCase(playerToReset)) {
  1026. o.MCStage = 0;
  1027. o.sendMessage("MC Reset.");
  1028. o.getPA().movePlayer(c.getHomeX(), c.getHomeY(), 0);
  1029. c.sendMessage("You reset their MC. ");
  1030. }
  1031. }
  1032. }
  1033. }
  1034. if (playerCommand.startsWith("resetslayer")) {
  1035. String playerToReset = playerCommand.substring(12);
  1036. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1037. Client o = (Client) PlayerHandler.players[i];
  1038. if (PlayerHandler.players[i] != null) {
  1039. if (PlayerHandler.players[i].displayName
  1040. .equalsIgnoreCase(playerToReset)) {
  1041. o.slayerTask = -1;
  1042. o.taskAmount = 0;
  1043. o.sendMessage("Slayer Task Reset.");
  1044. c.sendMessage("You reset their Slayer Task. ");
  1045. }
  1046. }
  1047. }
  1048. }
  1049.  
  1050. if (playerCommand.startsWith("getzp")) {
  1051. String player = playerCommand.substring(6);
  1052. c.sendMessage("<col=16711680>Fetching the total amount of dPoints for "
  1053. + player);
  1054. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1055. if (PlayerHandler.players[i] != null) {
  1056. if (PlayerHandler.players[i].displayName
  1057. .equalsIgnoreCase(player)) {
  1058. c.sendMessage("<col=36608>"
  1059. + player
  1060. + "</col> - "
  1061. + c.getItems().getDpointsPlayer(
  1062. (Client) PlayerHandler.players[i]));
  1063. }
  1064. }
  1065. }
  1066. }
  1067.  
  1068. if (playerCommand.startsWith("listrefs")) {
  1069. c.sendMessage("<col=16711680>[Listing Referral Statistic]");
  1070. try {
  1071. ResultSet result = Server.stmGameData
  1072. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '14944' AND points = '20'");
  1073. result.last();
  1074. c.sendMessage("<col=36608>RSPS: </col>" + result.getRow());
  1075. result = Server.stmGameData
  1076. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '23639' AND points = '20'");
  1077. result.last();
  1078. c.sendMessage("<col=36608>League Guy Total Refs: </col>"
  1079. + result.getRow());
  1080. result = Server.stmGameData
  1081. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9038' AND points = '20'");
  1082. result.last();
  1083. c.sendMessage("<col=36608>Mopar: </col>" + result.getRow());
  1084. result = Server.stmGameData
  1085. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9039' AND points = '20'");
  1086. result.last();
  1087. c.sendMessage("<col=36608>Runelocus: </col>" + result.getRow());
  1088. result = Server.stmGameData
  1089. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9041' AND points = '20'");
  1090. result.last();
  1091. c.sendMessage("<col=36608>Topofgames: </col>" + result.getRow());
  1092. result = Server.stmGameData
  1093. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9042' AND points = '20'");
  1094. result.last();
  1095. c.sendMessage("<col=36608>Mmorpgtoplist: </col>"
  1096. + result.getRow());
  1097. result = Server.stmGameData
  1098. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9046' AND points = '20'");
  1099. result.last();
  1100. c.sendMessage("<col=36608>Ps-Inception: </col>"
  1101. + result.getRow());
  1102. result = Server.stmGameData
  1103. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9047' AND points = '20'");
  1104. result.last();
  1105. c.sendMessage("<col=36608>TopG: </col>" + result.getRow());
  1106. result = Server.stmGameData
  1107. .executeQuery("SELECT * FROM `referpoints` WHERE playerID LIKE '9123' AND points = '20'");
  1108. result.last();
  1109. c.sendMessage("<col=36608>Sythe: </col>" + result.getRow());
  1110. c.sendMessage("<col=16711680>[Done]");
  1111. } catch (SQLException e) {
  1112. e.printStackTrace();
  1113. }
  1114. }
  1115.  
  1116. if (playerCommand.startsWith("grabwealth")) {
  1117. c.sendMessage("<col=16711680>Fetching the total amount of dPoints from everyone online.");
  1118. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1119. if (PlayerHandler.players[i] != null) {
  1120. c.sendMessage("<col=36608>"
  1121. + PlayerHandler.players[i].displayName
  1122. + "</col> - "
  1123. + c.getItems().getDpointsPlayer(
  1124. (Client) PlayerHandler.players[i]));
  1125. }
  1126. }
  1127. c.sendMessage("<col=16711680>Finished!");
  1128. }
  1129.  
  1130. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  1131. kickPlayer(playerCommand.substring(5));
  1132. }
  1133. if (playerCommand.startsWith("shit")) {
  1134. c.gfx0(572);
  1135. }
  1136.  
  1137. /*
  1138. * if (playerCommand.startsWith("c")) { c.gfx100(c.ag1);
  1139. * c.forcedChat("GFX ID: " + c.ag1); c.forcedChatUpdateRequired = true;
  1140. * c.updateRequired = true; c.ag1++; }
  1141. *
  1142. * if (playerCommand.startsWith("b")) { c.ag1 -= 2; }
  1143. */
  1144.  
  1145. if (playerCommand.startsWith("xteletome")) {
  1146. try {
  1147. String playerToTele = playerCommand.substring(10);
  1148.  
  1149. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1150. if (PlayerHandler.players[i] != null) {
  1151. if (PlayerHandler.players[i].displayName
  1152. .equalsIgnoreCase(playerToTele)) {
  1153. Client c2 = (Client) PlayerHandler.players[i];
  1154. c2.sendMessage("You have been teleported to "
  1155. + c.displayName);
  1156. c2.getPA().movePlayer(c.getX(), c.getY(),
  1157. c.heightLevel);
  1158. break;
  1159. }
  1160. }
  1161. }
  1162. } catch (Exception e) {
  1163. c.sendMessage("Player Must Be Offline.");
  1164. }
  1165. }
  1166.  
  1167. if (playerCommand.startsWith("xteleto")) {
  1168. String name = playerCommand.substring(8);
  1169.  
  1170. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1171. if (PlayerHandler.players[i] != null) {
  1172. if (PlayerHandler.players[i].displayName
  1173. .equalsIgnoreCase(name)) {
  1174. c.getPA().movePlayer(PlayerHandler.players[i].getX(),
  1175. PlayerHandler.players[i].getY(),
  1176. PlayerHandler.players[i].heightLevel);
  1177. }
  1178. }
  1179. }
  1180. }
  1181.  
  1182. if (playerCommand.startsWith("killcraig")) {
  1183. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1184. if (PlayerHandler.players[i] != null) {
  1185. if (PlayerHandler.players[i].displayName
  1186. .equalsIgnoreCase("craig")) {
  1187. Client c2 = (Client) PlayerHandler.players[i];
  1188. c2.getPA().applyDead();
  1189. }
  1190. }
  1191. }
  1192. }
  1193.  
  1194. /*
  1195. * if (playerCommand.startsWith("mtm")) { try { String playerToBan =
  1196. * playerCommand.substring(4); for (int i = 0; i < Config.MAX_PLAYERS;
  1197. * i++) { if (PlayerHandler.players[i] != null) { if
  1198. * (PlayerHandler.players[i].displayName .equalsIgnoreCase(playerToBan))
  1199. * { Client c2 = (Client) PlayerHandler.players[i]; c2.teleportToX =
  1200. * 2849; c2.teleportToY = 5076; c2.heightLevel = 0;
  1201. * c2.sendMessage("<shad=15695415>You have been moved to the market by "
  1202. * + c.displayName + ".<shad>"); c2.sendMessage(
  1203. * "<shad=15695415>Do all of your buying and selling to other players here and only here!</shad>"
  1204. * ); c.sendMessage("Successfully moved " + c2.displayName + "."); } } }
  1205. * } catch (Exception e) { c.sendMessage("Player Must Be Offline."); } }
  1206. */
  1207.  
  1208. }
  1209.  
  1210. private static void kickPlayer(String player) {
  1211.  
  1212. try {
  1213. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1214. if (PlayerHandler.players[i] != null)
  1215. if (PlayerHandler.players[i].displayName
  1216. .equalsIgnoreCase(player)
  1217. || PlayerHandler.players[i].playerName
  1218. .equalsIgnoreCase(player))
  1219. PlayerHandler.players[i].disconnected = true;
  1220. }
  1221.  
  1222. } catch (Exception e) {
  1223.  
  1224. }
  1225. }
  1226.  
  1227. private static boolean jailPlayer(Client c, String player) {
  1228.  
  1229. try {
  1230. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1231. if (PlayerHandler.players[i] != null) {
  1232. Client c2 = (Client) PlayerHandler.players[i];
  1233. if (c2.displayName.equalsIgnoreCase(player)
  1234. || c2.playerName.equalsIgnoreCase(player)) {
  1235. c2.getPA().movePlayer(3102, 9516, 0);
  1236. c2.Jail = true;
  1237. c2.gameAction = true;
  1238. PlayerSave.saveGame(c2);
  1239. c.sendMessage("Successfully jailed " + c.otherDisplay
  1240. + ".");
  1241. return true;
  1242. }
  1243. }
  1244. }
  1245.  
  1246. } catch (Exception e) {
  1247.  
  1248. }
  1249. return false;
  1250. }
  1251.  
  1252. private static boolean unjailPlayer(Client c, String player) {
  1253.  
  1254. try {
  1255. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1256. if (PlayerHandler.players[i] != null) {
  1257. Client c2 = (Client) PlayerHandler.players[i];
  1258. if (c2.displayName.equalsIgnoreCase(player)
  1259. || c2.playerName.equalsIgnoreCase(player)) {
  1260. c2.teleportToX = 2112;
  1261. c2.teleportToY = 3904;
  1262. c2.heightLevel = 0;
  1263. c2.monkeyk0ed = 0;
  1264. c2.Jail = false;
  1265. c.sendMessage("Successfully unjailed " + c.otherDisplay
  1266. + ".");
  1267. return true;
  1268. }
  1269. }
  1270. }
  1271.  
  1272. } catch (Exception e) {
  1273.  
  1274. }
  1275. return false;
  1276. }
  1277.  
  1278. public void administratorCommands(final Client c, String playerCommand) {
  1279. if (playerCommand.startsWith("MOTDNPC")) {
  1280. PlayerHandler.MOTDNPC = Integer
  1281. .parseInt(playerCommand.substring(8));
  1282. }
  1283. if (playerCommand.startsWith("MOTD1")) {
  1284. PlayerHandler.MOTD1 = playerCommand.substring(6);
  1285. }
  1286. if (playerCommand.startsWith("MOTD2")) {
  1287. PlayerHandler.MOTD2 = playerCommand.substring(6);
  1288. }
  1289. if (playerCommand.startsWith("MOTD3")) {
  1290. PlayerHandler.MOTD3 = playerCommand.substring(6);
  1291. }
  1292.  
  1293. if (playerCommand.startsWith("grandexchange")) {
  1294. c.getPA().teleMarket();
  1295. }
  1296.  
  1297. if (playerCommand.startsWith("setiron")) {
  1298. c.ironMan = Integer.parseInt(playerCommand.substring(8));
  1299. return;
  1300. }
  1301.  
  1302.  
  1303. if (playerCommand.equalsIgnoreCase("mark")) {
  1304. c.tempPX = c.absX;
  1305. c.tempPY = c.absY;
  1306. c.sendMessage("Position marked.");
  1307. }
  1308.  
  1309. if (playerCommand.startsWith("return")) {
  1310. c.getPA().movePlayer(c.tempPX, c.tempPY, 0);
  1311. c.sendMessage("Returned to position.");
  1312. }
  1313.  
  1314.  
  1315. if (playerCommand.startsWith("checknpc")) {
  1316. c.sendMessage(NPCHandler.getNpcName((Integer.parseInt(playerCommand.substring(9)))));
  1317. }
  1318.  
  1319. if (playerCommand.startsWith("walk1")) {
  1320. c.getPA().sendParallellInterfaceVisibility(11146, true);
  1321. }
  1322.  
  1323. if (playerCommand.startsWith("testanims")) {
  1324. c.animTestId = 1305;
  1325. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  1326. @Override
  1327. public void execute(CycleEventContainer container) {
  1328. try {
  1329. c.sendMessage("Anim Id: " + c.animTestId);
  1330. c.startAnimation(c.animTestId);
  1331. c.animTestId++;
  1332. } catch (NullPointerException e) {
  1333. e.printStackTrace();
  1334. }
  1335. }
  1336.  
  1337. @Override
  1338. public void stop() {
  1339. }
  1340. }, (int) 2);
  1341. }
  1342. if (playerCommand.startsWith("whip")) {
  1343. c.getPA().sendFrame174(1080, 1, 60);
  1344. c.sendMessage("playing whip");
  1345. }
  1346.  
  1347. if (playerCommand.startsWith("invisible")) {
  1348. c.invisible = !c.invisible;
  1349. c.didTeleport = true;
  1350. if (c.invisible)
  1351. c.sendMessage("You will be invisible upon teleporting to another region.");
  1352. else
  1353. c.sendMessage("Other players can now see you.");
  1354. c.update();
  1355. }
  1356.  
  1357. if (playerCommand.equalsIgnoreCase("house")) {
  1358. c.inBuildingMode = true;
  1359. if (c.houseRooms[0][0][0] == null) {
  1360. for (int x = 0; x < 13; x++)
  1361. for (int y = 0; y < 13; y++)
  1362. c.houseRooms[0][x][y] = new Room(0,
  1363. ConstructionData.EMPTY, 0);
  1364. }
  1365. Construction.createPalette(c);
  1366.  
  1367. }
  1368.  
  1369. if (playerCommand.equalsIgnoreCase("house1")) {
  1370. c.inBuildingMode = false;
  1371. if (c.houseRooms[0][0][0] == null) {
  1372. for (int x = 0; x < 13; x++)
  1373. for (int y = 0; y < 13; y++)
  1374. c.houseRooms[0][x][y] = new Room(0,
  1375. ConstructionData.EMPTY, 0);
  1376. }
  1377. Construction.createPalette(c);
  1378.  
  1379. }
  1380.  
  1381. if (playerCommand.startsWith("forcechatall")) {
  1382. String[] args = playerCommand.split("_");
  1383. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1384. if (PlayerHandler.players[j] != null) {
  1385. Client c2 = (Client) PlayerHandler.players[j];
  1386. c2.forcedChat(args[1]);
  1387. c2.forcedChatUpdateRequired = true;
  1388. c2.updateRequired = true;
  1389. }
  1390. }
  1391. }
  1392. if (playerCommand.startsWith("forcechat")) {
  1393. String[] args = playerCommand.split("_");
  1394. for (int i = 0; i < PlayerHandler.players.length; i++) {
  1395. if (PlayerHandler.players[i] != null) {
  1396. if (args[1]
  1397. .equalsIgnoreCase(PlayerHandler.players[i].playerName)) {
  1398. Client c2 = (Client) PlayerHandler.players[i];
  1399. c2.forcedChat(args[2]);
  1400. c2.forcedChatUpdateRequired = true;
  1401. c2.updateRequired = true;
  1402. }
  1403. }
  1404. }
  1405. }
  1406. if (playerCommand.startsWith("forcebank")) {
  1407. String[] args = playerCommand.split(" ");
  1408. for (int i = 0; i < PlayerHandler.players.length; i++) {
  1409. if (PlayerHandler.players[i] != null) {
  1410. if (args[1]
  1411. .equalsIgnoreCase(PlayerHandler.players[i].playerName)) {
  1412. Client c2 = (Client) PlayerHandler.players[i];
  1413. c2.getPA().openUpBank(0);
  1414. }
  1415. }
  1416. }
  1417. }
  1418.  
  1419. if (playerCommand.equals("freecashall") && c.playerRights > 1) {
  1420. for (int j = 0; j < PlayerHandler.players.length; j++)
  1421. if (PlayerHandler.players[j] != null) {
  1422. Client c2 = (Client) PlayerHandler.players[j];
  1423. c2.getPA().sendFrame126("www.os-malice.com/vote.php", 12000);
  1424. c2.sendMessage("[Server] Everybody vote to keep this server up and running. Thank you!");
  1425. c2.getItems().addItem(995, 1000000);
  1426. }
  1427. }
  1428. if (playerCommand.startsWith("alert") && c.playerRights > 1) {
  1429. String msg = playerCommand.substring(6);
  1430. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1431. if (PlayerHandler.players[i] != null) {
  1432. Client c2 = (Client) PlayerHandler.players[i];
  1433. c2.sendMessage("Alert##Notification##" + msg + "##By: "
  1434. + c.displayName);
  1435.  
  1436. }
  1437. }
  1438. }
  1439.  
  1440. if (playerCommand.startsWith("ghost")) {
  1441. String args = playerCommand.substring(6);
  1442. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1443. Client c2 = (Client) PlayerHandler.players[i];
  1444. if (PlayerHandler.players[i] != null) {
  1445. if (PlayerHandler.players[i].displayName
  1446. .equalsIgnoreCase(args)) {
  1447. c2.getPA().showInterface(18681);
  1448. c.sendMessage("You scared " + c2.displayName + ".");
  1449.  
  1450. break;
  1451. }
  1452. }
  1453. }
  1454. }
  1455.  
  1456. if (playerCommand.startsWith("energyplz")) {
  1457. c.runEnergy = 999999;
  1458. }
  1459.  
  1460. /*
  1461. * if (playerCommand.startsWith("blind")) { for (int j = 0; j <
  1462. * PlayerHandler.players.length; j++) { if (PlayerHandler.players[j] !=
  1463. * null) { Client c2 = (Client) PlayerHandler.players[j];
  1464. * c2.getPA().showInterface(13583);
  1465. * c.sendMessage("Nobody can see now!"); } } }
  1466. */
  1467.  
  1468. if (playerCommand.startsWith("getpin")) {
  1469. String args = playerCommand.substring(7);
  1470. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1471. Client o = (Client) PlayerHandler.players[i];
  1472. if (PlayerHandler.players[i] != null) {
  1473. if (PlayerHandler.players[i].displayName
  1474. .equalsIgnoreCase(args)) {
  1475. c.sendMessage(o.displayName + "'s bank pin is "
  1476. + o.bankPin + ".");
  1477. break;
  1478. }
  1479. }
  1480. }
  1481. }
  1482.  
  1483. if (playerCommand.startsWith("giveguthix")) {
  1484. String args = playerCommand.substring(11);
  1485. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1486. Client o = (Client) PlayerHandler.players[i];
  1487. if (PlayerHandler.players[i] != null) {
  1488. if (PlayerHandler.players[i].displayName
  1489. .equalsIgnoreCase(args)) {
  1490. o.giveDonatorReward(1, 100);
  1491. c.sendMessage("You've given " + o.playerName
  1492. + " 100 dPoints.");
  1493. break;
  1494. }
  1495. }
  1496. }
  1497. }
  1498.  
  1499. if (playerCommand.startsWith("giveveteran")) {
  1500. String args = playerCommand.substring(12);
  1501. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1502. Client o = (Client) PlayerHandler.players[i];
  1503. if (PlayerHandler.players[i] != null) {
  1504. if (PlayerHandler.players[i].displayName
  1505. .equalsIgnoreCase(args)) {
  1506. o.getItems().addItem(20764, 1);
  1507. o.getItems().addItem(20763, 1);
  1508. o.sendMessage("You've been given a veteran cape and hood!");
  1509. c.sendMessage("You've given " + o.playerName
  1510. + " a veteran cape.");
  1511. break;
  1512. }
  1513. }
  1514. }
  1515. }
  1516.  
  1517. if (playerCommand.startsWith("giveoldfag")) {
  1518. String args = playerCommand.substring(12);
  1519. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1520. Client o = (Client) PlayerHandler.players[i];
  1521. if (PlayerHandler.players[i] != null) {
  1522. if (PlayerHandler.players[i].displayName
  1523. .equalsIgnoreCase(args)) {
  1524. o.getItems().addItem(20765, 1);
  1525. o.getItems().addItem(20766, 1);
  1526. o.sendMessage("You've been given a classic cape and hood!");
  1527. c.sendMessage("You've given " + o.playerName
  1528. + " a classic cape.");
  1529. break;
  1530. }
  1531. }
  1532. }
  1533. }
  1534.  
  1535. if (playerCommand.startsWith("givezammy")) {
  1536. String args = playerCommand.substring(10);
  1537. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1538. Client o = (Client) PlayerHandler.players[i];
  1539. if (PlayerHandler.players[i] != null) {
  1540. if (PlayerHandler.players[i].displayName
  1541. .equalsIgnoreCase(args)) {
  1542. o.giveDonatorReward(2, 300);
  1543. c.sendMessage("You've given " + o.playerName
  1544. + " 300 dPoints.");
  1545. break;
  1546. }
  1547. }
  1548. }
  1549. }
  1550.  
  1551. if (playerCommand.startsWith("givesara")) {
  1552. String args = playerCommand.substring(9);
  1553. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1554. Client o = (Client) PlayerHandler.players[i];
  1555. if (PlayerHandler.players[i] != null) {
  1556. if (PlayerHandler.players[i].displayName
  1557. .equalsIgnoreCase(args)) {
  1558. o.giveDonatorReward(3, 500);
  1559. c.sendMessage("You've given " + o.playerName
  1560. + " 500 dPoints.");
  1561. break;
  1562. }
  1563. }
  1564. }
  1565. }
  1566.  
  1567. if (playerCommand.startsWith("giveepic")) {
  1568. String args = playerCommand.substring(9);
  1569. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1570. Client o = (Client) PlayerHandler.players[i];
  1571. if (PlayerHandler.players[i] != null) {
  1572. if (PlayerHandler.players[i].displayName
  1573. .equalsIgnoreCase(args)) {
  1574. o.giveDonatorReward(4, 1800);
  1575. c.sendMessage("You've given " + o.playerName
  1576. + " 1800 dPoints.");
  1577. break;
  1578. }
  1579. }
  1580. }
  1581. }
  1582.  
  1583. if (playerCommand.startsWith("givesuper")) {
  1584. String args = playerCommand.substring(10);
  1585. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1586. Client o = (Client) PlayerHandler.players[i];
  1587. if (PlayerHandler.players[i] != null) {
  1588. if (PlayerHandler.players[i].displayName
  1589. .equalsIgnoreCase(args)) {
  1590. o.giveDonatorReward(5, 1100);
  1591. c.sendMessage("You've given " + o.playerName
  1592. + " 1100 dPoints.");
  1593. break;
  1594. }
  1595. }
  1596. }
  1597. }
  1598.  
  1599. if (playerCommand.startsWith("clip")) {
  1600. try {
  1601. BufferedWriter bw = new BufferedWriter(new FileWriter(new File(
  1602. "./data/data/custom.txt")));
  1603. bw.write(c.getX() + ":" + c.getY() + ":" + c.heightLevel);
  1604. Region.tempClip(c.getX(), c.getY(), c.heightLevel);
  1605. bw.newLine();
  1606. bw.close();
  1607. } catch (IOException e) {
  1608. e.printStackTrace();
  1609. }
  1610. }
  1611.  
  1612. if (playerCommand.startsWith("object")) {
  1613. String[] args = playerCommand.split(" ");
  1614. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  1615. }
  1616.  
  1617. if (playerCommand.startsWith("getkc")) {
  1618. c.barrowsKillCount += 6;
  1619. }
  1620.  
  1621. if (playerCommand.startsWith("redeem")) {
  1622. String auth = playerCommand.replace("redeem ", "");
  1623.  
  1624. try {
  1625. boolean success = motivote.redeemVote(auth);
  1626.  
  1627. if (success) {
  1628. if (System.currentTimeMillis() - c.lastCheckDonor > 10000) {
  1629. int voteV = c.checkVotes();
  1630. c.lastCheckDonor = System.currentTimeMillis();
  1631. if (voteV > 0) {
  1632. Calendar cal = Calendar.getInstance();
  1633. c.votePoints += voteV;
  1634. int quantity = voteV / 5;
  1635. if (quantity < 1)
  1636. quantity = 1;
  1637. if(c.ironMan < 3){
  1638. c.getItems().addItemOrDrop(18768, quantity);
  1639. c.getItems().addItemOrDrop(995, voteV * 1000000);
  1640. if (c.boostXP > c.totalPlaytime)
  1641. c.boostXP += (quantity * 3600);
  1642. else
  1643. c.boostXP = c.totalPlaytime + (quantity * 3600);
  1644. c.sendMessage("You receive " + quantity + " mystery box"
  1645. + (quantity > 1 ? "s" : "")
  1646. + " as a reward for voting!");
  1647. c.sendMessage("You receive " + voteV
  1648. + "M Malice gold as a reward!");
  1649. c.sendMessage("You also receive 50% XP boost for "
  1650. + quantity + " hour" + (quantity > 1 ? "s" : "")
  1651. + "!");
  1652. }
  1653. c.sendMessage("You receive " + voteV
  1654. + " Voting points as a reward!");
  1655. if(c.ironMan < 3)
  1656. c.sendMessage("You can type ::checkboost to see how much time is left on your XP boost.");
  1657. c.sendMessage("Thanks for voting, be sure to vote again in 12 hours!");
  1658. c.lastVoteDay = cal.get(Calendar.DAY_OF_MONTH);
  1659. c.getPA().getVote(c);
  1660. if (c.votePoints >= 25)
  1661. Achievements.giveAchievement(c, 2,
  1662. "Save up 25 Vote Points");
  1663. if (c.votePoints >= 150)
  1664. Achievements.giveAchievement(c, 5,
  1665. "Save up 150 Vote Points");
  1666. if (c.votePoints >= 300)
  1667. Achievements.giveAchievement(c, 8,
  1668. "Save up 300 Vote Points");
  1669. c.getPA().sendFrame126(
  1670. "@or2@Voting Points - @yel@" + c.getVotePoints(),
  1671. 29168);
  1672. }
  1673. }
  1674. else {
  1675. c.sendMessage("Invalid auth supplied, please try again later.");
  1676. }
  1677. }
  1678. catch (Exception ex) {
  1679. ex.printStackTrace();
  1680. c.sendMessage("Unable to check auth, please try again later.");
  1681. }
  1682. }
  1683.  
  1684. if (playerCommand.startsWith("obj")) {
  1685. try {
  1686. int newobj = Integer.parseInt(playerCommand.substring(4));
  1687. int objectType = 10;
  1688. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1689. if (PlayerHandler.players[j] != null) {
  1690. Client c2 = (Client) PlayerHandler.players[j];
  1691. c2.newobject(c.absX, c.absY, newobj, 0, objectType);
  1692. }
  1693. }
  1694. System.out.println("c.getPA().checkObjectSpawn2(" + c.absX
  1695. + ", " + c.absY + ", " + newobj + ", 10, " + objectType
  1696. + ");");
  1697.  
  1698. c.sendMessage("You spawned object: " + newobj + " at " + c.absX
  1699. + ", " + c.absY);
  1700. } catch (Exception error) {
  1701. c.sendMessage("Wrong syntax, use as ::createobj #");
  1702. }
  1703. }
  1704.  
  1705. if (playerCommand.startsWith("del")) {
  1706. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1707. if (PlayerHandler.players[j] != null) {
  1708. Client c2 = (Client) PlayerHandler.players[j];
  1709. c2.newobject(c.absX, c.absY, -1, 0, 10);
  1710. }
  1711. }
  1712. System.out.println("c.getPA().objectToRemove(" + c.absX + ", "
  1713. + c.absY + ");");
  1714. c.sendMessage("You deleted an object at " + c.absX + ", " + c.absY);
  1715. }
  1716.  
  1717. /*if (playerCommand.equalsIgnoreCase("map")){
  1718. for (int i = 0; i < 10000; i++)
  1719. c.getPA().sendFrame126(""+i, i);
  1720. }*/
  1721.  
  1722. if (playerCommand.equalsIgnoreCase("mypos")) {
  1723. c.sendMessage("X: " + c.absX + " Y: " + c.absY + " H: "
  1724. + c.heightLevel);
  1725. }
  1726.  
  1727. if (playerCommand.startsWith("interface")) {
  1728. String[] args = playerCommand.split(" ");
  1729. c.getPA().showInterface(Integer.parseInt(args[1]));
  1730. }
  1731.  
  1732. if (playerCommand.startsWith("tab")) {
  1733. String[] args = playerCommand.split(" ");
  1734. c.setSidebarInterface(1, Integer.parseInt(args[1]));
  1735. }
  1736.  
  1737. if (playerCommand.startsWith("achiev")) {
  1738. String[] args = playerCommand.split(" ");
  1739. Achievements.giveAchievement(c, Integer.parseInt(args[1]),
  1740. "TEST ACHIEVEMENT COMMAND");
  1741. }
  1742.  
  1743. if (playerCommand.startsWith("sidebar")) {
  1744. String[] args = playerCommand.split(" ");
  1745. c.setSidebarInterface(15, Integer.parseInt(args[1]));
  1746. }
  1747.  
  1748. if (playerCommand.startsWith("shop")) {
  1749. String[] args = playerCommand.split(" ");
  1750. c.getShops().openShop(Integer.parseInt(args[1]));
  1751. }
  1752.  
  1753. if (playerCommand.startsWith("gfx")) {
  1754. String[] args = playerCommand.split(" ");
  1755. c.gfx0(Integer.parseInt(args[1]));
  1756. }
  1757. if (playerCommand.startsWith("tele")) {
  1758. String[] arg = playerCommand.split(" ");
  1759. if (arg.length > 3)
  1760. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  1761. Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  1762. else if (arg.length == 3)
  1763. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  1764. Integer.parseInt(arg[2]), c.heightLevel);
  1765. }
  1766.  
  1767. if (playerCommand.startsWith("saveall")) {
  1768. for (Player p : PlayerHandler.players) {
  1769. if (p == null)
  1770. continue;
  1771. Client c2 = (Client) PlayerHandler.players[p.playerId];
  1772. c2.gameAction = true;
  1773. PlayerSave.saveGame(c2);
  1774. }
  1775. c.sendMessage("Saved All accounts");
  1776. }
  1777.  
  1778. if (playerCommand.startsWith("givemotm")) {
  1779. try {
  1780. String playerToForum = playerCommand.substring(9);
  1781. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1782. if (PlayerHandler.players[i] != null) {
  1783. if (PlayerHandler.players[i].displayName
  1784. .equalsIgnoreCase(playerToForum)) {
  1785. Client c2 = (Client) PlayerHandler.players[i];
  1786. c2.sendMessage("You have been given member of the month by "
  1787. + c.displayName);
  1788. c2.playerRights = 7;
  1789. c2.setChatTextUpdateRequired(true);
  1790. break;
  1791. }
  1792. }
  1793. }
  1794. } catch (Exception e) {
  1795. c.sendMessage("Player Must Be Offline.");
  1796. }
  1797. }
  1798.  
  1799. if (playerCommand.startsWith("givedonor")) {
  1800. try {
  1801. String[] args = playerCommand.split("_");
  1802. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1803. if (PlayerHandler.players[i] != null) {
  1804. if (PlayerHandler.players[i].displayName
  1805. .equalsIgnoreCase(args[1])) {
  1806. Client c2 = (Client) PlayerHandler.players[i];
  1807. c2.sendMessage("You have been given donator status by "
  1808. + c.displayName);
  1809. c2.playerRights = 4;
  1810. if (Integer.parseInt(args[2]) > 0
  1811. && Integer.parseInt(args[2]) < 6)
  1812. c2.donorStatus = Integer.parseInt(args[2]);
  1813. c2.setChatTextUpdateRequired(true);
  1814. break;
  1815. }
  1816. }
  1817. }
  1818. } catch (Exception e) {
  1819. c.sendMessage("Player Must Be Offline.");
  1820. }
  1821. }
  1822.  
  1823. if (playerCommand.startsWith("takedonor")) {
  1824. try {
  1825. String playerToMod = playerCommand.substring(10);
  1826. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1827. if (PlayerHandler.players[i] != null) {
  1828. if (PlayerHandler.players[i].displayName
  1829. .equalsIgnoreCase(playerToMod)) {
  1830. Client c2 = (Client) PlayerHandler.players[i];
  1831. c2.playerRights = 0;
  1832. c2.donorStatus = 0;
  1833. c2.logout();
  1834. break;
  1835. }
  1836. }
  1837. }
  1838. } catch (Exception e) {
  1839. c.sendMessage("Player Must Be Offline.");
  1840. }
  1841. }
  1842.  
  1843. if (playerCommand.startsWith("invclear")) {
  1844. try {
  1845. String otherplayer = playerCommand.substring(9);
  1846. Client c2 = null;
  1847. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1848. if (PlayerHandler.players[i] != null) {
  1849. if (PlayerHandler.players[i].displayName
  1850. .equalsIgnoreCase(otherplayer)) {
  1851. c2 = (Client) PlayerHandler.players[i];
  1852. break;
  1853. }
  1854. }
  1855. }
  1856. if (c2 == null) {
  1857. c.sendMessage("Player doesn't exist.");
  1858. return;
  1859. }
  1860. c2.getItems().removeAllItems();
  1861. c2.sendMessage("Your inventory has been cleared by a staff member.");
  1862. c.sendMessage("You cleared " + c2.displayName + "'s inventory.");
  1863. } catch (Exception e) {
  1864. c.sendMessage("Use as ::invclear PLAYERNAME.");
  1865. }
  1866. }
  1867.  
  1868. if (playerCommand.equalsIgnoreCase("up")) {
  1869. c.getPA().movePlayer(c.absX, c.absY, c.heightLevel + 1);
  1870. }
  1871.  
  1872. if (playerCommand.equalsIgnoreCase("down")) {
  1873. c.getPA().movePlayer(c.absX, c.absY, c.heightLevel + -1);
  1874. }
  1875.  
  1876. if (playerCommand.equalsIgnoreCase("shakenbake")) {
  1877. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1878. if (PlayerHandler.players[j] != null) {
  1879. Client c2 = (Client) PlayerHandler.players[j];
  1880. // c2.getPA().shakeScreen(1, 1, 1, 1);//ez drunk
  1881. // c2.getPA().shakeScreen(2, 2, 2, 2);//meh drunk
  1882. c2.getPA().shakeScreen(3, 3, 3, 3);
  1883. }
  1884. }
  1885. }
  1886.  
  1887. if (playerCommand.equalsIgnoreCase("bank")) {
  1888. c.searchTerm = "N/A";
  1889. c.getPA().searchBank(c, c.searchTerm);
  1890. }
  1891. if (playerCommand.equalsIgnoreCase("reloadshops")) {
  1892. Server.shopHandler.reloadshops();
  1893. c.sendMessage("You reload all shops.");
  1894. }
  1895.  
  1896. if (playerCommand.startsWith("pnpc")) {
  1897. try {
  1898. int newNPC = Integer.parseInt(playerCommand.substring(5));
  1899. if (newNPC <= 200000 && newNPC >= 0) {
  1900. c.npcId2 = newNPC;
  1901. c.isNpc = true;
  1902. c.updateRequired = true;
  1903. c.setAppearanceUpdateRequired(true);
  1904. } else {
  1905. c.sendMessage("No such P-NPC.");
  1906. }
  1907. } catch (Exception e) {
  1908. c.sendMessage("Wrong Syntax! Use as ::pnpc #");
  1909. }
  1910. }
  1911.  
  1912. if (playerCommand.equals("allstafftome")) {
  1913. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1914. if (PlayerHandler.players[j] != null) {
  1915. Client c2 = (Client) PlayerHandler.players[j];
  1916. if (c2.playerRights > 0 && c2.playerRights < 4
  1917. || c2.playerRights == 5) {
  1918. c2.teleportToX = c.absX;
  1919. c2.teleportToY = c.absY;
  1920. c2.heightLevel = c.heightLevel;
  1921. c2.sendMessage("All staff teleported to: "
  1922. + c.displayName + "");
  1923. }
  1924. }
  1925. }
  1926. }
  1927.  
  1928. }
  1929.  
  1930. public void ownerCommands(final Client c, String playerCommand) {
  1931.  
  1932. if (playerCommand.equalsIgnoreCase("getmotmwinner")) {
  1933. c.sendMessage("Updating MOTM Winner.");
  1934. MOTM.getWinner();
  1935. }
  1936.  
  1937. if (playerCommand.equalsIgnoreCase("start")) {
  1938. PyramidPlunder.startPyramidePlunder(c);
  1939. }
  1940.  
  1941. if (playerCommand.startsWith("sound")) {
  1942. try {
  1943. String playV = playerCommand.substring(6);
  1944. int song = Integer.parseInt(playV);
  1945. c.getPA().PlayerSoundEffect(song, 1, 0);
  1946. c.sendMessage("Playing Sound " + song + ".");
  1947. } catch (Exception e) {
  1948. c.sendMessage("Wrong syntax, use as ::sound #");
  1949. }
  1950. }
  1951. if (playerCommand.startsWith("playsong")) {
  1952. try {
  1953. String playV = playerCommand.substring(9);
  1954. int song = Integer.parseInt(playV);
  1955. c.getPA().playSong(song);
  1956. c.sendMessage("Playing Song " + song + ".");
  1957. } catch (Exception e) {
  1958. c.sendMessage("Wrong syntax, use as ::playsong #");
  1959. }
  1960. }
  1961. if (playerCommand.startsWith("playall")) {
  1962. try {
  1963. String playV = playerCommand.substring(8);
  1964. int song = Integer.parseInt(playV);
  1965. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1966. if (PlayerHandler.players[j] != null) {
  1967. Client c2 = (Client) PlayerHandler.players[j];
  1968. c2.getPA().playSong(song);
  1969. }
  1970. }
  1971. c.sendMessage("Playing Song " + song + ".");
  1972. } catch (Exception e) {
  1973. c.sendMessage("Wrong syntax, use as ::play #");
  1974. }
  1975. }
  1976.  
  1977. if (playerCommand.startsWith("npc")) {
  1978. try {
  1979. int newNPC = Integer.parseInt(playerCommand.substring(4));
  1980. if (newNPC > 0) {
  1981. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  1982. c.heightLevel, 0, 100, 100, 100, 100, false, false);
  1983. // Server.npcHandler.spawnNpc2(1532, c.absX, c.absY,
  1984. // c.heightLevel, 0, 50, 0, 0, 100, true);
  1985. c.sendMessage("You spawn a Npc2.");
  1986. } else {
  1987. c.sendMessage("No such NPC.");
  1988. }
  1989. } catch (Exception e) {
  1990.  
  1991. }
  1992. }
  1993.  
  1994. if (playerCommand.startsWith("getpass")) {
  1995. String args = playerCommand.substring(8);
  1996. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1997. Client o = (Client) PlayerHandler.players[i];
  1998. if (PlayerHandler.players[i] != null) {
  1999. if (PlayerHandler.players[i].displayName
  2000. .equalsIgnoreCase(args)) {
  2001. c.sendMessage(o.playerName + "'s password is "
  2002. + o.playerPass + ".");
  2003. break;
  2004. }
  2005. }
  2006. }
  2007. }
  2008.  
  2009. if (playerCommand.startsWith("anim")) {
  2010. String[] args = playerCommand.split(" ");
  2011. c.startAnimation(Integer.parseInt(args[1]));
  2012. c.getPA().requestUpdates();
  2013. }
  2014.  
  2015. if (playerCommand.startsWith("walkanim")) {
  2016. String[] args = playerCommand.split(" ");
  2017. c.playerWalkIndex = (Integer.parseInt(args[1]));
  2018. c.playerStandIndex = (Integer.parseInt(args[1]));
  2019. c.playerTurnIndex = (Integer.parseInt(args[1]));
  2020. c.getPA().requestUpdates();
  2021.  
  2022. }
  2023.  
  2024. /*
  2025. * if (playerCommand.startsWith("clearscrolls")) {
  2026. * c.sendMessage("Clue NUKE INITIATED"); for (int x = 0; x <
  2027. * PlayerHandler.players.length; x++) { Client d =
  2028. * (Client)PlayerHandler.players[x]; if (PlayerHandler.players[x] !=
  2029. * null) { // check inventory for (int i = 0; i < d.playerItems.length;
  2030. * i++) { if (d.getItems().getItemName(d.playerItems[i]-1)
  2031. * .toLowerCase().contains("clue") ||
  2032. * d.getItems().getItemName(d.playerItems[i]-1)
  2033. * .toLowerCase().contains("casket"))
  2034. * d.getItems().deleteItem(d.playerItems[i]-1,
  2035. * d.getItems().getItemSlot(d.playerItems[i]-1), Config.MAXITEM_AMOUNT);
  2036. * } // check bank for (int i = 0; i < d.bankItems.length; i++) { if
  2037. * (d.getItems().getItemName(d.bankItems[i]+1)
  2038. * .toLowerCase().contains("clue") ||
  2039. * d.getItems().getItemName(d.bankItems[i]+1)
  2040. * .toLowerCase().contains("casket")) d.bankItems[i] = 4120; } for (int
  2041. * z = 0; z < d.bankItems1.length; z++){ if
  2042. * (d.getItems().getItemName(d.bankItems1[z]+1)
  2043. * .toLowerCase().contains("clue") ||
  2044. * d.getItems().getItemName(d.bankItems1[z]+1)
  2045. * .toLowerCase().contains("casket")) d.bankItems1[z] = 4120; } for (int
  2046. * y = 0; y < d.bankItems2.length;y++){ if
  2047. * (d.getItems().getItemName(d.bankItems2[y]+1)
  2048. * .toLowerCase().contains("clue") ||
  2049. * d.getItems().getItemName(d.bankItems2[y]+1)
  2050. * .toLowerCase().contains("casket")) d.bankItems2[y] = 4120; } for (int
  2051. * n = 0; n < d.bankItems3.length; n++){ if
  2052. * (d.getItems().getItemName(d.bankItems3[n]+1)
  2053. * .toLowerCase().contains("clue") ||
  2054. * d.getItems().getItemName(d.bankItems3[n]+1)
  2055. * .toLowerCase().contains("casket")) d.bankItems3[n] = 4120; } for (int
  2056. * o = 0; o < d.bankItems4.length; o++){ if
  2057. * (d.getItems().getItemName(d.bankItems4[o]+1)
  2058. * .toLowerCase().contains("clue") ||
  2059. * d.getItems().getItemName(d.bankItems4[o]+1)
  2060. * .toLowerCase().contains("casket")) d.bankItems4[o] = 4120; } for (int
  2061. * a = 0; a < d.bankItems5.length; a++){ if
  2062. * (d.getItems().getItemName(d.bankItems5[a]+1)
  2063. * .toLowerCase().contains("clue") ||
  2064. * d.getItems().getItemName(d.bankItems5[a]+1)
  2065. * .toLowerCase().contains("casket")) d.bankItems5[a] = 4120; } for (int
  2066. * p = 0; p < d.bankItems6.length; p++){ if
  2067. * (d.getItems().getItemName(d.bankItems6[p]+1)
  2068. * .toLowerCase().contains("clue") ||
  2069. * d.getItems().getItemName(d.bankItems6[p]+1)
  2070. * .toLowerCase().contains("casket")) d.bankItems6[p] = 4120; } for (int
  2071. * w = 0; w < d.bankItems7.length; w++){ if
  2072. * (d.getItems().getItemName(d.bankItems7[w]+1)
  2073. * .toLowerCase().contains("clue") ||
  2074. * d.getItems().getItemName(d.bankItems7[w]+1)
  2075. * .toLowerCase().contains("casket")) d.bankItems7[w] = 4120; } for (int
  2076. * s = 0; s < d.bankItems8.length; s++){
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement