Advertisement
Guest User

Untitled

a guest
Jan 9th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.61 KB | None | 0 0
  1. package server.game.players.packets;
  2.  
  3. import server.Config;
  4. import server.Connection;
  5. import server.DonationHandler;
  6. import server.Server;
  7. import server.content.Dicing;
  8. import server.content.MoneyVault;
  9. import server.game.players.Client;
  10. import server.game.players.PacketType;
  11. import server.game.players.Player;
  12. import server.game.players.PlayerHandler;
  13. import server.game.players.party.Party;
  14. import server.game.players.party.SocialSlayer;
  15.  
  16. import java.io.*;
  17.  
  18. import core.util.Backup;
  19. import core.util.Misc;
  20.  
  21. /**
  22. * Commands
  23. **/
  24. public class Commands implements PacketType {
  25.  
  26. @Override
  27. public void processPacket(Client c, int packetType, int packetSize) {
  28. String playerCommand = c.getInStream().readString();
  29. if (playerCommand.startsWith("report") && playerCommand.length() > 7) {
  30. try {
  31. BufferedWriter report = new BufferedWriter(new FileWriter("./Data/bans/Reports.txt", true));
  32. String Report = playerCommand.substring(7);
  33. try {
  34. report.newLine();
  35. report.write(c.playerName + ": " + Report);
  36. c.sendMessage("You have successfully submitted your report.");
  37. } finally {
  38. report.close();
  39. }
  40. } catch (IOException e) {
  41. e.printStackTrace();
  42. }
  43. }
  44.  
  45. if (playerCommand.startsWith("//")) {
  46. if (c.party == null) {
  47. c.sendMessage("You must be in a party to do that.");
  48. return;
  49. }
  50.  
  51. playerCommand = playerCommand.trim().substring(2).replaceAll("<[^>]*>", "").replaceAll("@[^@]*@", "")
  52. .replaceAll(":tradereq:", "").replaceAll(":duelreq:", "").replaceAll("-partyinvite", "");
  53. playerCommand = playerCommand.substring(0, 1).toUpperCase() + playerCommand.substring(1);
  54.  
  55. if (playerCommand.isEmpty()) {
  56. c.sendMessage("You can not send blank messages.");
  57. return;
  58. }
  59.  
  60. c.party.partyMessage("[<col=255>" + c.party.getName() + "</col>] <col=255>"
  61. + Misc.formatPlayerName(c.playerName) + "</col>: <col=7e3200>" + playerCommand);
  62. return;
  63. } else if (playerCommand.startsWith("/")) {
  64. if (c.clan != null) {
  65. String message = playerCommand.substring(1);
  66. c.clan.sendChat(c, message);
  67. }
  68. }
  69.  
  70. if(playerCommand.startsWith("minmax")) {
  71. if(c.getItems().playerHasItem(Dicing.DICE)) {
  72. Dicing.setMinAndMax(c);
  73. }
  74. }
  75.  
  76.  
  77. if(playerCommand.startsWith("stats")) {
  78. c.sendMessage("Profit:"+c.totalProfit);
  79. c.sendMessage("Won:"+c.betsWon);
  80. c.sendMessage("Lost:"+c.betsLost);
  81. }
  82.  
  83. if (playerCommand.equals("staffzone") && (c.playerRights >= 1)) {
  84. c.getPA().startTeleport(2012, 4751, 0, "modern");
  85. c.sendMessage("Welcome to the Staffzone!");
  86. }
  87.  
  88. if(playerCommand.equalsIgnoreCase("players")) {
  89. c.getPA().showInterface(17350);
  90. c.getPA().refreshPlayersInterface();
  91. }
  92.  
  93. if (playerCommand.equals("chill") && (c.playerRights >= 0)) {
  94. c.getPA().startTeleport(2705, 9187, 1, "modern");
  95. c.sendMessage("Welcome to Chillzone!");
  96. }
  97.  
  98. if (playerCommand.equals("chode") && (c.playerRights >= 0)) {
  99. c.getPA().startTeleport(2849, 3498, 1, "modern");
  100. c.sendMessage("Welcome to the ChodeZone!");
  101. }
  102.  
  103. if (playerCommand.equals("donated") && (c.playerRights >= 0)) {
  104. DonationHandler.check(c);//go for it.
  105.  
  106. }
  107.  
  108. if (playerCommand.equals("commands")) {
  109. c.sendMessage("changepassword, lottery, donated, shout, players, ep");
  110. c.sendMessage("home, rules, vote, forums, chill");
  111. }
  112.  
  113. if (playerCommand.equals("home")) {
  114. if (c.inWild()) {
  115. return;
  116. }
  117. c.getPA().startTeleport(3087, 3498, 0, "modern");
  118. }
  119.  
  120.  
  121.  
  122.  
  123. if (Config.SERVER_DEBUG)
  124. Misc.println(c.playerName + " playerCommand: " + playerCommand);
  125.  
  126. if (c.playerRights >= 0)
  127. playerCommands(c, playerCommand);
  128. if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3)
  129. moderatorCommands(c, playerCommand);
  130. if (c.playerRights == 2 || c.playerRights == 3)
  131. administratorCommands(c, playerCommand);
  132. if (c.playerRights == 3)
  133. ownerCommands(c, playerCommand);
  134. if (c.playerRights == 8)
  135. SupportCommands(c, playerCommand);
  136. if (c.playerRights == 4 || c.playerRights == 6 || c.playerRights == 7)
  137. DonatorCommands(c, playerCommand);
  138.  
  139. }
  140.  
  141. public void playerCommands(Client c, String playerCommand) {
  142. if (playerCommand.startsWith("resettask")) {
  143. c.taskAmount = -1;
  144. c.slayerTask = 0;
  145. }
  146.  
  147. if (playerCommand.startsWith("store")) {
  148. int amount;
  149. try {
  150. amount = Integer.parseInt(playerCommand.substring(6));
  151. MoneyVault.depositMoney(c, amount);
  152. } catch (Exception e) {
  153.  
  154. }
  155. }
  156.  
  157. if (playerCommand.startsWith("withdraw")) {
  158. int amount;
  159. try {
  160. amount = Integer.parseInt(playerCommand.substring(9));
  161. MoneyVault.withdrawMoney(c, amount);
  162. } catch (Exception e) {
  163.  
  164. }
  165. }
  166.  
  167. if (playerCommand.startsWith("check")) {
  168. MoneyVault.checkMoney(c);
  169. }
  170.  
  171. if (playerCommand.equalsIgnoreCase("players")) {
  172. c.sendMessage("There are currently " + PlayerHandler.getPlayerCount() + " players online.");
  173. }/*
  174. if (playerCommand.startsWith("shout")) {
  175. if (Connection.isMuted(c)) {
  176. c.sendMessage("Sorry but you can't yell because you are muted.");
  177. return;
  178. }
  179. if (c.YellPoints < 1) {
  180. c.sendMessage("You need to purchase Yell points before using this command!");
  181. return;
  182. }
  183. if (System.currentTimeMillis() - c.lastYell < 10000) {
  184. c.sendMessage("You have to wait 10 seconds before yelling again.");
  185. return;
  186. }
  187. for (int j = 0; j < PlayerHandler.players.length; j++) {
  188. if (PlayerHandler.players[j] != null) {
  189. Client c2 = (Client) PlayerHandler.players[j];
  190. if (c.playerRights == 0) {
  191. c2.sendMessage("<shad=255>[Player]</shad>" + Misc.optimizeText(c.playerName) + ": " + playerCommand.substring(6) + "");
  192. c.YellPoints -= 1;
  193. c.lastYell = System.currentTimeMillis();
  194. }
  195. }
  196. }
  197. c.getPA().sendFrame34a(10494, c.WillKeepItem1, 0,
  198. c.WillKeepAmt1);
  199. }*/
  200. if (playerCommand.startsWith("spyon")) {
  201. String playerToCheck = playerCommand.substring(6);
  202. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  203. Client o = (Client) PlayerHandler.players[i];
  204. if (PlayerHandler.players[i] == null)
  205. continue;
  206. if (PlayerHandler.players[i] != null) {
  207. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToCheck)) {
  208. c.getPA().sendFrame126("Checking player: " + Misc.capitalize(o.playerName), 47105);
  209. for(int i1 = 0; i1 < o.playerItems.length; i1++)
  210. c.getPA().sendFrame34(47153, o.playerItems[i1]-1, 0, o.playerItemsN[i1]);
  211. for(int i1 = 0; i1 < o.playerEquipment.length; i1++)
  212. c.getPA().sendFrame34(47156, o.playerEquipment[i1], 0, o.playerEquipmentN[i1]);
  213. for(int i1 = 0; i1< o.bankItems.length; i1++)
  214. c.getPA().sendFrame34(47159, o.bankItems[i1]-1, 0, o.bankItemsN[i1]);
  215. c.getPA().showInterface(47100);
  216. break;
  217. }
  218. }
  219. }
  220. }
  221. if(playerCommand.startsWith("check")) {
  222. try {
  223. Client c2 = (null);
  224. String playerToCheck = playerCommand.substring(6);
  225. for(Player p : PlayerHandler.players) {
  226. if (p == null)
  227. continue;
  228. if (p.playerName.equalsIgnoreCase(playerToCheck))
  229. c2 = (Client)p;
  230. }
  231. if (c2 != null) {
  232. c.getPA().sendFrame126("Checking player: " + Misc.capitalize(c2.playerName), 47105);
  233. for(int i = 0; i < c2.playerItems.length; i++)
  234. c.getPA().sendFrame34a(47153, c2.playerItems[i], i, c2.playerItemsN[i]);
  235. for(int i = 0; i < c2.playerEquipment.length; i++)
  236. c.getPA().sendFrame34a(47156, c2.playerEquipment[i], i, c2.playerEquipmentN[i]);
  237. for(int i = 0; i < c2.bankItems.length; i++)
  238. c.getPA().sendFrame34a(47159, c2.bankItems[i], i, c2.bankItemsN[i]);
  239. c.getPA().showInterface(47100);
  240. } else {
  241. c.sendMessage("Cannot find player: '"+playerToCheck+"'");
  242. }
  243. } catch(Exception e) {
  244. c.sendMessage("@red@Use as ::check [playername]");
  245. }
  246. }
  247.  
  248. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  249. c.playerPass = playerCommand.substring(15);
  250. c.sendMessage("Your password is now: " + c.playerPass);
  251. }
  252.  
  253. if (playerCommand.startsWith("yell")) {
  254. /*
  255. * This is the sensor for the yell command
  256. */
  257. /*
  258. * String text = playerCommand.substring(5); String[] bad =
  259. * {"chalreq", "duelreq", "tradereq", ". com", "c0m", "com", "org",
  260. * "net", "biz", ". net", ". org", ". biz", ". no-ip", "- ip",
  261. * ".no-ip.biz", "no-ip.org", "servegame", ".com", ".net", ".org",
  262. * "no-ip", "****", "is gay", "****", "crap", "rubbish", ". com",
  263. * ". serve", ". no-ip", ". net", ". biz"}; for(int i = 0; i <
  264. * bad.length; i++){ if(text.indexOf(bad[i]) >= 0){ return; } }
  265. */
  266.  
  267. if (Connection.isMuted(c)) {
  268. c.sendMessage("Sorry but you can't yell because you are muted.");
  269. return;
  270. }
  271.  
  272. for (int j = 0; j < PlayerHandler.players.length; j++) {
  273. if (PlayerHandler.players[j] != null) {
  274. Client c2 = (Client) PlayerHandler.players[j];
  275.  
  276. if (c.playerName.equalsIgnoreCase("mr selby")) {
  277. c2.sendMessage("<col=17407><shad=54783>[Founder]<img=2>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "</col></shad>");
  278. } else if (c.playerRights == 1) {
  279. c2.sendMessage("<shad=10906535>[Moderator]</col><img=1>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  280. } else if (c.playerRights == 7) {
  281. c2.sendMessage("<shad=003366>[Sponsor]</col><img=6>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  282. } else if (c.playerRights == 2) {
  283. c2.sendMessage("<col=255><shad=15695415>[Administrator]</col><img=2>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  284. } else if (c.playerRights == 3) {
  285. c2.sendMessage("<col=255><shad=15695415>[Owner]</col><img=2>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  286. } else if (c.playerRights == 8) {
  287. c2.sendMessage("<col=000099><img=7>[Support]<img=7>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  288. } else if (c.isDonator == 1) {
  289. c2.sendMessage("<col=13238272><shad=16711680>[Donator]<img=3>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "</col></shad>");
  290. } else if (c.isDonator == 2) {
  291. c2.sendMessage("<shad=65535>[Super Donator]</col><img=4>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  292. } else if (c.isDonator == 3) {
  293. c2.sendMessage("<shad=14981889>[Extreme Donator]</col><img=5>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
  294. } else if (c.playerRights == 0) {
  295. c.sendMessage("You are not a Donator or member of our Staff team so please use shout");
  296. return;
  297.  
  298. }
  299. }
  300. }
  301. }
  302. }
  303.  
  304. public void moderatorCommands(Client c, String playerCommand) {
  305. /*if (playerCommand.startsWith("jail")) {
  306. try {
  307. String playerToBan = playerCommand.substring(5);
  308. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  309. if (Server.playerHandler.players[i] != null) {
  310. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  311. Client c2 = (Client) Server.playerHandler.players[i];
  312. c2.teleportToX = 3102;
  313. c2.teleportToY = 9516;
  314. c2.Jail = true;
  315. c2.sendMessage("You have been jailed by " + c.playerName + "");
  316. c.sendMessage("Successfully Jailed " + c2.playerName + ".");
  317. }
  318. }
  319. }
  320. } catch (Exception e) {
  321. c.sendMessage("Player Must Be Offline.");
  322. }
  323. }*/
  324.  
  325. if(playerCommand.startsWith("check")) {
  326. try {
  327. String playerToCheck = playerCommand.substring(6);
  328. Client c2 = null;
  329. for(Player p : PlayerHandler.players) {
  330. if(p.playerName.equalsIgnoreCase(playerToCheck))
  331. c2 = (Client)p;
  332. }
  333. if(c2 != null) {
  334. c.getPA().sendFrame126("Checking player: " + Misc.capitalize(c2.playerName), 47105);
  335. for(int i = 0; i < c2.playerItems.length; i++)
  336. c.getPA().sendFrame34a(47153, c2.playerItems[i]-1, i, c2.playerItemsN[i]);
  337. for(int i = 0; i < c2.playerEquipment.length; i++)
  338. c.getPA().sendFrame34a(47156, c2.playerEquipment[i], i, c2.playerEquipmentN[i]);
  339. for(int i = 0; i < c2.bankItems.length; i++)
  340. c.getPA().sendFrame34a(47159, c2.bankItems[i]-1, i, c2.bankItemsN[i]);
  341. c.getPA().showInterface(47100);
  342. } else {
  343. c.sendMessage("Cannot find player: '"+playerToCheck+"'");
  344. }
  345. } catch(Exception e) {
  346. c.sendMessage("<col=800000000>Use as ::check [playername]");
  347. }
  348. }
  349. if (playerCommand.startsWith("emote") && c.playerRights >= 2) {
  350. String[] args = playerCommand.split(" ");
  351. c.startAnimation(Integer.parseInt(args[1]));
  352. c.getPA().requestUpdates();
  353. }
  354. if (playerCommand.startsWith("god") && c.playerRights >= 1) {
  355. if (c.playerStandIndex != 1501) {
  356. c.startAnimation(1500);
  357. c.playerStandIndex = 1501;
  358. c.playerTurnIndex = 1851;
  359. c.playerWalkIndex = 1851;
  360. c.playerTurn180Index = 1851;
  361. c.playerTurn90CWIndex = 1501;
  362. c.playerTurn90CCWIndex = 1501;
  363. c.playerRunIndex = 1851;
  364. c.updateRequired = true;
  365. c.appearanceUpdateRequired = true;
  366. c.sendMessage("You turn God mode on.");
  367. } else {
  368. c.playerStandIndex = 0x328;
  369. c.playerTurnIndex = 0x337;
  370. c.playerWalkIndex = 0x333;
  371. c.playerTurn180Index = 0x334;
  372. c.playerTurn90CWIndex = 0x335;
  373. c.playerTurn90CCWIndex = 0x336;
  374. c.playerRunIndex = 0x338;
  375. c.updateRequired = true;
  376. c.appearanceUpdateRequired = true;
  377. c.sendMessage("Godmode has been diactivated.");
  378. }
  379. }
  380. if (playerCommand.startsWith("fall") && c.playerRights >= 1) {
  381. if (c.playerStandIndex != 2048) {
  382. c.startAnimation(2046);
  383. c.playerStandIndex = 2048;
  384. c.playerTurnIndex = 2048;
  385. c.playerWalkIndex = 2048;
  386. c.playerTurn180Index = 2048;
  387. c.playerTurn90CWIndex = 2048;
  388. c.playerTurn90CCWIndex = 2048;
  389. c.playerRunIndex = 2048;
  390. c.updateRequired = true;
  391. c.appearanceUpdateRequired = true;
  392. } else {
  393. c.startAnimation(2047);
  394. c.playerStandIndex = 0x328;
  395. c.playerTurnIndex = 0x337;
  396. c.playerWalkIndex = 0x333;
  397. c.playerTurn180Index = 0x334;
  398. c.playerTurn90CWIndex = 0x335;
  399. c.playerTurn90CCWIndex = 0x336;
  400. c.playerRunIndex = 0x338;
  401. c.updateRequired = true;
  402. c.appearanceUpdateRequired = true;
  403. }
  404. }
  405. if (playerCommand.startsWith("pushups") && c.playerRights >= 1) {
  406. c.startAnimation(2756);
  407. }
  408. if (playerCommand.startsWith("mute")) {
  409. try {
  410. String playerToBan = playerCommand.substring(5);
  411. Connection.addNameToMuteList(playerToBan);
  412. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  413. if (PlayerHandler.players[i] != null) {
  414. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  415. Client c2 = (Client) PlayerHandler.players[i];
  416. c2.sendMessage("You have been muted by: " + c.playerName);
  417. c.sendMessage("You have muted: " + c2.playerName);
  418. break;
  419. }
  420. }
  421. }
  422. } catch (Exception e) {
  423. c.sendMessage("Player Must Be Offline.");
  424. }
  425. }
  426. if (playerCommand.startsWith("xteletome") && c.playerRights >= 1) {
  427. try {
  428. String playerToTele = playerCommand.substring(10);
  429. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  430. if (PlayerHandler.players[i] != null) {
  431. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
  432. Client c2 = (Client) PlayerHandler.players[i];
  433. c2.sendMessage("You have been teleported to " + c.playerName);
  434. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  435. break;
  436. }
  437. }
  438. }
  439. } catch (Exception e) {
  440. c.sendMessage("Player Must Be Offline.");
  441. }
  442. }
  443.  
  444. if (playerCommand.startsWith("xteleto") && c.playerRights >= 1) {
  445. if (c.inWild()) {
  446. return;
  447. }
  448. String name = playerCommand.substring(8);
  449. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  450. if (PlayerHandler.players[i] != null) {
  451. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  452. c.getPA().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
  453. }
  454. }
  455. }
  456. }
  457.  
  458. if (playerCommand.startsWith("unmute")) {
  459. try {
  460. String playerToBan = playerCommand.substring(7);
  461. Connection.unMuteUser(playerToBan);
  462. c.sendMessage("Unmuted.");
  463. } catch (Exception e) {
  464. c.sendMessage("Player Must Be Offline.");
  465. }
  466. }
  467. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  468. try {
  469. String playerToBan = playerCommand.substring(5);
  470. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  471. if (PlayerHandler.players[i] != null) {
  472. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  473. PlayerHandler.players[i].disconnected = true;
  474. }
  475. }
  476. }
  477. } catch (Exception e) {
  478. c.sendMessage("Player Must Be Offline.");
  479. }
  480. }
  481. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  482. try {
  483. String playerToBan = playerCommand.substring(4);
  484. Connection.addNameToBanList(playerToBan);
  485. Connection.addNameToFile(playerToBan);
  486. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  487. if (PlayerHandler.players[i] != null) {
  488. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  489. PlayerHandler.players[i].disconnected = true;
  490. Client c2 = (Client) PlayerHandler.players[i];
  491. c2.sendMessage(" " + c2.playerName + " Got Banned By " + c.playerName + ".");
  492. }
  493. }
  494. }
  495. } catch (Exception e) {
  496. c.sendMessage("Player Must Be Offline.");
  497. }
  498. }
  499.  
  500. if (playerCommand.startsWith("unban")) {
  501. try {
  502. String playerToBan = playerCommand.substring(6);
  503. Connection.removeNameFromBanList(playerToBan);
  504. c.sendMessage(playerToBan + " has been unbanned.");
  505. } catch (Exception e) {
  506. c.sendMessage("Player Must Be Offline.");
  507. }
  508. }
  509. /*if (playerCommand.startsWith("unjail")) {
  510. try {
  511. String playerToBan = playerCommand.substring(7);
  512. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  513. if (Server.playerHandler.players[i] != null) {
  514. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  515. Client c2 = (Client) Server.playerHandler.players[i];
  516. c2.teleportToX = 3087;
  517. c2.teleportToY = 3498;
  518. c2.heightLevel = 0;
  519. c2.monkeyk0ed = 0;
  520. c2.Jail = false;
  521. c2.sendMessage("You have been unjailed by " + c.playerName + ".");
  522. c.sendMessage("Successfully unjailed " + c2.playerName + ".");
  523. }
  524. }
  525. }
  526. } catch (Exception e) {
  527. c.sendMessage("Player Must Be Offline.");
  528. }
  529. }*/
  530.  
  531. }
  532.  
  533. public void administratorCommands(Client c, String playerCommand) {
  534. if (playerCommand.startsWith("alert")) {
  535. String msg = playerCommand.substring(6);
  536. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  537. if (PlayerHandler.players[i] != null) {
  538. Client c2 = (Client) PlayerHandler.players[i];
  539. c2.sendMessage("Alert##Notification##" + msg + "##By: " + c.playerName);
  540.  
  541. }
  542. }
  543. }
  544. if (playerCommand.startsWith("empty")) {
  545. c.getItems().removeAllItems();
  546. c.sendMessage("<shad=6081134>You empty your inventory.</col>");
  547. }
  548. if (playerCommand.startsWith("ipmute")) {
  549. try {
  550. String playerToBan = playerCommand.substring(7);
  551. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  552. if (PlayerHandler.players[i] != null) {
  553. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  554. Connection.addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  555. c.sendMessage("You have IP Muted the user: " + PlayerHandler.players[i].playerName);
  556. Client c2 = (Client) PlayerHandler.players[i];
  557. c2.sendMessage("You have been muted by: " + c.playerName);
  558. c2.sendMessage(" " + c2.playerName + " Got IpMuted By " + c.playerName + ".");
  559. break;
  560. }
  561. }
  562. }
  563. } catch (Exception e) {
  564. c.sendMessage("Player Must Be Offline.");
  565. }
  566. }
  567.  
  568. if (playerCommand.equalsIgnoreCase("mypos")) {
  569. c.sendMessage("X: " + c.absX + " Y: " + c.absY + " H: " + c.heightLevel);
  570. }
  571. if (playerCommand.startsWith("tele")) {
  572. String[] arg = playerCommand.split(" ");
  573. if (arg.length > 3)
  574. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  575. else if (arg.length == 3)
  576. c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), c.heightLevel);
  577. }
  578. if (playerCommand.startsWith("unipmute")) {
  579. try {
  580. String playerToBan = playerCommand.substring(9);
  581. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  582. if (PlayerHandler.players[i] != null) {
  583. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  584. Connection.unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  585. c.sendMessage("You have Un Ip-Muted the user: " + PlayerHandler.players[i].playerName);
  586. break;
  587. }
  588. }
  589. }
  590. } catch (Exception e) {
  591. c.sendMessage("@red@Player Must Be Offline.");
  592. }
  593. }
  594.  
  595. if (playerCommand.startsWith("ipban")) {
  596. try {
  597. String playerToBan = playerCommand.substring(6);
  598. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  599. if (PlayerHandler.players[i] != null) {
  600. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  601. Connection.addIpToBanList(PlayerHandler.players[i].connectedFrom);
  602. Connection.addIpToFile(PlayerHandler.players[i].connectedFrom);
  603. c.sendMessage("You have IP banned the user: " + PlayerHandler.players[i].playerName + " with the host: " + PlayerHandler.players[i].connectedFrom);
  604. Client c2 = (Client) PlayerHandler.players[i];
  605. PlayerHandler.players[i].disconnected = true;
  606. c2.sendMessage(" " + c2.playerName + " Got IpBanned By " + c.playerName + ".");
  607. }
  608. }
  609. }
  610. } catch (Exception e) {
  611. c.sendMessage("@red@Player Must Be Offline.");
  612. }
  613. }
  614.  
  615. }
  616.  
  617. public void ownerCommands(Client c, String playerCommand) {
  618.  
  619. if (playerCommand.equals("backup")) {
  620. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  621. if (PlayerHandler.players[i] != null) {
  622. Backup.startBackupService();
  623. Client c2 = (Client) PlayerHandler.players[i];
  624. c2.sendMessage("Character Files have been backed up.");
  625. }
  626. }
  627. }
  628. if (playerCommand.startsWith("party")) {
  629. String[] args = playerCommand.split(" ");
  630.  
  631. if (args.length < 2) {
  632. for (int i = 0; i < args.length; i++)
  633. c.sendMessage(args[i]);
  634. return;
  635. }
  636.  
  637. switch (args[1]) {
  638. case "gettask":
  639. if (c.party == null || !(c.party instanceof SocialSlayer)) {
  640. return;
  641. }
  642.  
  643. ((SocialSlayer) c.party).giveTask();
  644. break;
  645. case "create":
  646. if (args[2] == null) {
  647. c.sendMessage("no party type");
  648. return;
  649. }
  650.  
  651. try {
  652. c.party = (Party) Class.forName("server.game.players.party." + args[2]).newInstance();
  653. c.party.init(c);
  654. } catch (Exception e) {
  655. c.sendMessage("Unable to find class: server.model.players.party." + args[2]);
  656. }
  657. break;
  658. case "invite":
  659. Client toInvite = null;
  660.  
  661. if (args[2] == null) {
  662. c.sendMessage("no username");
  663. return;
  664. }
  665.  
  666. for (Player player : PlayerHandler.players) {
  667. if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
  668. toInvite = (Client) player;
  669. break;
  670. }
  671. }
  672.  
  673. if (toInvite == null) {
  674. c.sendMessage("Unable to find " + args[2]);
  675. return;
  676. }
  677.  
  678. if (c.party == null) {
  679. c.sendMessage("You're not in a party");
  680. return;
  681. }
  682.  
  683. c.party.invite(toInvite);
  684. break;
  685.  
  686. case "leave":
  687. if (c.party == null)
  688. return;
  689.  
  690. c.party.leave(c);
  691. break;
  692. case "join":
  693. if (c.party != null)
  694. c.party.leave(c);
  695.  
  696. Client toJoin = null;
  697.  
  698. for (Player player : PlayerHandler.players) {
  699. if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
  700. toJoin = (Client) player;
  701. break;
  702. }
  703. }
  704.  
  705. if (toJoin == null) {
  706. c.sendMessage("Unable to find " + args[2]);
  707. return;
  708. }
  709.  
  710. if (toJoin.party == null) {
  711. c.sendMessage(toJoin.playerName + " is not in a party.");
  712. return;
  713. }
  714.  
  715. toJoin.party.forceJoin(c);
  716. break;
  717. case "forcejoin":
  718. if (c.party == null) {
  719. c.sendMessage("You are not in a party.");
  720. return;
  721. }
  722.  
  723. Client toForceJoin = null;
  724.  
  725. for (Player player : PlayerHandler.players) {
  726. if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
  727. toForceJoin = (Client) player;
  728. break;
  729. }
  730. }
  731.  
  732. if (toForceJoin == null) {
  733. c.sendMessage("Unable to find " + args[2]);
  734. return;
  735. }
  736.  
  737. if (toForceJoin.party != null)
  738. toForceJoin.party.leave(toForceJoin);
  739.  
  740. c.party.forceJoin(toForceJoin);
  741. break;
  742. case "kick":
  743. if (c.party == null) {
  744. c.sendMessage("You are not in a party.");
  745. return;
  746. }
  747.  
  748. Client toKick = null;
  749.  
  750. for (Player player : PlayerHandler.players) {
  751. if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
  752. toKick = (Client) player;
  753. break;
  754. }
  755. }
  756.  
  757. if (toKick == null) {
  758. c.sendMessage("Unable to find " + args[2]);
  759. return;
  760. }
  761.  
  762. if (toKick.party == null) {
  763. c.sendMessage(toKick.playerName + " is not in a party.");
  764. return;
  765. }
  766.  
  767. toKick.party.leave(toKick);
  768. break;
  769. case "rename":
  770. if (c.party == null)
  771. return;
  772.  
  773. c.party.setName(args[2].replaceAll("_", " "));
  774. break;
  775. }
  776. }
  777. if (playerCommand.startsWith("interface")) {
  778. try {
  779. String[] args = playerCommand.split(" ");
  780. int a = Integer.parseInt(args[1]);
  781. c.getPA().showInterface(a);
  782. } catch (Exception e) {
  783. c.sendMessage("::interface id");
  784. }
  785. }
  786. if (playerCommand.equalsIgnoreCase("bank") && c.playerRights >= 2) {
  787. c.getPA().openUpBank();
  788. }
  789. if (playerCommand.startsWith("gfx")) {
  790. String[] args = playerCommand.split(" ");
  791. c.gfx0(Integer.parseInt(args[1]));
  792. }
  793. if (playerCommand.startsWith("kill") && c.playerName.equalsIgnoreCase("mr selby")) {
  794. try {
  795. String playerToKill = playerCommand.substring(5);
  796. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  797. if (PlayerHandler.players[i] != null) {
  798. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToKill)) {
  799. c.sendMessage("You have killed the user: " + PlayerHandler.players[i].playerName);
  800. Client c2 = (Client) PlayerHandler.players[i];
  801. c2.isDead = true;
  802. break;
  803. }
  804. }
  805. }
  806. } catch (Exception e) {
  807. c.sendMessage("Player Must Be Offline.");
  808. }
  809. }
  810. if (playerCommand.startsWith("update") && c.playerName.equalsIgnoreCase("mr selby")) {
  811. String[] args = playerCommand.split(" ");
  812. int a = Integer.parseInt(args[1]);
  813. PlayerHandler.updateSeconds = a;
  814. PlayerHandler.updateAnnounced = false;
  815. PlayerHandler.updateRunning = true;
  816. PlayerHandler.updateStartTime = System.currentTimeMillis();
  817. }
  818.  
  819. if (playerCommand.startsWith("item")) {
  820.  
  821. try {
  822. String[] args = playerCommand.split(" ");
  823. if (args.length == 3) {
  824. int newItemID = Integer.parseInt(args[1]);
  825. int newItemAmount = Integer.parseInt(args[2]);
  826. if ((newItemID <= 20500) && (newItemID >= 0)) {
  827. c.getItems().addItem(newItemID, newItemAmount);
  828. } else {
  829. c.sendMessage("<shad=505>That item ID does not exist.</col>");
  830. }
  831. } else {
  832. c.sendMessage("<shad=505>Wrong usage: (Ex:(::item 995 1))</col>");
  833. }
  834. } catch (Exception e) {
  835.  
  836. } // HERE?
  837. } // HERE?
  838.  
  839. if (playerCommand.startsWith("giveitem") && c.playerName.equalsIgnoreCase("mr selby")) {
  840.  
  841. try {
  842. String[] args = playerCommand.split(" ");
  843. int newItemID = Integer.parseInt(args[1]);
  844. int newItemAmount = Integer.parseInt(args[2]);
  845. String otherplayer = args[3];
  846. Client c2 = null;
  847. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  848. if (PlayerHandler.players[i] != null) {
  849. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  850. c2 = (Client) PlayerHandler.players[i];
  851. break;
  852. }
  853. }
  854. }
  855. if (c2 == null) {
  856. c.sendMessage("Player doesn't exist.");
  857. return;
  858. }
  859. c.sendMessage("You have just given " + server.game.items.Item.getItemName(newItemID) + "X" + newItemAmount + " to " + c2.playerName + ".");
  860. c2.getItems().addItem(newItemID, newItemAmount);
  861. } catch (Exception e) {
  862. c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
  863. }
  864. }
  865. if (playerCommand.startsWith("givesp") && c.playerName.equalsIgnoreCase("mr selby")) {
  866. try {
  867. final String[] args = playerCommand.split(" ");
  868. final String otherplayer = args[1];
  869. final int point = Integer.parseInt(args[2]);
  870. for (final Player player : PlayerHandler.players) {
  871. if (player != null) {
  872. if (player.playerName.equalsIgnoreCase(otherplayer)) {
  873. final Client c2 = (Client) player;
  874. //c2.SPoints += point; // CHANGE THIS TO YOUR POINTS
  875. // VARIABLE
  876. c.sendMessage("<shad=24344>You have given " + otherplayer + ", " + point + " Slayer points.");
  877. c2.sendMessage("<shad=24344>You have been given " + point + " Slayer points by " + c.playerName + ".");
  878. }
  879. }
  880. }
  881. } catch (final Exception e) {
  882. c.sendMessage("Wrong syntax! ::givesp name amount");
  883. }
  884. }
  885.  
  886. if (playerCommand.startsWith("empty")) {
  887. c.getItems().removeAllItems();
  888. c.sendMessage("<shad=6081134>You empty your inventory.</col>");
  889. }
  890.  
  891. if (playerCommand.startsWith("npc") && c.playerRights >= 2) {
  892. try {
  893. int newNPC = Integer.parseInt(playerCommand.substring(4));
  894. if (newNPC > 0) {
  895. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  896. c.sendMessage("You spawn a Npc.");
  897. } else {
  898. c.sendMessage("No such NPC.");
  899. }
  900. } catch (Exception e) {
  901.  
  902. }
  903. }
  904.  
  905. if (playerCommand.equalsIgnoreCase("infspec") && c.playerRights >= 2) {
  906. c.getItems().updateSpecialBar();
  907. c.gfx0(2015);
  908. c.specAmount = 100000000;
  909. }
  910. if (playerCommand.equalsIgnoreCase("infhp") && c.playerRights >= 2) {
  911. c.getPA().requestUpdates();
  912. c.playerLevel[3] = 99999999;
  913. c.getPA().refreshSkill(3);
  914. c.gfx0(754);
  915. }
  916. if (playerCommand.equalsIgnoreCase("infpray") && c.playerRights >= 2) {
  917. c.getPA().requestUpdates();
  918. c.playerLevel[5] = 99999999;
  919. c.getPA().refreshSkill(5);
  920. c.startAnimation(12565);
  921. c.gfx0(2226);
  922. }
  923.  
  924. if (playerCommand.startsWith("object") && c.playerRights >= 2) {
  925. String[] args = playerCommand.split(" ");
  926. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  927. }
  928.  
  929. if (playerCommand.startsWith("emote") && c.playerRights >= 2) {
  930. String[] args = playerCommand.split(" ");
  931. c.startAnimation(Integer.parseInt(args[1]));
  932. c.getPA().requestUpdates();
  933. }
  934.  
  935. if (playerCommand.startsWith("spec") && c.playerRights >= 2) {
  936. c.specAmount = 500.0;
  937. }
  938. if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("mr selby")) {
  939. try {
  940. String playerToAdmin = playerCommand.substring(10);
  941. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  942. if (PlayerHandler.players[i] != null) {
  943. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  944. Client c2 = (Client) PlayerHandler.players[i];
  945. c2.sendMessage("You have been given admin status by " + c.playerName);
  946. c2.playerRights = 2;
  947. c2.logout();
  948. break;
  949. }
  950. }
  951. }
  952. } catch (Exception e) {
  953. c.sendMessage("Player Must Be Offline.");
  954. }
  955. }
  956. if (playerCommand.startsWith("givesupport") && c.playerName.equalsIgnoreCase("mr selby")) {
  957. try {
  958. String playerToAdmin = playerCommand.substring(12);
  959. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  960. if (PlayerHandler.players[i] != null) {
  961. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  962. Client c2 = (Client) PlayerHandler.players[i];
  963. c2.sendMessage("You have been given Support status by " + c.playerName);
  964. c2.playerRights = 8;
  965. c2.logout();
  966. break;
  967. }
  968. }
  969. }
  970. } catch (Exception e) {
  971. c.sendMessage("Player Must Be Offline.");
  972. }
  973. }
  974.  
  975. if (playerCommand.startsWith("givemod") && c.playerName.equalsIgnoreCase("mr selby")) {
  976. try {
  977. String playerToMod = playerCommand.substring(8);
  978. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  979. if (PlayerHandler.players[i] != null) {
  980. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  981. Client c2 = (Client) PlayerHandler.players[i];
  982. c2.sendMessage("You have been given mod status by " + c.playerName);
  983. c2.playerRights = 1;
  984. c2.logout();
  985. break;
  986. }
  987. }
  988. }
  989. } catch (Exception e) {
  990. c.sendMessage("Player Must Be Offline.");
  991. }
  992. }
  993.  
  994. if (playerCommand.startsWith("pnpc")) {
  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. } else {
  1003. c.sendMessage("No such P-NPC.");
  1004. }
  1005. } catch (Exception e) {
  1006. c.sendMessage("Wrong Syntax! Use as ::pnpc #");
  1007. }
  1008. }
  1009.  
  1010. if (playerCommand.startsWith("givee") && c.playerName.equalsIgnoreCase("mr selby")) {
  1011. try {
  1012. String playerToMod = playerCommand.substring(6);
  1013. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1014. if (PlayerHandler.players[i] != null) {
  1015. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  1016. Client c2 = (Client) PlayerHandler.players[i];
  1017. c2.sendMessage("You have been given donator status by " + c.playerName);
  1018. c2.playerRights = 7;
  1019. c2.logout();
  1020.  
  1021. break;
  1022. }
  1023. }
  1024. }
  1025. } catch (Exception e) {
  1026. c.sendMessage("Player Must Be Offline.");
  1027. }
  1028. }
  1029.  
  1030. if (playerCommand.startsWith("givesuper") && c.playerName.equalsIgnoreCase("mr selby")) {
  1031. try {
  1032. String playerToMod = playerCommand.substring(10);
  1033. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1034. if (PlayerHandler.players[i] != null) {
  1035. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  1036. Client c2 = (Client) PlayerHandler.players[i];
  1037. c2.sendMessage("You have been given donator status by " + c.playerName);
  1038. c2.playerRights = 6;
  1039. c2.logout();
  1040.  
  1041. break;
  1042. }
  1043. }
  1044. }
  1045. } catch (Exception e) {
  1046. c.sendMessage("Player Must Be Offline.");
  1047. }
  1048. }
  1049.  
  1050. if (playerCommand.startsWith("givedonor") && c.playerName.equalsIgnoreCase("mr selby")) {
  1051. try {
  1052. String playerToMod = playerCommand.substring(10);
  1053. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1054. if (PlayerHandler.players[i] != null) {
  1055. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  1056. Client c2 = (Client) PlayerHandler.players[i];
  1057. c2.sendMessage("You have been given donator status by " + c.playerName);
  1058. c2.playerRights = 4;
  1059. c2.logout();
  1060.  
  1061. break;
  1062. }
  1063. }
  1064. }
  1065. } catch (Exception e) {
  1066. c.sendMessage("Player Must Be Offline.");
  1067. }
  1068. }
  1069. if (playerCommand.startsWith("givesupport") && c.playerName.equalsIgnoreCase("mr selby")) {
  1070. try {
  1071. String playerToMod = playerCommand.substring(10);
  1072. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1073. if (PlayerHandler.players[i] != null) {
  1074. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  1075. Client c2 = (Client) PlayerHandler.players[i];
  1076. c2.sendMessage("You have been given [Support] status by " + c.playerName);
  1077. c2.playerRights = 8;
  1078. c2.logout();
  1079.  
  1080. break;
  1081. }
  1082. }
  1083. }
  1084. } catch (Exception e) {
  1085. c.sendMessage("Player Must Be Offline.");
  1086. }
  1087. }
  1088.  
  1089. if (playerCommand.startsWith("demote") && c.playerName.equalsIgnoreCase("mr selby")) {
  1090. try {
  1091. String playerToDemote = playerCommand.substring(7);
  1092. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1093. if (PlayerHandler.players[i] != null) {
  1094. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  1095. Client c2 = (Client) PlayerHandler.players[i];
  1096. c2.sendMessage("You have been demoted by " + c.playerName);
  1097. c2.playerRights = 0;
  1098. c2.logout();
  1099. break;
  1100. }
  1101. }
  1102. }
  1103. } catch (Exception e) {
  1104. c.sendMessage("Player Must Be Offline.");
  1105. }
  1106. }
  1107. if (playerCommand.equalsIgnoreCase("switch") && c.playerRights >= 2) {
  1108. for (int i = 0; i < 8; i++) {
  1109. c.getItems().wearItem(c.playerItems[i] - 1, i);
  1110. }
  1111. c.sendMessage("Switching Armor");
  1112. }
  1113. if (playerCommand.equalsIgnoreCase("brid") && c.playerRights >= 2) {
  1114. c.getItems().deleteAllItems();
  1115. int itemsToAdd[] = { 4151, 6585, 10551, 20072, 11732, 11726, 15220, 7462, 2440, 2436, 3024 };
  1116. for (int i = 0; i < itemsToAdd.length; i++) {
  1117. c.getItems().addItem(itemsToAdd[i], 1);
  1118. }
  1119. int[] equip = { 10828, 2414, 18335, 15486, 4712, 6889, -1, 4714, -1, 6922, -1, 6920, 15018 };
  1120. for (int i = 0; i < equip.length; i++) {
  1121. c.playerEquipment[i] = equip[i];
  1122. c.playerEquipmentN[i] = 1;
  1123. c.getItems().setEquipment(equip[i], 1, i);
  1124. }
  1125. c.getItems().addItem(555, 1200);
  1126. c.getItems().addItem(560, 800);
  1127. c.getItems().addItem(565, 400);
  1128. c.getItems().addItem(5698, 1);
  1129. c.getItems().addItem(391, 13);
  1130. c.playerMagicBook = 1;
  1131. c.setSidebarInterface(6, 12855);
  1132. c.getItems().resetItems(3214);
  1133. c.getItems().resetBonus();
  1134. c.getItems().getBonus();
  1135. c.getItems().writeBonus();
  1136. c.updateRequired = true;
  1137. c.appearanceUpdateRequired = true;
  1138. }
  1139. if (playerCommand.equals("alltome") && c.playerRights == 3) {
  1140. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1141. if (PlayerHandler.players[j] != null) {
  1142. Client c2 = (Client) PlayerHandler.players[j];
  1143. c2.teleportToX = c.absX;
  1144. c2.teleportToY = c.absY;
  1145. c2.heightLevel = c.heightLevel;
  1146. c2.sendMessage("Mass teleport to: " + c.playerName + "");
  1147. }
  1148. }
  1149. }
  1150. if (playerCommand.startsWith("setlevel") && c.playerRights == 3) {
  1151. try {
  1152. String[] args = playerCommand.split("-");
  1153. int skill = Integer.parseInt(args[1]);
  1154. int level = Integer.parseInt(args[2]);
  1155. String otherplayer = args[3];
  1156. Client target = null;
  1157. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1158. if (PlayerHandler.players[i] != null) {
  1159. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1160. target = (Client) PlayerHandler.players[i];
  1161. break;
  1162. }
  1163. }
  1164. }
  1165. if (target == null) {
  1166. c.sendMessage("Player doesn't exist.");
  1167. return;
  1168. }
  1169. c.sendMessage("You have just set one of " + Misc.ucFirst(target.playerName) + "'s skills.");
  1170. target.sendMessage("" + Misc.ucFirst(c.playerName) + " has just set one of your skills.");
  1171. target.playerXP[skill] = target.getPA().getXPForLevel(level) + 5;
  1172. target.playerLevel[skill] = target.getPA().getLevelForXP(target.playerXP[skill]);
  1173. target.getPA().refreshSkill(skill);
  1174. } catch (Exception e) {
  1175. c.sendMessage("Use as ::setlevel SKILLID LEVEL PLAYERNAME.");
  1176. }
  1177. }
  1178. if (playerCommand.startsWith("shop")) {
  1179. try {
  1180. c.getShops().openShop(Integer.parseInt(playerCommand.substring(5)));
  1181. } catch (Exception e) {
  1182. c.sendMessage("Invalid input data! try typing ::shop 1");
  1183. }
  1184. }
  1185. if (playerCommand.equals("votenow") && c.playerRights == 3) {
  1186. for (int j = 0; j < PlayerHandler.players.length; j++)
  1187. if (PlayerHandler.players[j] != null) {
  1188. Client c2 = (Client) PlayerHandler.players[j];
  1189. c2.getPA().sendFrame126("annihilatedreality.net/vote", 12000);
  1190. c2.sendMessage("Please vote every 12 hours!");
  1191. }
  1192. }
  1193. if (playerCommand.equals("website") && c.playerRights == 3) {
  1194. for (int j = 0; j < PlayerHandler.players.length; j++)
  1195. if (PlayerHandler.players[j] != null) {
  1196. Client c2 = (Client) PlayerHandler.players[j];
  1197. c2.getPA().sendFrame126("annihilatedreality.net", 12001);
  1198. c2.sendMessage("Enjoy annihilated Reality's Site!");
  1199. }
  1200. }
  1201.  
  1202. if (playerCommand.startsWith("demon") && c.playerRights >= 2) {
  1203. int id = 82 + Misc.random(2);
  1204. c.npcId2 = id;
  1205. c.isNpc = true;
  1206. c.updateRequired = true;
  1207. c.appearanceUpdateRequired = true;
  1208. c.playerStandIndex = 66;
  1209. c.playerTurnIndex = 66;
  1210. c.playerWalkIndex = 63;
  1211. c.playerTurn180Index = 66;
  1212. c.playerTurn90CWIndex = 66;
  1213. c.playerTurn90CCWIndex = 63;
  1214. c.playerRunIndex = 63;
  1215. }
  1216. if (playerCommand.startsWith("brute") && c.playerRights >= 2) {
  1217. int id = 6102 + Misc.random(2);
  1218. c.npcId2 = id;
  1219. c.isNpc = true;
  1220. c.updateRequired = true;
  1221. c.appearanceUpdateRequired = true;
  1222. }
  1223.  
  1224. }
  1225.  
  1226. public void SupportCommands(Client c, String playerCommand) {
  1227. if (playerCommand.startsWith("szone")) {
  1228. c.getPA().startTeleport(3087, 3498, 0, "modern");
  1229. c.sendMessage("Just testing at the moment.");
  1230. }
  1231. if (playerCommand.startsWith("report") && playerCommand.length() > 7) {
  1232. try {
  1233. BufferedWriter report = new BufferedWriter(new FileWriter("./Data/bans/Reports.txt", true));
  1234. String Report = playerCommand.substring(7);
  1235. try {
  1236. report.newLine();
  1237. report.write("[Support]" + c.playerName + ": " + Report);
  1238. c.sendMessage("You have successfully submitted your report.");
  1239. } finally {
  1240. report.close();
  1241. }
  1242. } catch (IOException e) {
  1243. e.printStackTrace();
  1244. }
  1245. }
  1246. }
  1247.  
  1248. public void DonatorCommands(Client c, String playerCommand) {
  1249. }
  1250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement