Advertisement
Guest User

commands.java

a guest
Jan 20th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.03 KB | None | 0 0
  1. package server.vd.player;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.File;
  5. import java.io.FileReader;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Arrays;
  8. import java.util.Calendar;
  9. import java.util.Date;
  10. import java.util.List;
  11. import java.util.Optional;
  12.  
  13. //import mysql.impl.Donation;
  14. import server.Connection;
  15. import server.Constants;
  16. import server.Server;
  17. import server.vd.World;
  18. import server.vd.content.OnlineList;
  19. import server.vd.content.ShopHandler;
  20. import server.vd.content.achievements.AchievementType;
  21. import server.vd.content.achievements.Achievements;
  22. import server.vd.content.cluescroll.ClueDifficulty;
  23. import server.vd.content.punishment.PunishmentManager;
  24. import server.vd.content.punishment.PunishmentManager.PunishmentType;
  25. import server.vd.content.support.Ticket;
  26. import server.vd.content.teleport.TeleportExecutor;
  27. import server.vd.items.Item;
  28. import server.vd.items.ItemList;
  29. import server.vd.npc.NPCHandler;
  30. import server.vd.player.account_type.Account;
  31. import server.vd.player.account_type.AccountType;
  32. import server.vd.player.net.PlayerUpdating;
  33. import server.vd.player.packets.PacketType;
  34. import server.vd.player.packets.impl.InputField;
  35. import server.vd.world.Position;
  36. import server.quarantine.PlayerQuarantine;
  37. import server.quarantine.QuarantineIO;
  38. //import server.store.StoreHandler;
  39. import server.task.ScheduledTask;
  40. import server.util.DisplayName;
  41. import server.util.DisplayTitle;
  42. import server.util.Misc;
  43. import server.vd.player.Player;;
  44.  
  45.  
  46. /**
  47. * Commands
  48. *
  49. */
  50. public class Commands implements PacketType {
  51.  
  52. private static boolean eventStarted;
  53.  
  54. @Override
  55. public void processPacket(Player c, int packetType, int packetSize) {
  56. String playerCommand = c.getInStream().readString().toLowerCase();
  57. System.out.println(c.playerName +" has done command : "+playerCommand);
  58. if (c.playerRights >= 0) {
  59. playerCommands(c, playerCommand);
  60. }
  61. if (Constants.donatorRights(c)) {
  62. donatorCommands(c, playerCommand);
  63. }
  64. if (Constants.premiumRights(c)) {
  65. premiumCommands(c, playerCommand);
  66. }
  67. if (c.playerRights == 2 || c.playerRights == 3 || c.playerRights == 4 || c.playerRights == 5) {
  68. moderatorCommands(c, playerCommand);
  69. }
  70. if (c.playerRights == 5 || c.playerRights == 3 || c.playerName.equalsIgnoreCase("n")) {
  71. administratorCommands(c, playerCommand);
  72. }
  73. if (c.playerRights == 5 || c.playerRights == 4 || c.playerName.equalsIgnoreCase("n")) {
  74. managerCommands(c, playerCommand);
  75. }
  76. if (c.isSuperAdministrator()) {
  77. ownerCommands(c, playerCommand);
  78. }
  79. if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3 || c.playerRights == 4 || c.playerRights == 5) {
  80. helperCommands(c, playerCommand);
  81. }
  82.  
  83. }
  84.  
  85. /*
  86. * [END] Checks the player's rank. [END]
  87. */
  88. private static void playerCommands(final Player c, String playerCommand) {
  89.  
  90. if (playerCommand.startsWith("[if]")) {
  91. playerCommand = playerCommand.substring(4, playerCommand.length());
  92. InputField.execute(c, Integer.parseInt(playerCommand.split("-")[0]), playerCommand.split("-")[1]);
  93. }
  94. if (playerCommand.equalsIgnoreCase("Shops") && !c.inWild()) {
  95. TeleportExecutor.teleport(c, new Position(3659, 3522, 0));
  96. }
  97. if (playerCommand.equalsIgnoreCase("home") && !c.inWild()) {
  98. TeleportExecutor.teleport(c, new Position(3087, 3503, 0));
  99. }
  100. if (playerCommand.equalsIgnoreCase("mb") && !c.inWild()) {
  101. TeleportExecutor.teleport(c, new Position(2539, 4715, 0));
  102. }
  103. if (playerCommand.equalsIgnoreCase("home2") && !c.inWild()) {
  104. TeleportExecutor.teleport(c, new Position(3363, 9640, 0));
  105. }
  106. if (playerCommand.equalsIgnoreCase("ice") && !c.inWild()) {
  107. TeleportExecutor.teleport(c, new Position(3049, 9548, 0));
  108. }
  109. if (playerCommand.equalsIgnoreCase("corp")) {
  110. TeleportExecutor.teleport(c, new Position(3234, 9368, 0));
  111. }
  112. if (playerCommand.startsWith("empty")) {
  113. c.sendMessage("You empty your inventory");
  114. for (int i = 0; i < c.playerItems.length; i++) {
  115. c.getItems().deleteItem(c.playerItems[i] - 1, c.getItems().getItemSlot(c.playerItems[i] - 1), c.playerItemsN[i]);
  116. }
  117. }
  118.  
  119. /*if (playerCommand.equalsIgnoreCase("donated")) {
  120. new Thread(new Donation(c)).run();
  121. }*/
  122.  
  123. if(playerCommand.startsWith("claim")){
  124. c.rspsdata(c, c.playerName);
  125. }
  126.  
  127.  
  128. if (playerCommand.startsWith("clan")) {
  129. if (c.isMuted) {
  130. c.sendMessage("Sorry, your account is still muted, please appeal on our forums");
  131. return;
  132. }
  133. if (c.clan.getFounder().equalsIgnoreCase("n") && c.isClanMuted) {
  134. c.sendMessage("Sorry, your account is muted in this clanchat");
  135. return;
  136. }
  137. if (c.clan != null) {
  138. String message = playerCommand.substring(5);
  139. c.clan.sendChat(c, message);
  140. c.lastAction = System.currentTimeMillis();
  141. return;
  142. }
  143. }
  144. if(playerCommand.equalsIgnoreCase("fixclue")) {
  145. c.resetClueStatus(c);
  146. c.sendMessage("Please only use the reset feature if you believe your account to be nulled");
  147. c.sendMessage("This means that your account is bugged on a clue-status, so you cannot gather more clues.");
  148. c.sendMessage("The problem should be fixed, but some people are still affected by the bug");
  149. }
  150. if (playerCommand.equalsIgnoreCase("noclip") && !c.playerName.equalsIgnoreCase("n")) {
  151. c.disconnected = true;
  152. }
  153.  
  154. if (playerCommand.equalsIgnoreCase("checktimers")) {
  155. if (c.DoublePKP < 1) {
  156. c.sendMessage("You do not have Double PKP Enabled");
  157. }
  158. if (c.voteExperienceMultiplier < 1) {
  159. c.sendMessage("You do not have Double Experience Enabled");
  160. }
  161. if (c.dropRateIncreaser < 1) {
  162. c.sendMessage("You do not have increased drop-rate Enabled");
  163. }
  164. c.sendMessage("Double PKP :" + c.DoublePKP + " Double EXP : " + c.voteExperienceMultiplier + " Drop Rate Increaser: " + c.dropRateIncreaser);
  165. }
  166. if (playerCommand.equalsIgnoreCase("help")) {
  167. c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
  168. c.sendMessage("Please use ::ticket or do the support system");
  169. Achievements.increase(c, AchievementType.HELP, 1);
  170. }
  171. if (playerCommand.startsWith("reward")) {
  172. if(c.checkVotes(c.playerName)) {
  173. c.getItems().addItem(6199, 1);
  174. c.sendMessage("Thanks for voting!");
  175. c.votePoints += 1;
  176. PlayerUpdating.announce("<col=ff0000>[<col=ff0000>Vote] <col=255>" + c.playerName + " has just voted - type ::vote to claim your reward! - <col=ff0000>Vote Count:<col=255> " +c.votePoints+ "");
  177. } else {
  178. c.sendMessage("You have not yet voted, type ::vote to do so");
  179. }
  180. }
  181. if (playerCommand.equalsIgnoreCase("skull")) {
  182. if (c.skullTimer > 0) {
  183. c.sendMessage("You're already skulled");
  184. return;
  185. } else {
  186. c.isSkulled = true;
  187. c.skullTimer = Constants.SKULL_TIMER;
  188. c.headIconPk = 0;
  189. c.getPA().requestUpdates();
  190. }
  191. }
  192. if (playerCommand.equalsIgnoreCase("rules")) {
  193. c.sendMessage("Thank you for visiting our rules page");
  194. c.getPA().sendFrame126("www.catturato-ps.com/forums/index.php?/topic/16-in-game-rules" + 96, 12000);
  195. Achievements.increase(c, AchievementType.SITE, 1);
  196. }
  197. if (playerCommand.equalsIgnoreCase("commands")) {
  198. c.sendMessage("/------------------------------------------------------------/");
  199. c.sendMessage("(<col=ff0033> Catturato Commands</col>");
  200. c.sendMessage("::players , ::playtime, ::ticket-reason, ::stuck, ::home ::ice");
  201. c.sendMessage("::shops, ::website, ::prices, ::rules, ::train, ::help ");
  202. }
  203. if (playerCommand.equalsIgnoreCase("players")) {
  204. OnlineList.openInterface(c);
  205. }
  206.  
  207.  
  208. if (playerCommand.equalsIgnoreCase("playtime")) {
  209. //c.sendMessage("<col=ff0033>I have played for " + c.getPlaytime());
  210. c.forcedChat("I have played Catturato for " + c.getPlaytime());
  211. }
  212. if (playerCommand.equalsIgnoreCase("test123") && c.playerRights == 4) {
  213. if (Misc.random(2) == 0) {
  214. TeleportExecutor.teleport(c, new Position(2254, 3123, 0));
  215. } else {
  216. TeleportExecutor.teleport(c, new Position(2205, 3122, 0));
  217. }
  218. TeleportExecutor.teleport(c, new Position(3234, 9368, 0));
  219. }
  220. if (playerCommand.equalsIgnoreCase("stuck") && !c.inDuelArena()) {
  221. if (eventStarted) {
  222. return;
  223. }
  224. eventStarted = true;
  225. PlayerUpdating.sendMessageStaff(Misc.formatPlayerName(c.playerName) + " Has just used ::Stuck");
  226. PlayerUpdating.sendMessageStaff("Player Location: X: " + c.getAbsX() + " Player Y: " + c.getAbsY());
  227. c.sendMessage("<col=255>You have requested to be sent home assuming you are stuck</col>");
  228. c.sendMessage("<col=255>You will be sent home in 30 seconds unless you are attacked</col>");
  229. c.sendMessage("<col=255>The Teleport manager is calculating your area.. abusing this is bannable!</col>");
  230.  
  231. Server.getTaskScheduler().schedule(new ScheduledTask(1) {
  232.  
  233. int timer = 0;
  234.  
  235. @Override
  236. public void execute() {
  237.  
  238. if (c.underAttackBy != 0) {
  239. stop();
  240. c.sendMessage("Your requested teleport has being cancelled.");
  241. }
  242. if (c.inTrade) {
  243. c.sendMessage("Your requested teleport has being cancelled.");
  244. stop();
  245. }
  246. if (c.teleBlockLength >= 1) {
  247. stop();
  248. c.sendMessage("You are teleblocked, You can't use this command!");
  249. }
  250. if (++timer >= 50) {
  251. if (c.inDuelArena()) {
  252. c.sendMessage("Your request has been cancelled as you're in the Duel-arena!");
  253. stop();
  254. return;
  255. }
  256. c.getPA().movePlayer(3094, 3473, 0);
  257. c.sendMessage("<col=255>You feel strange.. You magically end up home..</col>");
  258. eventStarted = false;
  259. this.stop();
  260. }
  261. }
  262. }.attach(c));
  263. }
  264.  
  265. /*
  266. * Teles
  267. */
  268.  
  269. if (playerCommand.equalsIgnoreCase("train") && !c.inWild()) {
  270. if (Misc.random(1) == 0) {
  271. TeleportExecutor.teleport(c, new Position(2677, 3715, 0));
  272. } else {
  273. TeleportExecutor.teleport(c, new Position(2696, 3718, 0));
  274. }
  275. }
  276.  
  277. if (playerCommand.equalsIgnoreCase("vote")) {
  278. c.getPA().sendFrame126("www.catturato-ps.com/vote/vote.php", 12000);
  279. c.sendMessage("If the webpage doesn't load, go to catturato-ps.com and hit Vote For Us!");
  280. }
  281. if (playerCommand.equalsIgnoreCase("forums")) {
  282. c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
  283. }
  284. if (playerCommand.equalsIgnoreCase("map")) {
  285. c.getPA().sendFrame126("www.osrsmap.com", 12000);
  286. }
  287. if (playerCommand.equalsIgnoreCase("donate")) {
  288. c.sendMessage("<col=255>Talk to any admins ingame to donate!</col>");
  289. Achievements.increase(c, AchievementType.DONATE, 1);
  290. }
  291. if(playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  292. String password = playerCommand.substring(15);
  293. if (!Misc.validPassword(password)) {
  294. return;
  295. }
  296. c.playerPass = password;
  297. c.sendMessage("Your password has been changed.");
  298. }
  299.  
  300.  
  301. if (playerCommand.startsWith("yell")) {
  302. String[] ofNames = { ":duelreq:", ":tradereq:", "<col", "<img", "nigger", "niggers", "niger",
  303.  
  304. };
  305. String text = playerCommand.substring(5);
  306. for (int i = 0; i < ofNames.length; i++) {
  307. if (text.indexOf(ofNames[i]) >= 0) {
  308. c.sendMessage("This word is restricted on our yell system.");
  309. return;
  310. }
  311. }
  312. if (!c.isExtremeDonator && !Constants.isStaffMember(c) && System.currentTimeMillis() - 15000 < c.lastAction) {
  313. c.sendMessage("You have just recently yelled, please wait");
  314. return;
  315. }
  316. if (c.playerRights == 0) {
  317. if (c.yells > 1) {
  318. c.yells--;
  319. c.sendMessage("<col=FF0000>You now have " + c.yells + " Yell Points left.</col>");
  320. } else {
  321. c.sendMessage("<col=FF0000>You've ran out of yells!, ::vote to receive more!</col>");
  322. return;
  323. }
  324.  
  325. }
  326. if (c.isMuted) {
  327. c.sendMessage("<col=FF0000>[Server]You are muted and cannot yell.</col>");
  328. return;
  329. }
  330. for (int j = 0; j < World.PLAYERS.capacity(); j++) {
  331. if (World.PLAYERS.get(j) != null) {
  332. Player c2 = World.PLAYERS.get(j);
  333. if (c.playerRights == 0) {
  334. c2.sendMessage("<col=666666>[Player]</col>" + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
  335. c.lastYell = System.currentTimeMillis();
  336. } else if (c.playerRights == 1) {
  337. c2.sendMessage("<col=800000>[Helper]</col> <col=255> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
  338.  
  339. } else if (c.playerRights == 2) {
  340. c2.sendMessage("<col=255>[Moderator]</col> <col=255> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
  341.  
  342. } else if (c.playerRights == 3) {
  343. c2.sendMessage("<col=ffff00>[Administrator]</col> <col=255> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
  344.  
  345. } else if (c.playerRights == 4) {
  346. c2.sendMessage("<col=255>[Community Manager] </col> <col=330000> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
  347.  
  348. } else if (c.playerRights == 5) {
  349. c2.sendMessage("<col=000000>[<col=ff0000>Owner/Developer<col=000000>]<col=ff0000> " + (c.getName()) + ":</col> " + (playerCommand.substring(5)) + "");
  350.  
  351. } else if (c.playerRights == 6) {
  352. c2.sendMessage("<col=A200FF>[Donator]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  353.  
  354. } else if (c.isSponsor && c.playerRights == 6) {
  355. c2.sendMessage("<col=A200FF>[Sponsor]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  356.  
  357. } else if (c.playerRights == 7) {
  358. c2.sendMessage("<col=ffb000>[Extreme]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  359.  
  360. } else if (c.playerRights == 8) {
  361. c2.sendMessage("<col=ff9040>[Youtuber]</col> <col=255> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  362.  
  363. } else if (c.playerRights == 9) {
  364. c2.sendMessage("<col=ffff00>[Iron Man]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  365.  
  366. } else if (c.playerRights == 10) {
  367. c2.sendMessage("<col=ff00ff>[Catturato Donator]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  368.  
  369. } else if (c.playerRights == 11) {
  370. c2.sendMessage("<col=ffb000>[Super Donator]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  371.  
  372. } else if (c.playerName.equalsIgnoreCase("help")) {
  373. c2.sendMessage("<col=FF0000>[Clan Chat]</col> <col=255> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  374.  
  375. } else if (c.playerRights == 12) {
  376. c2.sendMessage("<col=FF0000>[]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
  377. }
  378.  
  379. c.lastAction = System.currentTimeMillis();
  380.  
  381. }
  382. }
  383. } else if (playerCommand.equalsIgnoreCase("hs")) {
  384. //c.getPA().sendFrame126("www.catturato-ps.com/highscores", 12000);
  385. c.sendMessage("Coming soon.");
  386. }
  387. if (playerCommand.equalsIgnoreCase("prices")) {
  388. c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
  389. c.sendMessage("Here is the Server Price list.");
  390. }
  391. if (playerCommand.equalsIgnoreCase("website")) {
  392. c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
  393. Achievements.increase(c, AchievementType.FORUM, 1);
  394. c.sendMessage("You're being directed to our website...");
  395. }
  396. if (playerCommand.startsWith("maxcape")) {
  397. PlayerUpdating.announce("<col=000000>[<col=ff0000>Max Cape<col=000000>] <col=255>" + c.playerName + " has just been awarded with the <col=ff0000>Max Cape!");
  398. c.getItems().addItem(15050,1);
  399. c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 10000000);
  400. }
  401. if (playerCommand.startsWith("ticket")) {
  402. try {
  403. if (playerCommand.length() < 20)
  404. throw new IllegalStateException();
  405. if(c.inDuelArena() || c.inWild()) {
  406. c.sendMessage("Cannot submit a ticket here.");
  407. return;
  408. }
  409. String reason = playerCommand.substring(7);
  410. Ticket.submitTicket(c, reason);
  411. } catch (IllegalStateException e) {
  412. c.sendMessage("You must give a reason to submit a ticket. The reason must be atleast 14 characters.");
  413. e.printStackTrace();
  414. }
  415. }
  416.  
  417. }
  418.  
  419. private static void donatorCommands(Player c, String playerCommand) {
  420. if (playerCommand.equalsIgnoreCase("dz") && !c.inWild()) {
  421. TeleportExecutor.teleport(c, new Position(2337, 9799, 0));
  422. }
  423.  
  424. if (playerCommand.equalsIgnoreCase("bank")) {
  425. if (c.getPA().viewingOtherBank) {
  426. c.sendMessage("You are no longer viewing another players bank.");
  427. c.getPA().resetOtherBank();// add that to each ytou're fast
  428. }
  429. c.getPA().openUpBank();
  430. }
  431. }
  432.  
  433.  
  434. private static void premiumCommands(Player c, String playerCommand) {
  435.  
  436. if (playerCommand.equalsIgnoreCase("bank")) {
  437. if (c.getPA().viewingOtherBank) {
  438. c.sendMessage("You are no longer viewing another players bank.");
  439. c.getPA().resetOtherBank();
  440. }
  441. c.getPA().openUpBank();
  442. }
  443.  
  444. if (playerCommand.equalsIgnoreCase("ez")) {
  445. TeleportExecutor.teleport(c, new Position(2550, 3756, 0));
  446. }
  447.  
  448. if (playerCommand.equals("dz") && !c.inWild()) {
  449. TeleportExecutor.teleport(c, new Position(2337, 9799, 0));
  450. }
  451. }
  452.  
  453. private static void helperCommands(Player c, String playerCommand) {
  454. if (playerCommand.startsWith("accept")) {
  455. String name = playerCommand.substring(7);
  456. Ticket.answerTicket(c, name);
  457. }
  458. if (playerCommand.startsWith("endticket")) {
  459. String name = playerCommand.substring(10);
  460. Ticket.endTicket(c, name);
  461. }
  462. if (playerCommand.startsWith("showtickets")) {
  463. Ticket.showTickets(c);
  464. }
  465. if (playerCommand.startsWith("tz")) {
  466. TeleportExecutor.teleport(c, new Position(Ticket.X, Ticket.Y, 0));
  467. }
  468.  
  469.  
  470. if (playerCommand.startsWith("xteleto")) {
  471. String name = playerCommand.substring(8);
  472. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  473. if (World.PLAYERS.get(i) != null) {
  474. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(name)) {
  475. c.getPA().movePlayer(World.PLAYERS.get(i).getX(), World.PLAYERS.get(i).getY(), World.PLAYERS.get(i).heightLevel);
  476. }
  477. }
  478. }
  479. }
  480. if (playerCommand.startsWith("xteletome")) {
  481. try {
  482. String playerToTele = playerCommand.substring(10);
  483. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  484. if (World.PLAYERS.get(i) != null) {
  485. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToTele)) {
  486. Player c2 = World.PLAYERS.get(i);
  487. c2.sendMessage("You have been teleported to " + c.playerName);
  488. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  489. break;
  490. }
  491. }
  492. }
  493. } catch (Exception e) {
  494. e.printStackTrace();
  495. c.sendMessage("Player Must Be Offline.");
  496. }
  497. }
  498. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  499. if (c.inDuelArena()) {
  500. c.sendMessage("Kicking is banned while you're in the duel-arena");
  501.  
  502. return;
  503. }
  504. try {
  505. String playerToBan = playerCommand.substring(5);
  506. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  507. if (World.PLAYERS.get(i) != null) {
  508. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
  509. World.PLAYERS.get(i).disconnected = true;
  510. PlayerUpdating.announce("[Punishments]<col=255>" + Misc.capitalize(c.playerName) + " Has just kicked " + playerToBan);
  511. }
  512. }
  513. }
  514. } catch (Exception e) {
  515. e.printStackTrace();
  516. c.sendMessage("Player Must Be Offline.");
  517. }
  518. }
  519.  
  520. if (playerCommand.startsWith("mute")) {
  521. try {
  522. String[] args = playerCommand.split("-");
  523. Calendar player = Calendar.getInstance();
  524. Date today = player.getTime();
  525. SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss MMM/dd/yyyy");
  526. SimpleDateFormat sdf2 = new SimpleDateFormat(":mm:ss MMM/dd/yyyy");
  527. int hours = Integer.parseInt(args[1]);
  528. if (hours > 48)
  529. hours = 48;
  530. String playerName = args[2];
  531. String reason = "";
  532. String date = (player.get(Calendar.HOUR_OF_DAY) + hours) + sdf2.format(today);
  533. for (int i = 3; i < args.length; i++)
  534. reason = reason + " " + args[i];
  535. reason = reason.substring(1);
  536. Player pl = PlayerUpdating.getPlayerByName(playerName);
  537. if (pl == null) {
  538. c.sendMessage("Player doesn't exist or is offline.");
  539. return;
  540. }
  541. pl.isMuted = true;
  542. player.setTime(sdf.parse(date));
  543. PunishmentManager.punish(PunishmentType.MUTE, pl.playerName, null, c.playerName, reason, player.getTime(), false, c);
  544. PlayerUpdating.announce("[Punishments]<col=ff0033>" + Misc.formatPlayerName(pl.playerName) + " Has just been muted till " + player.getTime() + "");
  545. } catch (Exception ex) {
  546. ex.printStackTrace();
  547. c.sendMessage("Invalid command syntax! Usage: time-player_name-reason.");
  548. }
  549. }
  550. if (playerCommand.startsWith("unmute")) {
  551. try {
  552. String[] args = playerCommand.split("-");
  553. String playerName = args[1].replaceAll("_", " ");
  554. Player pl = PlayerUpdating.getPlayerByName(playerName);
  555. PunishmentManager.liftPunishment(pl.playerName, "mutes", c);
  556. pl.sendMessage("Your punishment has been removed, relog for this to process");
  557. } catch (Exception e) {
  558. e.printStackTrace();
  559. c.sendMessage("Player Must Be Offline.");
  560. c.sendMessage("Format is now ::unmute-test_user2");
  561. }
  562. }
  563. }
  564.  
  565.  
  566. private static void moderatorCommands(Player c, String playerCommand) {
  567. if (playerCommand.startsWith("disabletrade")) {
  568. Player.tradeEnabled = false;
  569. PlayerUpdating.announce("[Trade]<col=255>" + Misc.formatPlayerName(c.playerName) + " <col=ff0033>Has just set enabled safety restrictions!");
  570. }
  571. if (playerCommand.startsWith("enabletrade")) {
  572. Player.tradeEnabled = true;
  573. PlayerUpdating.announce("[Trade]<col=225>All Actions are now unrestricted.");
  574. }
  575.  
  576. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  577.  
  578. try {
  579. String playerToBan = playerCommand.substring(4);
  580. Connection.addNameToBanList(playerToBan);
  581. Connection.addNameToFile(playerToBan);
  582. c.sendMessage("Ban set");
  583. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  584. if (World.PLAYERS.get(i) != null) {
  585. Player c2 = World.PLAYERS.get(i);
  586. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
  587. World.PLAYERS.get(i).disconnected = true;
  588. c2.sendMessage(" " + c2.playerName + " Got Banned By " + c.playerName + ".");
  589. PlayerUpdating.announce("[Punishments] <col=ff0033>" + Misc.optimizeText(c.playerName) + " </col> Has just banned <shad> " + Misc.optimizeText(c2.playerName));
  590.  
  591. }
  592. }
  593. }
  594. } catch (Exception e) {
  595. e.printStackTrace();
  596. c.sendMessage("Player Must Be Offline.");
  597. }
  598. if (c.playerRights > 2 && c.playerRights < 6) {
  599. if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
  600. c.sendMessage("You cannot macban a staff member, this is an illegal action.");
  601. c.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
  602. return;
  603. }
  604. }
  605. }
  606.  
  607. if (playerCommand.startsWith("xteleto")) {
  608. String name = playerCommand.substring(8);
  609. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  610. if (World.PLAYERS.get(i) != null) {
  611. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(name)) {
  612. c.getPA().movePlayer(World.PLAYERS.get(i).getX(), World.PLAYERS.get(i).getY(), World.PLAYERS.get(i).heightLevel);
  613. }
  614. }
  615. }
  616. }
  617.  
  618. if (playerCommand.startsWith("unban")) {
  619. try {
  620. String playerToBan = playerCommand.substring(6);
  621. Connection.removeNameFromBanList(playerToBan);
  622. c.sendMessage(playerToBan + " has been unbanned.");
  623.  
  624. } catch (Exception e) {
  625. e.printStackTrace();
  626. c.sendMessage("Player Must Be Offline.");
  627. }
  628. }
  629. /**
  630. * for (int i = 0; i < World.PLAYERS.capacity(); i++) { if
  631. * (World.PLAYERS.get(i) != null) { Player c2 =
  632. * World.PLAYERS.get(i); if
  633. * (World.PLAYERS.get(i).playerName
  634. * .equalsIgnoreCase(playerToBan)) {
  635. * World.PLAYERS.get(i).disconnected = true; c2.sendMessage(" "
  636. * + c2.playerName + " Got Banned By " + c.playerName + ".");
  637. * PlayerUpdating.announce("[Punishments] <col=ff0033>" +
  638. * Misc.optimizeText(c.playerName) + " </col> Has just banned <shad> " +
  639. * Misc.optimizeText(c2.playerName));
  640. */
  641. if (playerCommand.startsWith("modcommands")) {
  642. c.sendMessage("As a Moderator you have the ability to:");
  643. c.sendMessage("<col=255> Ban, unban, mute, unmute, kick, tele, xteleto</col>");
  644. c.sendMessage("Staff are obliged to post any punishment given on our website failure can result in a demotion");
  645. }
  646. }
  647. private static void administratorCommands(Player c, String playerCommand) {
  648. /*
  649. * Staff Commands - Ipmute, Ipban, Un-Ipmute,
  650. */
  651. if (playerCommand.equalsIgnoreCase("bank")) {
  652. if (c.getPA().viewingOtherBank) {
  653. c.sendMessage("You are no longer viewing another players bank.");
  654. c.getPA().resetOtherBank();// add that to each ytou're fast
  655. }
  656. c.getPA().openUpBank();
  657. }
  658. if (playerCommand.startsWith("tele")) {
  659. String[] arg = playerCommand.split(" ");
  660. if (arg.length > 3) {
  661. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  662. } else if (arg.length == 3) {
  663. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), c.heightLevel);
  664. }
  665. }
  666. if (playerCommand.equalsIgnoreCase("telequarantine")) {
  667. TeleportExecutor.teleport(c, new Position(2463, 4780, 0));
  668. }
  669. if (playerCommand.equals("clue")) {
  670. if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
  671. return;
  672. Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.EASY);
  673. Item item = new Item(clueScroll.get().clueId);
  674. c.getItems().addItem(item);
  675. }
  676. if (playerCommand.equals("clue2")) {
  677. if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
  678. return;
  679. Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.MEDIUM);
  680. Item item = new Item(clueScroll.get().clueId);
  681. c.getItems().addItem(item);
  682. }
  683. if (playerCommand.equals("clue3")) {
  684. if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
  685. return;
  686. Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.HARD);
  687. Item item = new Item(clueScroll.get().clueId);
  688. c.getItems().addItem(item);
  689. }
  690. if (playerCommand.equals("clue4")) {
  691. if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
  692. return;
  693. Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.ELITE);
  694. Item item = new Item(clueScroll.get().clueId);
  695. c.getItems().addItem(item);
  696. }
  697. if (playerCommand.startsWith("display")) {
  698. String name = playerCommand.split("-")[1];
  699. if (name != null) {
  700. DisplayName.add(c.playerName, name);
  701. DisplayName.save();
  702. c.sendMessage("Name Changed");
  703. }
  704. }
  705.  
  706. if (playerCommand.startsWith("unmacban")) {
  707. String[] contents = playerCommand.split("-");
  708. if (contents.length != 2) {
  709. c.sendMessage("Improper syntax; Type '::unmacban-name'.");
  710. return;
  711. }
  712. String name = contents[1];
  713. if (!QuarantineIO.contains(name)) {
  714. c.sendMessage("This player is no longer macbanned.");
  715. return;
  716. }
  717. c.sendMessage("You have unmacbanned " + name + " and any other accounts associated.");
  718. c.getQuarantine().setQuarantined(false);
  719. QuarantineIO.remove(name);
  720. QuarantineIO.write();
  721. }
  722. if (playerCommand.toLowerCase().startsWith("move")) {
  723. try {
  724. String[] commandContents = playerCommand.split("-");
  725. int positionOffset = Integer.parseInt(commandContents[2]);
  726. int x = c.absX;
  727. int y = c.absY;
  728. int height = c.heightLevel;
  729. switch (commandContents[1].toLowerCase()) {
  730. case "up":
  731. height += positionOffset;
  732. break;
  733. case "down":
  734. height -= positionOffset;
  735. break;
  736. case "north":
  737. y += positionOffset;
  738. break;
  739. case "east":
  740. x += positionOffset;
  741. break;
  742. case "south":
  743. y -= positionOffset;
  744. break;
  745. case "west":
  746. x -= positionOffset;
  747. break;
  748. }
  749. c.getPA().movePlayer(x, y, height);
  750. } catch (Exception e) {
  751. e.printStackTrace();
  752. c.sendMessage("Improper syntax, please use the following as an example: '::move up 2'.");
  753. }
  754. }
  755.  
  756. if (playerCommand.startsWith("idban")) {
  757. String contents[] = playerCommand.split("-");
  758. if (contents.length < 2)
  759. return;
  760. try {
  761. Player player = PlayerUpdating.getPlayerByName(contents[1]);
  762. if (player == null) {
  763. c.sendMessage("Player is offline");
  764. return;
  765. }
  766.  
  767. Connection.addIdentityToList(player.getIdentity());
  768. Connection.addIdentityToFile(player.getIdentity());
  769. c.sendMessage("You have identity banned " + player.playerName + " with the ip: " + player.connectedFrom);
  770. player.disconnected = true;
  771. } catch (Exception e) {
  772. e.printStackTrace();
  773. }
  774. }
  775. if (playerCommand.startsWith("ipmute")) {
  776. try {
  777. String playerToBan = playerCommand.substring(7);
  778. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  779. if (World.PLAYERS.get(i) != null) {
  780. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
  781. Connection.addIpToMuteList(World.PLAYERS.get(i).connectedFrom);
  782. c.sendMessage("You have IP Muted the user: " + World.PLAYERS.get(i).playerName);
  783. Player c2 = World.PLAYERS.get(i);
  784. c2.sendMessage("You have been muted by: " + c.playerName);
  785. c2.sendMessage(" " + c2.playerName + " Got IpMuted By " + c.playerName + ".");
  786. break;
  787. }
  788. }
  789. }
  790. } catch (Exception e) {
  791. e.printStackTrace();
  792. c.sendMessage("Player Must Be Offline.");
  793. }
  794. if (c.playerRights > 2 && c.playerRights < 6) {
  795. if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
  796. c.sendMessage("You cannot macban a staff member, this is an illegal action.");
  797. c.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
  798. return;
  799. }
  800. }
  801. }
  802.  
  803.  
  804. if (playerCommand.startsWith("xteleto")) {
  805. String name = playerCommand.substring(8);
  806. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  807. if (World.PLAYERS.get(i) != null) {
  808. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(name)) {
  809. c.getPA().movePlayer(World.PLAYERS.get(i).getX(), World.PLAYERS.get(i).getY(), World.PLAYERS.get(i).heightLevel);
  810. }
  811. }
  812. }
  813. }
  814. if (playerCommand.startsWith("xteletome")) {
  815. try {
  816. String playerToTele = playerCommand.substring(10);
  817. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  818. if (World.PLAYERS.get(i) != null) {
  819. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToTele)) {
  820. Player c2 = World.PLAYERS.get(i);
  821. c2.sendMessage("You have been teleported to " + c.playerName);
  822. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  823. break;
  824. }
  825. }
  826. }
  827. } catch (Exception e) {
  828. e.printStackTrace();
  829. c.sendMessage("Player Must Be Offline.");
  830. }
  831. }
  832.  
  833. if (playerCommand.startsWith("ipban")) {
  834. try {
  835. String playerToBan = playerCommand.substring(6);
  836. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  837. if (World.PLAYERS.get(i) != null) {
  838. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
  839. Connection.addIpToBanList(World.PLAYERS.get(i).connectedFrom);
  840. Connection.addIpToFile(World.PLAYERS.get(i).connectedFrom);
  841. c.sendMessage("You have IP banned the user: " + World.PLAYERS.get(i).playerName + " with the host: " + World.PLAYERS.get(i).connectedFrom);
  842. Player c2 = World.PLAYERS.get(i);
  843. World.PLAYERS.get(i).disconnected = true;
  844. c2.sendMessage(" " + c2.playerName + " Got IpBanned By " + c.playerName + ".");
  845. }
  846. }
  847. }
  848. } catch (Exception e) {
  849. e.printStackTrace();
  850. c.sendMessage("Player Must Be Offline.");
  851. }
  852. if (c.playerRights > 2 && c.playerRights < 6) {
  853. if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
  854. c.sendMessage("You cannot macban a staff member, this is an illegal action.");
  855. c.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
  856. return;
  857. }
  858. }
  859. }
  860.  
  861. if (playerCommand.startsWith("unipmute")) {
  862. try {
  863. String playerToBan = playerCommand.substring(9);
  864. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  865. if (World.PLAYERS.get(i) != null) {
  866. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
  867. Connection.unIPMuteUser(World.PLAYERS.get(i).connectedFrom);
  868. c.sendMessage("You have Un Ip-Muted the user: " + World.PLAYERS.get(i).playerName);
  869. break;
  870. }
  871. }
  872. }
  873. } catch (Exception e) {
  874. e.printStackTrace();
  875. c.sendMessage("Player Must Be Offline.");
  876. }
  877. }
  878.  
  879. /*
  880. * Staff Teleportation Commands - Tele, Xteleto, Xteletome, Alltome
  881. */
  882.  
  883. if (playerCommand.equalsIgnoreCase("mypos")) {
  884. c.sendMessage("X: " + c.absX + " Y: " + c.absY + " H: " + c.heightLevel);
  885. }
  886.  
  887. }
  888.  
  889. private static void managerCommands(final Player c, String playerCommand) {
  890. if (playerCommand.startsWith("reloaddrops")) {
  891. try {
  892. Misc.loadNpcDrops();
  893. PlayerUpdating.announce("<col=ff0033>[System Announcement]</col><col=255> NPC drops have been updated");
  894. } catch (Exception e) {
  895. e.printStackTrace();
  896. }
  897. }
  898.  
  899. if (playerCommand.startsWith("cannon")) {
  900. try {
  901. String[] args = playerCommand.split("-");
  902. if (args.length < 2) {
  903. c.sendMessage("Correct usage: ::rank-name-rank#");
  904. return;
  905. }
  906. String playerToStaff = args[1];
  907. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  908. if (World.PLAYERS.get(i) != null) {
  909. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToStaff)) {
  910. Player c2 = World.PLAYERS.get(i);
  911. c2.hasBoughtCannon = true;
  912. c.sendMessage("Given cannon");
  913. break;
  914. }
  915. }
  916. }
  917. } catch (Exception e) {
  918. e.printStackTrace();
  919. c.sendMessage("Player Must Be Offline.");
  920. }
  921. }
  922.  
  923. if (playerCommand.startsWith("rank12345")) {
  924. try {
  925. String[] args = playerCommand.split("-");
  926. if (args.length < 2) {
  927. c.sendMessage("Correct usage: ::rank-name-rank#");
  928. return;
  929. }
  930.  
  931. String playerToStaff = args[1];
  932. int staffRank = Integer.parseInt(args[2]);
  933. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  934. if (World.PLAYERS.get(i) != null) {
  935. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToStaff)) {
  936. Player c2 = World.PLAYERS.get(i);
  937. c2.isDonator = true;
  938. c2.playerRights = staffRank;
  939. c2.logout();
  940. break;
  941. }
  942. }
  943. }
  944.  
  945. } catch (Exception e) {
  946. e.printStackTrace();
  947. c.sendMessage("Player Must Be Offline.");
  948. }
  949. }
  950. }
  951.  
  952. private static void ownerCommands(final Player c, String playerCommand) {
  953. String s = playerCommand;
  954. if (playerCommand.startsWith("prayerinterface")) {
  955. int id = Integer.parseInt(playerCommand.split("-")[1]);
  956. c.setSidebarInterface(5, id);
  957. }
  958. if(playerCommand.startsWith("getid")) {
  959. String a[] = playerCommand.split(" ");
  960. String name = "";
  961. int results = 0;
  962. for(int i = 1; i < a.length; i++)
  963. name = name + a[i]+ " ";
  964. name = name.substring(0, name.length()-1);
  965. c.sendMessage("Searching: " + name);
  966. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  967. if (Server.itemHandler.ItemList[j] != null)
  968. if (Server.itemHandler.ItemList[j].itemName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  969. c.sendMessage("<col=255>"
  970. + Server.itemHandler.ItemList[j].itemName.replace("_", " ")
  971. + " - "
  972. + Server.itemHandler.ItemList[j].itemId);
  973. results++;
  974. }
  975. }
  976. c.sendMessage(results + " results found...");
  977. }
  978. if (playerCommand.equalsIgnoreCase("bank")) {
  979. c.getPA().openUpBank();
  980. }
  981. if (playerCommand.startsWith("restock")) {
  982. Server.shopHandler = new server.vd.content.ShopHandler();
  983. PlayerUpdating.announce("<col=ff0033>[System Announcement]</col><col=255> Shops have now been Reloaded.");
  984. }
  985.  
  986. if (playerCommand.equals("killlist")) {
  987. for (String name : c.lastKilledList) {
  988. if (name != null) {
  989. c.sendMessage("Name: " + name);
  990. }
  991. }
  992. }
  993. if (playerCommand.equals("pnpc")) {
  994. {
  995. try {
  996. int newNPC = Integer.parseInt(playerCommand.substring(5));
  997. if (newNPC <= 200000 && newNPC >= 0) {
  998. c.npcId2 = newNPC;
  999. c.isNpc = true;
  1000. c.updateRequired = true;
  1001. c.setAppearanceUpdateRequired(true);
  1002. }
  1003. else {
  1004. c.sendMessage("No such P-NPC.");
  1005. }
  1006. } catch(Exception e) {
  1007. c.sendMessage("Wrong Syntax! Use as ::pnpc #");
  1008. }
  1009. }
  1010. }
  1011.  
  1012. if (playerCommand.equals("unpc")) {
  1013. c.resetPlayerNpc();
  1014. c.updateRequired = true;
  1015. c.setAppearanceUpdateRequired(true);
  1016. }
  1017. if (playerCommand.startsWith("macban")) {
  1018. String[] contents = playerCommand.split("-");
  1019. if (contents.length != 3) {
  1020. c.sendMessage("Improper syntax; Type '::quarantine-name-severity'. Severity is either 0 or 1.");
  1021. c.sendMessage("0 ensures that the player can login but is in a secured area they cannot leave.");
  1022. c.sendMessage("1 denies the player the ability to even login.");
  1023. return;
  1024. }
  1025. String name = contents[1];
  1026. int severity;
  1027. try {
  1028. severity = Integer.parseInt(contents[2]);
  1029. if (severity < 0 || severity > 1)
  1030. throw new IllegalStateException();
  1031. } catch (NumberFormatException | IllegalStateException exception) {
  1032. c.sendMessage("Improper syntax; Type '::macban-name-severity'. Severity is either 0 or 1.");
  1033. c.sendMessage("0 ensures that the player can login but is in a secured area they cannot leave.");
  1034. c.sendMessage("1 denies the player the ability to even login.");
  1035. exception.printStackTrace();
  1036. return;
  1037. }
  1038. Player player = PlayerUpdating.getPlayerByName(name);
  1039. if (player == null) {
  1040. File character = new File("./Data/characters/" + name + ".txt");
  1041. if (!character.exists()) {
  1042. c.sendMessage("The player is not online and a character file does not exist.");
  1043. c.sendMessage("The information could not be logged into quarantine.");
  1044. return;
  1045. }
  1046. try (BufferedReader reader = new BufferedReader(new FileReader(character))) {
  1047. String line;
  1048. String characterIdentity = "";
  1049. while ((line = reader.readLine()) != null) {
  1050. if (line.startsWith("identity")) {
  1051. characterIdentity = line.substring(11, line.length());
  1052. }
  1053. }
  1054. if (characterIdentity.length() > 0 & name.length() > 0) {
  1055. QuarantineIO.add(name, characterIdentity, severity);
  1056. PlayerQuarantine.checkOnlineMatches(c, characterIdentity, severity);
  1057. QuarantineIO.write();
  1058. c.sendMessage("You have sucessfully quarantined " + name + " with the following information:");
  1059. c.sendMessage("Identity: " + characterIdentity);
  1060. return;
  1061. } else {
  1062. c.sendMessage("Unable to properly log the players information.");
  1063. c.sendMessage("The characters IP, Mac Address, Name or Identity was non-existant.");
  1064. }
  1065. reader.close();
  1066. } catch (Exception exception) {
  1067. exception.printStackTrace();
  1068. }
  1069. return;
  1070. }
  1071. if (player.playerRights > 2 && player.playerRights < 6) {
  1072. if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
  1073. c.sendMessage("You cannot macban a staff member, this is an illegal action.");
  1074. player.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
  1075. return;
  1076. }
  1077. }
  1078. c.sendMessage("You have successfully quarantined " + player.playerName + " with a severity of " + severity + ".");
  1079. player.getQuarantine().setQuarantined(true);
  1080. QuarantineIO.add(player.playerName, player.getIdentity(), severity);
  1081. PlayerQuarantine.checkOnlineMatches(c, player.getIdentity(), severity);
  1082. if (severity == 1) {
  1083. if (player.getPA().viewingOtherBank)
  1084. player.getPA().resetOtherBank();
  1085. player.logoutDelay = System.currentTimeMillis() - 60000;
  1086. player.logout();
  1087. }
  1088. QuarantineIO.write();
  1089. return;
  1090. }
  1091. if (playerCommand.startsWith("announce")) {
  1092. try {
  1093. String[] args = playerCommand.split("_");
  1094. if (args.length < 1) {
  1095. c.sendMessage("You must use this command as ::thread id(Id being a thread id integer!");
  1096. return;
  1097. }
  1098. String threadId = args[1];
  1099. PlayerUpdating.sendGlobalPushNotification("Global Announcement : " + threadId);
  1100. } catch (Exception e) {
  1101. e.printStackTrace();
  1102. }
  1103. }
  1104.  
  1105. if (playerCommand.equalsIgnoreCase("infhp")) {
  1106. c.getPA().requestUpdates();
  1107. c.playerLevel[3] = 99999;
  1108. c.getPA().refreshSkill(3);
  1109. c.gfx0(754);
  1110. c.sendMessage("You now have infinite HP.");
  1111. }
  1112. if (playerCommand.equalsIgnoreCase("infpray")) {
  1113. c.getPA().requestUpdates();
  1114. c.playerLevel[5] = 99999;
  1115. c.getPA().refreshSkill(5);
  1116. c.gfx0(800);
  1117. c.sendMessage("You now have infinite Prayer.");
  1118. }
  1119.  
  1120.  
  1121. if (playerCommand.startsWith("alltome")) {
  1122. for (int j = 0; j < World.PLAYERS.capacity(); j++) {
  1123. if (World.PLAYERS.get(j) != null) {
  1124. Player c2 = World.PLAYERS.get(j);
  1125. c2.sendMessage("Mass teleport to " + c.playerName + ".");
  1126. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  1127. break;
  1128. }
  1129. }
  1130. }
  1131. if (playerCommand.startsWith("accounttype")) {
  1132. String params[];
  1133. try {
  1134. params = playerCommand.split("-");
  1135. Player player = PlayerUpdating.getPlayerByName(params[1]);
  1136. String type = params[2];
  1137. AccountType t = Account.get(type);
  1138. if (player == null) {
  1139. c.sendMessage("The player is not online, or the name entered was incorrect.");
  1140. return;
  1141. }
  1142. if (t == null) {
  1143. c.sendMessage("The type you entered does not exist, consult a staff member.");
  1144. return;
  1145. }
  1146. player.getAccount().setType(t);
  1147. c.sendMessage("You have changed " + player.playerName + "'s account type to " + t.alias());
  1148. } catch (IndexOutOfBoundsException e) {
  1149. e.printStackTrace();
  1150. c.sendMessage("Improper syntax; '::accounttype-player-type'");
  1151. }
  1152. }
  1153. if (playerCommand.startsWith("checkinv")) {
  1154. try {
  1155. String[] args = playerCommand.split(" ", 2);
  1156. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  1157. Player o = World.PLAYERS.get(i);
  1158. if (World.PLAYERS.get(i) != null) {
  1159. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(args[1])) {
  1160. c.getPA().otherInv(c, o);
  1161. break;
  1162. }
  1163. }
  1164. }
  1165. } catch (Exception e) {
  1166. e.printStackTrace();
  1167. c.sendMessage("Player Must Be Offline.");
  1168. }
  1169. }
  1170. if (playerCommand.equals("slayer")) {
  1171. c.slaypoints += 1000;
  1172. }
  1173. if (playerCommand.equalsIgnoreCase("runes")) {
  1174. c.getItems().addItem(554, 1000);
  1175. c.getItems().addItem(555, 1000);
  1176. c.getItems().addItem(556, 1000);
  1177. c.getItems().addItem(557, 1000);
  1178. c.getItems().addItem(558, 1000);
  1179. c.getItems().addItem(559, 1000);
  1180. c.getItems().addItem(560, 1000);
  1181. c.getItems().addItem(561, 1000);
  1182. c.getItems().addItem(562, 1000);
  1183. c.getItems().addItem(563, 1000);
  1184. c.getItems().addItem(564, 1000);
  1185. c.getItems().addItem(565, 1000);
  1186. c.getItems().addItem(566, 1000);
  1187. c.getItems().addItem(9075, 1000);
  1188. }
  1189. if (playerCommand.equals("name")) {
  1190. String[] args = playerCommand.split(" ");
  1191. String n = args[1];
  1192. int amount = Integer.parseInt(args[2]);
  1193. int count = 0;
  1194.  
  1195. for (ItemList l : Server.itemHandler.ItemList) {
  1196. if (l == null || l.itemDescription.equals("Swap_this_note_at_any_bank_for_the_equivalent_item.") || l.itemDescription.equals("Swap this note at any bank for the equivalent item."))
  1197. continue;
  1198.  
  1199. if (l.itemName.replaceAll("_", " ").toLowerCase().contains(n)) {
  1200. if (c.getItems().freeBankSlots() > amount || c.getItems().isStackable(l.itemId) && c.getItems().freeSlots() > 0) {
  1201. c.getItems().addItem(new Item(l.itemId, amount));
  1202. } else {
  1203. c.getItems().addItemToBank(new Item(l.itemId, amount));
  1204. }
  1205. count++;
  1206. }
  1207. }
  1208.  
  1209. c.sendMessage(count > 0 ? "Item [" + n + "] found on " + count + " occurances!" : "Item [" + n + "] not found!");
  1210. }
  1211. if (playerCommand.equals("option")) {
  1212. c.getPA().sendFrame36(428, 0);
  1213. }
  1214. if (playerCommand.startsWith("giveitem")) {
  1215.  
  1216. try {
  1217. String[] args = playerCommand.split("-");
  1218. int newItemID = Integer.parseInt(args[1]);
  1219. int newItemAmount = Integer.parseInt(args[2]);
  1220. String otherplayer = args[3];
  1221. Player c2 = null;
  1222. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  1223. if (World.PLAYERS.get(i) != null) {
  1224. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(otherplayer)) {
  1225. c2 = World.PLAYERS.get(i);
  1226. break;
  1227. }
  1228. }
  1229. }
  1230. if (c2 == null) {
  1231. c.sendMessage("Player doesn't exist.");
  1232. return;
  1233. }
  1234. c.sendMessage("You have just given " + Item.getItemName(newItemID) + "X" + newItemAmount + " to " + c2.playerName + ".");
  1235. c2.getItems().addItemToBank(newItemID, newItemAmount);
  1236. } catch (Exception e) {
  1237. c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
  1238. }
  1239. }
  1240. if (playerCommand.startsWith("item")) {
  1241. try {
  1242. String[] args = playerCommand.split(" ");
  1243. if (args.length == 3) {
  1244. int newItemID = Integer.parseInt(args[1]);
  1245. int newItemAmount = Integer.parseInt(args[2]);
  1246. if ((newItemID <= Constants.ITEM_LIMIT) && (newItemID >= 0)) {
  1247. c.getItems().addItem(newItemID, newItemAmount);
  1248. } else {
  1249. c.sendMessage("That item ID does not exist.");
  1250. }
  1251. } else {
  1252. c.sendMessage("Correct usage: [::item 995 1]");
  1253. }
  1254. } catch (Exception e) {
  1255. e.printStackTrace();
  1256.  
  1257. }
  1258. }
  1259. if (playerCommand.equals("master")) {
  1260. for (int i = 0; i < c.playerLevel.length; i++) {
  1261. c.playerLevel[i] = 99;
  1262. c.playerXP[i] = c.getPA().getXPForLevel(99);
  1263. c.getPA().refreshSkill(i);
  1264. }
  1265. }
  1266. if (playerCommand.equals("saveall")) {
  1267. c.sendMessage("Save all initiated.");
  1268. for (Player player : World.PLAYERS) {
  1269. if (player != null) {
  1270. PlayerSave.saveGame(player);
  1271. }
  1272. }
  1273. }
  1274. if (playerCommand.startsWith("setlevel")) {
  1275. try {
  1276. String[] args = playerCommand.split(" ");
  1277. int skill = Integer.parseInt(args[1]);
  1278. int level = Integer.parseInt(args[2]);
  1279. c.playerLevel[skill] = level;
  1280. c.playerXP[skill] = c.getPA().getXPForLevel(level);
  1281. c.getPA().refreshSkill(skill);
  1282. } catch (Exception e) {
  1283. e.printStackTrace();
  1284. c.sendMessage("::setlevel skill level.");
  1285. }
  1286.  
  1287. }
  1288. if (playerCommand.startsWith("donator")) {
  1289. try {
  1290. String[] args = playerCommand.split("-");
  1291. if (args.length < 2) {
  1292. c.sendMessage("Correct usage: ::rank-name-rank#");
  1293. return;
  1294. }
  1295.  
  1296. String playerToStaff = args[1];
  1297. int staffRank = Integer.parseInt(args[2]);
  1298. for (int i = 0; i < World.PLAYERS.capacity(); i++) {
  1299. if (World.PLAYERS.get(i) != null) {
  1300. if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToStaff)) {
  1301. Player c2 = World.PLAYERS.get(i);
  1302. c2.isDonator = true;
  1303. c2.donatorRights = staffRank;
  1304. c2.logout();
  1305. break;
  1306. }
  1307. }
  1308. }
  1309.  
  1310. } catch (Exception e) {
  1311. e.printStackTrace();
  1312. c.sendMessage("Player Must Be Offline.");
  1313. }
  1314. }
  1315.  
  1316. if (playerCommand.equalsIgnoreCase("empty")) {
  1317. if (c.inWild() && c.playerRights != 5)
  1318. return;
  1319. c.getItems().addItem(5733, 1);
  1320. for (int i = 0; i < c.playerItems.length; i++) {
  1321. c.getItems().deleteItem(c.playerItems[i] - 1, c.getItems().getItemSlot(c.playerItems[i] - 1), c.playerItemsN[i]);
  1322. }
  1323. }
  1324. if (playerCommand.toLowerCase().startsWith("checkbank")) {
  1325. try {
  1326. String[] args = playerCommand.split("-");
  1327. Player player = null;
  1328. for (Player p : World.PLAYERS)
  1329. if (p != null && p.playerName.equalsIgnoreCase(args[1]))
  1330. player = p;
  1331. if (player == null) {
  1332. c.sendMessage("The player [" + args[1] + "] cannot be found.");
  1333. return;
  1334. }
  1335. c.getPA().openOtherBank(player);
  1336. } catch (Exception e) {
  1337. e.printStackTrace();
  1338. c.sendMessage("Player Must Be Offline.");
  1339. }
  1340. }
  1341. if (playerCommand.startsWith("interface")) {
  1342. try {
  1343. int id = Integer.parseInt(playerCommand.substring(10));
  1344. c.getPA().showInterface(id);
  1345. } catch (Exception e) {
  1346. e.printStackTrace();
  1347. }
  1348.  
  1349. }
  1350. if (playerCommand.startsWith("resettask")) {
  1351. try {
  1352. final String[] args = playerCommand.split("-");
  1353. final String otherplayer = args[1];
  1354. for (final Player player : World.PLAYERS) {
  1355. if (player != null) {
  1356. if (player.playerName.equalsIgnoreCase(otherplayer)) {
  1357. final Player c2 = player;
  1358. c2.taskAmount = 0;
  1359. break;
  1360. }
  1361. }
  1362. }
  1363. } catch (final Exception e) {
  1364. e.printStackTrace();
  1365. c.sendMessage("Wrong syntax! ::resettask-playername");
  1366. }
  1367. }
  1368. if (playerCommand.startsWith("givepoints")) {
  1369. try {
  1370. final String[] args = playerCommand.split("-");
  1371. final String otherplayer = args[1];
  1372. final int point = Integer.parseInt(args[2]);
  1373. for (final Player player : World.PLAYERS) {
  1374. if (player != null) {
  1375. if (player.playerName.equalsIgnoreCase("n")) {
  1376. final Player c2 = player;
  1377. c2.DonorPoints += point;
  1378. c.sendMessage("<col=255>You have given " + otherplayer + ", " + point + " Donator points.</col>");
  1379. c2.sendMessage("<col=255>You have been given " + point + " Donator points by " + c.playerName + ".</col>");
  1380. break;
  1381. }
  1382. }
  1383. }
  1384. } catch (final Exception e) {
  1385. e.printStackTrace();
  1386. c.sendMessage("Wrong syntax! ::givepoints-name-amount");
  1387. }
  1388. }
  1389. if (playerCommand.startsWith("givemoney")) {
  1390. try {
  1391. final String[] args = playerCommand.split("-");
  1392. final String otherplayer = args[1];
  1393. final int point = Integer.parseInt(args[2]);
  1394. for (final Player player : World.PLAYERS) {
  1395. if (player != null) {
  1396. if (player.playerName.equalsIgnoreCase("n")) {
  1397. final Player c2 = player;
  1398. c2.amountDonated += point;
  1399. c.sendMessage("<col=255>You have given " + otherplayer + ", " + point + " Donated money.</col>");
  1400. c2.sendMessage("<col=255>$" + point + " Your donated amount has been credited. " + c.playerName + " Thank you!.</col>");
  1401. break;
  1402. }
  1403. }
  1404. }
  1405. } catch (final Exception e) {
  1406. e.printStackTrace();
  1407. c.sendMessage("Wrong syntax! ::givemoney-name-amount");
  1408. }
  1409. }
  1410.  
  1411. if (playerCommand.startsWith("spec")) {
  1412. c.specAmount = 500.0;
  1413. }
  1414. if (playerCommand.startsWith("object")) {
  1415. String[] args = playerCommand.split(" ");
  1416. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  1417. }
  1418. if (playerCommand.startsWith("anim")) {
  1419. String[] args = playerCommand.split(" ");
  1420. c.startAnimation(Integer.parseInt(args[1]));
  1421. c.getPA().requestUpdates();
  1422. }
  1423.  
  1424. if (playerCommand.startsWith("gfx")) {
  1425. String[] args = playerCommand.split(" ");
  1426. c.gfx0(Integer.parseInt(args[1]));
  1427. }
  1428. if (playerCommand.equalsIgnoreCase("bank")) {
  1429. if (c.getPA().viewingOtherBank) {
  1430. c.sendMessage("You are no longer viewing another players bank.");
  1431. c.getPA().resetOtherBank();// add that to each ytou're fast
  1432. }
  1433. c.getPA().openUpBank();
  1434. }
  1435. if (playerCommand.startsWith("den")) {
  1436. TeleportExecutor.teleport(c, new Position(2590, 3089, 2));
  1437. }
  1438.  
  1439. if (playerCommand.startsWith("kc")) {
  1440. c.killCount = +10;
  1441. }
  1442. if (playerCommand.equals("afk")) {
  1443. if(c.inWild()) {
  1444. c.sendMessage("Er, it's not to smart to go AFK in the Wilderness...");
  1445. return;
  1446. }
  1447. if(c.playerRights == 1) {
  1448. c.startAnimation(4113);
  1449. c.forcedText = "Bitch stfu, I'm AFK!";
  1450. c.forcedChatUpdateRequired = true;
  1451. c.updateRequired = true;
  1452. c.sendMessage("When you return type ::back.");
  1453. }
  1454. if(c.playerRights == 2 || c.playerRights == 5 || c.playerRights == 3) {
  1455. c.startAnimation(4117);
  1456. c.forcedText = "Bitch stfu, I'm AFK!";
  1457. c.forcedChatUpdateRequired = true;
  1458. c.updateRequired = true;
  1459. c.sendMessage("When you return type ::back.");
  1460. }
  1461. if(c.playerRights == 0) {
  1462. c.startAnimation(4115);
  1463. c.forcedText = "Bitch stfu, I'm AFK!";
  1464. c.forcedChatUpdateRequired = true;
  1465. c.updateRequired = true;
  1466. c.sendMessage("When you return type ::back.");
  1467. }
  1468. if(c.playerRights == 4) {
  1469. c.startAnimation(4114);
  1470. c.forcedText = "Bitch stfu, I'm AFK!";
  1471. c.forcedChatUpdateRequired = true;
  1472. c.updateRequired = true;
  1473. c.sendMessage("When you return type ::back, you cannot move while AFK is on.");
  1474. }
  1475. if(c.playerRights == 6 || c.playerRights == 7 || c.playerRights == 8) {
  1476. c.startAnimation(4116);
  1477. c.forcedText = "Bitch stfu, I'm AFK!";
  1478. c.forcedChatUpdateRequired = true;
  1479. c.updateRequired = true;
  1480. c.sendMessage("When you return type ::back.");
  1481. }
  1482. if(c.playerRights == 9 || c.playerRights == 10 || c.playerRights == 11) {
  1483. c.startAnimation(4116);
  1484. c.forcedText = "Bitch stfu, I'm AFK!";
  1485. c.forcedChatUpdateRequired = true;
  1486. c.updateRequired = true;
  1487. c.sendMessage("When you return type ::back.");
  1488. }
  1489. }
  1490. if (playerCommand.equals("back")) {
  1491. c.startAnimation(14);
  1492. c.updateRequired = true;
  1493. c.setAppearanceUpdateRequired(true);
  1494.  
  1495. c.forcedChat("I'm Back!");
  1496. c.updateRequired = true;
  1497. }
  1498. if (playerCommand.startsWith("update")) {
  1499. String[] args = playerCommand.split(" ");
  1500. int a = Integer.parseInt(args[1]);
  1501. World.updateSeconds = a;
  1502. World.updateAnnounced = false;
  1503. World.updateRunning = true;
  1504. World.updateStartTime = System.currentTimeMillis();
  1505. }
  1506. if (playerCommand.equals("dz") && !c.inWild()) {
  1507. TeleportExecutor.teleport(c, new Position(2337, 9799, 0));
  1508. }
  1509.  
  1510.  
  1511. if (playerCommand.startsWith("npc")) {
  1512. try {
  1513. int newNPC = Integer.parseInt(playerCommand.substring(4));
  1514. if (newNPC > 0) {
  1515.  
  1516. NPCHandler.spawnNpc(c, newNPC, c.getAbsX() + 1, c.getAbsY(), 0, 0, 250, 7, 70, 70, false, false);
  1517. c.sendMessage("You spawn a Npc.");
  1518. c.amountDonated += 28;
  1519. c.sendMessage("You have now spawned: " + newNPC);
  1520. } else {
  1521. c.sendMessage("No such NPC.");
  1522. }
  1523. } catch (Exception ignored) {
  1524. ignored.printStackTrace();
  1525.  
  1526. }
  1527. }
  1528.  
  1529. }
  1530.  
  1531. private static void sendMessage(String string) {
  1532. // TODO Auto-generated method stub
  1533.  
  1534. }
  1535. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement