Guest User

Untitled

a guest
Jan 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.75 KB | None | 0 0
  1. package ardi.model.players.packets;
  2.  
  3. import ardi.Config;
  4. import ardi.Connection;
  5. import ardi.Server;
  6. import ardi.model.players.Client;
  7. import ardi.model.players.PacketType;
  8. import ardi.model.players.PlayerHandler;
  9. import ardi.util.MadTurnipConnection;
  10. import ardi.util.Misc;
  11.  
  12. /**
  13. * Commands
  14. **/
  15. public class Commands implements PacketType {
  16.  
  17. @Override
  18. public void processPacket(Client c, int packetType, int packetSize) {
  19. String playerCommand = c.getInStream().readString();
  20. if (Config.SERVER_DEBUG)
  21. Misc.println(c.playerName + " playerCommand: " + playerCommand);
  22.  
  23. /*
  24. * Commands of Ardi
  25. */
  26.  
  27. if (playerCommand.startsWith("yell")) {
  28. String rank = "";
  29. String Message = playerCommand.substring(4);
  30. if (c.playerRights == 0) {
  31. c.sendMessage("Do you want access to the yell command? ::donate");
  32. return;
  33. }
  34. if (Connection.isMuted(c))
  35. {
  36. c.sendMessage("You are muted for breaking a rule.");
  37. return;
  38. }
  39. /* Donators */
  40. if (c.playerRights == 4) {
  41.  
  42. rank = "[@dre@Bronze Donator@bla@][@blu@" + c.playerName
  43. + "@bla@]:@dre@";
  44. }
  45. if (c.playerRights == 5) {
  46.  
  47. rank = "[@whi@Silver Donator@bla@][@blu@" + c.playerName
  48. + "@bla@]:@dre@";
  49. }
  50. if (c.playerRights == 6) {
  51.  
  52. rank = "[@yel@Gold Donator@bla@][@blu@" + c.playerName
  53. + "@bla@]:@dre@";
  54. }
  55. /* Staff */
  56. if (c.playerRights == 1) {
  57.  
  58. rank = "[@blu@Moderator@bla@][@blu@" + c.playerName
  59. + "@bla@]:@dre@";
  60. }
  61. if (c.playerRights == 2) {
  62.  
  63. rank = "[@or3@Administrator@bla@][@blu@"
  64. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  65. }
  66. if (c.playerRights == 3) {
  67. rank = "[@red@Owner@bla@] @cr2@"
  68. + Misc.ucFirst(c.playerName) + ":@dre@";
  69. }
  70. if (c.playerName.equalsIgnoreCase("")) {
  71.  
  72. rank = "[@blu@Forum Moderator@bla@][@blu@"
  73. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  74. }
  75. if (c.playerName.equalsIgnoreCase("")) {
  76.  
  77. rank = "[@blu@Web Developer@bla@][@blu@"
  78. + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  79. }
  80. for (int j = 0; j < PlayerHandler.players.length; j++) {
  81. if (PlayerHandler.players[j] != null) {
  82. Client c2 = (Client) PlayerHandler.players[j];
  83. c2.sendMessage(rank + Message);
  84. }
  85. }
  86. }
  87. /* Player Commands */
  88. if (playerCommand.startsWith("/")) {
  89. if (Connection.isMuted(c))
  90. {
  91. c.sendMessage("You are muted for breaking a rule.");
  92. return;
  93. }
  94. if (c.clan != null) {
  95. String message = playerCommand.substring(1);
  96. c.clan.sendChat(c, message);
  97. } else {
  98. c.sendMessage("You can only do this in a clan chat..");
  99. }
  100. }
  101. if (playerCommand.equalsIgnoreCase("empty") && !c.inWild()) {
  102. c.getDH().sendOption2("Yes, I want to empty my inventory items.",
  103. "No, i want to keep my inventory items.");
  104. c.dialogueAction = 162;
  105. }
  106. if (playerCommand.equalsIgnoreCase("players")) {
  107. c.sendMessage("There are currently @blu@"
  108. + PlayerHandler.getPlayerCount() + "@bla@ players online.");
  109. }
  110. if (playerCommand.equalsIgnoreCase("xptoggle")) {
  111. if (c.expLock == false) {
  112. c.expLock = true;
  113. c.sendMessage("Your experience is now locked. You will not gain experience.");
  114. } else {
  115. c.expLock = false;
  116. c.sendMessage("Your experience is now unlocked. You will gain experience.");
  117. }
  118. }
  119. {
  120. if (playerCommand.startsWith("resettask") && c.playerRights == 3) {
  121. c.taskAmount = -1; // vars
  122. c.slayerTask = 0; // vars
  123. c.sendMessage("Your slayer task has been reseted sucessfully.");
  124. c.getPA().sendFrame126("@whi@Task: @gre@Empty", 7383);
  125. }
  126. }
  127. if (playerCommand.equalsIgnoreCase("skull")) {
  128. c.isSkulled = true;
  129. c.skullTimer = Config.SKULL_TIMER;
  130. c.headIconPk = 0;
  131. c.getPA().requestUpdates();
  132. }
  133. if (playerCommand.startsWith("changepassword")
  134. && playerCommand.length() > 15) {
  135. c.playerPass = playerCommand.substring(15);
  136. c.sendMessage("@dre@ Your password is now: " + c.playerPass);
  137. }
  138.  
  139. if (playerCommand.equalsIgnoreCase("commands")) {
  140. c.sendMessage("@dre@ Reguler Commands");
  141. c.sendMessage("::fishing ::mining ::home ::train ::duel");
  142. c.sendMessage("::empty ::skull ::players ::market ::xptoggle");
  143. c.sendMessage("::changepassword (new password)");
  144. c.sendMessage("@dre@Bronze Donator + Commmands");
  145. c.sendMessage("::Donatorzone ::resettask ::spells ::bronze");
  146. c.sendMessage("@dre@ Silver Donator + Commands");
  147. c.sendMessage("::Silver ::bank");
  148. c.sendMessage("@dre@Gold Donator Commands");
  149. c.sendMessage("::Gold ::spec");
  150. }
  151. if (playerCommand.equalsIgnoreCase("claim")) {
  152. MadTurnipConnection.addDonateItems(c, c.playerName);
  153. c.sendMessage("Checking for any unclaimed donations.");
  154. }
  155. /* Teleports */
  156. if (playerCommand.equals("home")) {
  157. c.getPA().startTeleport(3212, 3429, 0, "modern");
  158. }
  159. if (playerCommand.equals("fishing")) {
  160. c.getPA().startTeleport(2604, 3414, 0, "modern");
  161. }
  162. if (playerCommand.equals("mining")) {
  163. c.getPA().startTeleport(3046, 9751, 0, "modern");
  164. }
  165. if (playerCommand.equals("train")) {
  166. // c.getPA().startTeleport(2520, 4777, 0, "modern");
  167. c.getPA().startTeleport(2679, 3718, 0, "modern");
  168. }
  169. if (playerCommand.equals("duel")) {
  170. c.getPA().startTeleport(3365, 3265, 0, "modern");
  171. }
  172. if (playerCommand.equals("market")){
  173. c.getPA().startTeleport(2964, 3381, 0, "modern");
  174. c.sendMessage("welcome to the market!");
  175. }
  176. if (c.playerRights >= 1 && c.playerRights <= 3 &&playerCommand.equals("staffzone")) {
  177. c.getPA().startTeleport(2912, 5475, 0, "modern");
  178. }
  179. {
  180. /* Moderator Commands */
  181. if (playerCommand.startsWith("jail") && c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3) {
  182. try {
  183. String playerToBan = playerCommand.substring(5);
  184. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  185. if (PlayerHandler.players[i] != null) {
  186. if (PlayerHandler.players[i].playerName
  187. .equalsIgnoreCase(playerToBan)) {
  188. Client c2 = (Client) PlayerHandler.players[i];
  189. if (c2.inWild()) {
  190. c.sendMessage("You cant jail a player while he is in the wilderness.");
  191. return;
  192. }
  193. if (c2.duelStatus == 5) {
  194. c.sendMessage("You cant jail a player when he is during a duel.");
  195. return;
  196. }
  197. c2.teleportToX = 2095;
  198. c2.teleportToY = 4428;
  199. c2.sendMessage("You have been jailed by "
  200. + c.playerName + " .");
  201. c.sendMessage("Successfully Jailed "
  202. + c2.playerName + ".");
  203. }
  204. }
  205. }
  206. } catch (Exception e) {
  207. c.sendMessage("Player Must Be Offline.");
  208. }
  209. }
  210. }
  211. if (playerCommand.startsWith("unjail") && c.playerRights == 3) {
  212. try {
  213. String playerToBan = playerCommand.substring(7);
  214. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  215. if (PlayerHandler.players[i] != null) {
  216. if (PlayerHandler.players[i].playerName
  217. .equalsIgnoreCase(playerToBan)) {
  218. Client c2 = (Client) PlayerHandler.players[i];
  219. if (c2.inWild()) {
  220. c.sendMessage("This player is in the wilderness, not in jail.");
  221. return;
  222. }
  223. if (c2.duelStatus == 5 || c2.inDuelArena()) {
  224. c.sendMessage("This player is during a duel, and not in jail.");
  225. return;
  226. }
  227. c2.teleportToX = 3429;
  228. c2.teleportToY = 3212; // 3212, 3429
  229. c2.sendMessage("You have been unjailed by "
  230. + c.playerName
  231. + ". You can now teleport.");
  232. c.sendMessage("Successfully unjailed "
  233. + c2.playerName + ".");
  234. }
  235. }
  236. }
  237. } catch (Exception e) {
  238. c.sendMessage("Player Must Be Offline.");
  239. }
  240. }
  241. if (playerCommand.startsWith("timedmute") && c.playerRights == 1 && c.playerRights == 2
  242. && c.playerRights == 3) {
  243.  
  244. try {
  245. String[] args = playerCommand.split("-");
  246. if (args.length < 2) {
  247. c.sendMessage("Currect usage: ::timedmute-playername-seconds");
  248. return;
  249. }
  250. String playerToMute = args[1];
  251. int muteTimer = Integer.parseInt(args[2]) * 1000;
  252.  
  253. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  254. if (PlayerHandler.players[i] != null) {
  255. if (PlayerHandler.players[i].playerName
  256. .equalsIgnoreCase(playerToMute)) {
  257. Client c2 = (Client) PlayerHandler.players[i];
  258. c2.sendMessage("You have been muted by: "
  259. + c.playerName + " for " + muteTimer
  260. / 1000 + " seconds");
  261. c2.muteEnd = System.currentTimeMillis()
  262. + muteTimer;
  263. break;
  264. }
  265. }
  266. }
  267. } catch (Exception e) {
  268. c.sendMessage("Player Must Be Offline.");
  269. }
  270. }
  271. if (playerCommand.startsWith("teletome") && c.playerRights == 2 && c.playerRights == 3) {
  272. try {
  273. String playerToBan = playerCommand.substring(9);
  274. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  275. if (PlayerHandler.players[i] != null) {
  276. if (PlayerHandler.players[i].playerName
  277. .equalsIgnoreCase(playerToBan)) {
  278. Client c2 = (Client) PlayerHandler.players[i];
  279. if (c2.inWild()) {
  280. c.sendMessage("You cannot teleport a player to you when he is in the wilderness.");
  281. return;
  282. }
  283. if (c2.duelStatus == 5) {
  284. c.sendMessage("You cannot teleport a player to you when he is during a duel.");
  285. return;
  286. }
  287. if (c.inWild()) {
  288. c.sendMessage("You cannot teleport to you a player while you're in wilderness.");
  289. return;
  290. }
  291. c2.teleportToX = c.absX;
  292. c2.teleportToY = c.absY;
  293. c2.heightLevel = c.heightLevel;
  294. c.sendMessage("You have teleported "
  295. + c2.playerName + " to you.");
  296. c2.sendMessage("You have been teleported to "
  297. + c.playerName + "");
  298. }
  299. }
  300. }
  301. } catch (Exception e) {
  302. c.sendMessage("Player Must Be Offline.");
  303. }
  304. }
  305. if (playerCommand.startsWith("xteleto") && c.playerRights == 2 && c.playerRights == 3) {
  306. String name = playerCommand.substring(8);
  307. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  308. if (PlayerHandler.players[i] != null) {
  309. if (PlayerHandler.players[i].playerName
  310. .equalsIgnoreCase(name)) {
  311. Client c2 = (Client) PlayerHandler.players[i];
  312. if (c2.inWild()) {
  313. c.sendMessage("The player you tried teleporting to is in the wilderness.");
  314. return;
  315. }
  316. if (c.inWild()) {
  317. c.sendMessage("You cannot teleport to a player while you're in the wilderness");
  318. return;
  319. }
  320. if (c.duelStatus == 5) {
  321. c.sendMessage("You cannot teleport to a player during a duel.");
  322. return;
  323. }
  324. c.getPA().movePlayer(
  325. PlayerHandler.players[i].getX(),
  326. PlayerHandler.players[i].getY(),
  327. c.heightLevel);
  328. }
  329. }
  330. }
  331. }
  332. /* Ardi Commands */
  333. if (playerCommand.startsWith("title") && c.playerRights == 3) {
  334. try {
  335. final String[] args = playerCommand.split("-");
  336. c.playerTitle = args[1];
  337. String color = args[2].toLowerCase();
  338. if (color.equals("orange"))
  339. c.titleColor = 0;
  340. if (color.equals("purple"))
  341. c.titleColor = 1;
  342. if (color.equals("red"))
  343. c.titleColor = 2;
  344. if (color.equals("green"))
  345. c.titleColor = 3;
  346. c.sendMessage("You succesfully changed your title.");
  347. c.updateRequired = true;
  348. c.setAppearanceUpdateRequired(true);
  349. } catch (final Exception e) {
  350. c.sendMessage("Use as ::title-[title]-[color]");
  351. }
  352. }
  353. if (playerCommand.startsWith("getip") && c.playerRights == 3) {
  354. String name = playerCommand.substring(6);
  355. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  356. if (PlayerHandler.players[i] != null) {
  357. if (PlayerHandler.players[i].playerName
  358. .equalsIgnoreCase(name)) {
  359. c.sendMessage(PlayerHandler.players[i].playerName
  360. + " ip is "
  361. + PlayerHandler.players[i].connectedFrom);
  362. return;
  363. }
  364. }
  365. }
  366. }
  367. if (playerCommand.startsWith("sendhome") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) {
  368. try {
  369. String playerToBan = playerCommand.substring(9);
  370. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  371. if (PlayerHandler.players[i] != null) {
  372. if (PlayerHandler.players[i].playerName
  373. .equalsIgnoreCase(playerToBan)) {
  374. Client c2 = (Client) PlayerHandler.players[i];
  375. c2.teleportToX = 3212;
  376. c2.teleportToY = 3429;
  377. c2.heightLevel = c.heightLevel;
  378. c.sendMessage("You have teleported "
  379. + c2.playerName + " to home");
  380. c2.sendMessage("You have been teleported to home");
  381. }
  382. }
  383. }
  384. } catch (Exception e) {
  385. c.sendMessage("Player Must Be Offline.");
  386. }
  387. }
  388. if (playerCommand.startsWith("tele") && c.playerRights == 2 && c.playerRights == 3) {
  389. String[] arg = playerCommand.split(" ");
  390. if (arg.length > 3)
  391. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  392. Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  393. else if (arg.length == 3)
  394. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  395. Integer.parseInt(arg[2]), c.heightLevel);
  396. }
  397. if (playerCommand.startsWith("getid") && c.playerRights == 3) {
  398. String a[] = playerCommand.split(" ");
  399. String name = "";
  400. int results = 0;
  401. for (int i = 1; i < a.length; i++)
  402. name = name + a[i] + " ";
  403. name = name.substring(0, name.length() - 1);
  404. c.sendMessage("Searching: " + name);
  405. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  406. if (Server.itemHandler.ItemList[j] != null)
  407. if (Server.itemHandler.ItemList[j].itemName
  408. .replace("_", " ").toLowerCase()
  409. .contains(name.toLowerCase())) {
  410. c.sendMessage("@red@"
  411. + Server.itemHandler.ItemList[j].itemName
  412. .replace("_", " ") + " - "
  413. + Server.itemHandler.ItemList[j].itemId);
  414. results++;
  415. }
  416. }
  417. c.sendMessage(results + " results found...");
  418. }
  419. if (playerCommand.startsWith("item") && c.playerRights == 3) {
  420. try {
  421. String[] args = playerCommand.split(" ");
  422. if (args.length == 3) {
  423. int newItemID = Integer.parseInt(args[1]);
  424. int newItemAmount = Integer.parseInt(args[2]);
  425. if ((newItemID <= 20200) && (newItemID >= 0)) {
  426. c.getItems().addItem(newItemID, newItemAmount);
  427. } else {
  428. c.sendMessage("No such item.");
  429. }
  430. } else {
  431. c.sendMessage("Use as ::pickup 995 200");
  432. }
  433. } catch (Exception e) {
  434. }
  435. }
  436. if (playerCommand.equalsIgnoreCase("mypos")) {
  437. c.sendMessage("X: " + c.absX);
  438. c.sendMessage("Y: " + c.absY);
  439. c.sendMessage("H: " + c.heightLevel);
  440. }
  441. if (c.playerRights == 3 && c.playerRights == 6 && c.playerRights == 2 && c.playerRights == 1 && playerCommand.equalsIgnoreCase("spec")) {
  442. if(c.specAmount < 10.0){
  443. if (c.specRestore > 0) return;
  444. c.specRestore = 300;
  445. c.specAmount = 10.0;
  446. c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
  447. c.sendMessage("Your special attack has been restored, only every 300 seconds.");
  448. }
  449. if (playerCommand.startsWith("npc") && c.playerRights == 3) {
  450. try {
  451. int newNPC = Integer.parseInt(playerCommand.substring(4));
  452. if (newNPC > 0) {
  453. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  454. 0, 0, 120, 7, 70, 70, false, false);
  455. c.sendMessage("You spawn a Npc.");
  456. } else {
  457. c.sendMessage("No such NPC.");
  458. }
  459. } catch (Exception e) {
  460. }
  461. if (playerCommand.startsWith("ipban") && c.playerRights == 2 && c.playerRights == 3) {
  462. try {
  463. String playerToBan = playerCommand.substring(6);
  464. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  465. if (PlayerHandler.players[i] != null) {
  466. if (PlayerHandler.players[i].playerName
  467. .equalsIgnoreCase(playerToBan)) {
  468. if (c.playerName == PlayerHandler.players[i].playerName) {
  469. c.sendMessage("You cannot IP Ban yourself.");
  470. } else {
  471. if (!Connection
  472. .isIpBanned(PlayerHandler.players[i].connectedFrom)) {
  473. Connection
  474. .addIpToBanList(PlayerHandler.players[i].connectedFrom);
  475. Connection
  476. .addIpToFile(PlayerHandler.players[i].connectedFrom);
  477. c.sendMessage("You have IP banned the user: "
  478. + PlayerHandler.players[i].playerName
  479. + " with the host: "
  480. + PlayerHandler.players[i].connectedFrom);
  481. PlayerHandler.players[i].disconnected = true;
  482. } else {
  483. c.sendMessage("This user is already IP Banned.");
  484. }
  485. }
  486. }
  487. }
  488. }
  489. } catch (Exception e) {
  490. c.sendMessage("Player Must Be Offline.");
  491. }
  492. }
  493. if (playerCommand.startsWith("ban") && c.playerRights == 2 && c.playerRights == 3) { // use as ::ban name
  494. try {
  495. String playerToBan = playerCommand.substring(4);
  496. Connection.addNameToBanList(playerToBan);
  497. Connection.addNameToFile(playerToBan);
  498. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  499. if (PlayerHandler.players[i] != null) {
  500. if (PlayerHandler.players[i].playerName
  501. .equalsIgnoreCase(playerToBan)) {
  502. PlayerHandler.players[i].disconnected = true;
  503. }
  504. }
  505. }
  506. } catch (Exception e) {
  507. c.sendMessage("Player Must Be Offline.");
  508. }
  509. }
  510. if (playerCommand.startsWith("unban") && c.playerRights == 3) {
  511. try {
  512. String playerToBan = playerCommand.substring(6);
  513. Connection.removeNameFromBanList(playerToBan);
  514. c.sendMessage(playerToBan + " has been unbanned.");
  515. } catch (Exception e) {
  516. c.sendMessage("Player Must Be Offline.");
  517. }
  518. }
  519. if (playerCommand.startsWith("ipmute") && c.playerRights == 2 && c.playerRights == 3) {
  520. try {
  521. String playerToBan = playerCommand.substring(7);
  522. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  523. if (PlayerHandler.players[i] != null) {
  524. if (PlayerHandler.players[i].playerName
  525. .equalsIgnoreCase(playerToBan)) {
  526. Connection
  527. .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  528. c.sendMessage("You have IP Muted the user: "
  529. + PlayerHandler.players[i].playerName);
  530. Client c2 = (Client) PlayerHandler.players[i];
  531. c2.sendMessage("You have been muted by: "
  532. + c.playerName);
  533. break;
  534. }
  535. }
  536. }
  537. } catch (Exception e) {
  538. c.sendMessage("Player Must Be Offline.");
  539. }
  540. }
  541. if (playerCommand.startsWith("unipmute") && c.playerRights == 3) {
  542. try {
  543. String playerToBan = playerCommand.substring(9);
  544. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  545. if (PlayerHandler.players[i] != null) {
  546. if (PlayerHandler.players[i].playerName
  547. .equalsIgnoreCase(playerToBan)) {
  548. Connection
  549. .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  550. c.sendMessage("You have Un Ip-Muted the user: "
  551. + PlayerHandler.players[i].playerName);
  552. break;
  553. }
  554. }
  555. }
  556. } catch (Exception e) {
  557. c.sendMessage("Player Must Be Offline.");
  558. }
  559. }
  560. if (playerCommand.startsWith("kick") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3 ) {
  561. try {
  562. String playerToBan = playerCommand.substring(5);
  563. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  564. if (PlayerHandler.players[i] != null) {
  565. if (PlayerHandler.players[i].playerName
  566. .equalsIgnoreCase(playerToBan)) {
  567. PlayerHandler.players[i].disconnected = true;
  568. }
  569. }
  570. }
  571. } catch (Exception e) {
  572. c.sendMessage("Player Must Be Offline.");
  573. }
  574. }
  575. if (playerCommand.startsWith("demoted") && c.playerRights == 3) { // use as ::prm name
  576. try {
  577. String playerToG = playerCommand.substring(8);
  578. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  579. if (PlayerHandler.players[i] != null) {
  580. if (PlayerHandler.players[i].playerName
  581. .equalsIgnoreCase(playerToG)) {
  582. PlayerHandler.players[i].playerRights = 0;
  583. PlayerHandler.players[i].disconnected = true;
  584. c.sendMessage("You've demoted the user: "
  585. + PlayerHandler.players[i].playerName
  586. + " IP: "
  587. + PlayerHandler.players[i].connectedFrom);
  588. }
  589. }
  590. }
  591. } catch (Exception e) {
  592. // c.sendMessage("Player Must Be Offline.");
  593. }
  594. }
  595. if (playerCommand.startsWith("givemod") && c.playerRights == 3) { // use as ::prm name
  596. try {
  597. String playerToG = playerCommand.substring(8);
  598. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  599. if (PlayerHandler.players[i] != null) {
  600. if (PlayerHandler.players[i].playerName
  601. .equalsIgnoreCase(playerToG)) {
  602. PlayerHandler.players[i].playerRights = 1;
  603. PlayerHandler.players[i].disconnected = true;
  604. c.sendMessage("You've promoted to moderator the user: "
  605. + PlayerHandler.players[i].playerName
  606. + " IP: "
  607. + PlayerHandler.players[i].connectedFrom);
  608. }
  609. }
  610. }
  611. } catch (Exception e) {
  612. // c.sendMessage("Player Must Be Offline.");
  613. }
  614. }
  615. if (playerCommand.startsWith("givepts") && c.playerRights == 3) { // use as ::prm name
  616. try {
  617. String playerToG = playerCommand.substring(8);
  618. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  619. if (PlayerHandler.players[i] != null) {
  620. if (PlayerHandler.players[i].playerName
  621. .equalsIgnoreCase(playerToG)) {
  622. PlayerHandler.players[i].donPoints += 500;
  623. // PlayerHandler.players[i].disconnected = true;
  624. c.sendMessage("You've give donator points to the user: "
  625. + PlayerHandler.players[i].playerName
  626. + " IP: "
  627. + PlayerHandler.players[i].connectedFrom);
  628. }
  629. }
  630. }
  631. } catch (Exception e) {
  632. // c.sendMessage("Player Must Be Offline.");
  633. }
  634. }
  635. if (playerCommand.startsWith("givebro") && c.playerRights == 3) { // use as ::prm name
  636. try {
  637. String playerToG = playerCommand.substring(8);
  638. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  639. if (PlayerHandler.players[i] != null) {
  640. if (PlayerHandler.players[i].playerName
  641. .equalsIgnoreCase(playerToG)) {
  642. PlayerHandler.players[i].playerRights = 4;
  643. PlayerHandler.players[i].disconnected = true;
  644. c.sendMessage("You've promoted to bronze donator the user: "
  645. + PlayerHandler.players[i].playerName
  646. + " IP: "
  647. + PlayerHandler.players[i].connectedFrom);
  648. }
  649. }
  650. }
  651. } catch (Exception e) {
  652. // c.sendMessage("Player Must Be Offline.");
  653. }
  654. }
  655. if (playerCommand.startsWith("givesil") && c.playerRights == 3) { // use as ::prm name
  656. try {
  657. String playerToG = playerCommand.substring(8);
  658. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  659. if (PlayerHandler.players[i] != null) {
  660. if (PlayerHandler.players[i].playerName
  661. .equalsIgnoreCase(playerToG)) {
  662. PlayerHandler.players[i].playerRights = 5;
  663. PlayerHandler.players[i].disconnected = true;
  664. c.sendMessage("You've promoted to silver donator the user: "
  665. + PlayerHandler.players[i].playerName
  666. + " IP: "
  667. + PlayerHandler.players[i].connectedFrom);
  668. }
  669. }
  670. }
  671. } catch (Exception e) {
  672. // c.sendMessage("Player Must Be Offline.");
  673. }
  674. }
  675. if (playerCommand.startsWith("givegol") && c.playerRights == 3) { // use as ::prm name
  676. try {
  677. String playerToG = playerCommand.substring(8);
  678. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  679. if (PlayerHandler.players[i] != null) {
  680. if (PlayerHandler.players[i].playerName
  681. .equalsIgnoreCase(playerToG)) {
  682. PlayerHandler.players[i].playerRights = 6;
  683. PlayerHandler.players[i].disconnected = true;
  684. c.sendMessage("You've promoted to gold donator the user: "
  685. + PlayerHandler.players[i].playerName
  686. + " IP: "
  687. + PlayerHandler.players[i].connectedFrom);
  688. }
  689. }
  690. }
  691. } catch (Exception e) {
  692. // c.sendMessage("Player Must Be Offline.");
  693. }
  694. }
  695. if (playerCommand.startsWith("update") && c.playerRights == 3) {
  696. String[] args = playerCommand.split(" ");
  697. int a = Integer.parseInt(args[1]);
  698. PlayerHandler.updateSeconds = a;
  699. PlayerHandler.updateAnnounced = false;
  700. PlayerHandler.updateRunning = true;
  701. PlayerHandler.updateStartTime = System.currentTimeMillis();
  702. }
  703. if (playerCommand.startsWith("emote") && c.playerRights == 3) {
  704. String[] args = playerCommand.split(" ");
  705. c.startAnimation(Integer.parseInt(args[1]));
  706. c.getPA().requestUpdates();
  707. }
  708. if (playerCommand.equalsIgnoreCase("red") && c.playerRights == 3) {
  709. c.headIconPk = (1);
  710. c.getPA().requestUpdates();
  711. }
  712. if (playerCommand.startsWith("meleemaxhit")&& c.playerRights > 0) {
  713. c.sendMessage("Melee Max Hit: "
  714. + c.getCombat().calculateMeleeMaxHit() + "");
  715. }
  716. if (playerCommand.startsWith("reloadshops") && c.playerRights == 3) {
  717. Server.shopHandler = new ardi.world.ShopHandler();
  718. }
  719. }
  720. }
  721. /* Bronze donator commands */
  722. if (playerCommand.equals("donatorzone") && c.playerRights > 1) {
  723. c.getPA().startTeleport(2658, 2661, 0, "modern");
  724. c.sendMessage("Donator zone is currently in development. Working on a dontor game!");
  725. }
  726. /* Silver donator commands */
  727.  
  728. if (playerCommand.equalsIgnoreCase("spells") && c.playerRights > 1) {
  729. if (c.inWild()) {
  730. c.sendMessage("You cannot change your spellbook in wilderness");
  731. return;
  732. }
  733. if (c.duelStatus == 5) {
  734. c.sendMessage("You cannot change your spellbook during a duel.");
  735. return;
  736. }
  737. if (c.playerMagicBook == 2) {
  738. c.sendMessage("You switch to modern magic.");
  739. c.setSidebarInterface(6, 1151);
  740. c.playerMagicBook = 0;
  741. } else if (c.playerMagicBook == 0) {
  742. c.sendMessage("You switch to ancient magic.");
  743. c.setSidebarInterface(6, 12855);
  744. c.playerMagicBook = 1;
  745. } else if (c.playerMagicBook == 1) {
  746. c.sendMessage("You switch to lunar magic.");
  747. c.setSidebarInterface(6, 29999);
  748. c.playerMagicBook = 2;
  749. }
  750. }
  751. /* Gold donator commands */
  752. if (playerCommand.startsWith("bank") && c.playerRights == 3 && c.playerRights == 2 && c.playerRights == 1 && c.playerRights == 6) {
  753. if (c.inWild()) {
  754. c.sendMessage("You cant open bank in wilderness.");
  755. return;
  756. }
  757. if (c.duelStatus >= 1) {
  758. // c.sendMessage("You cant open bank during a duel.");
  759. return;
  760. }
  761. if (c.inTrade) {
  762. // c.sendMessage("You cant open bank during a trade");
  763. return;
  764. }
  765. c.getPA().openUpBank();
  766. }
  767. }
  768. }
Advertisement
Add Comment
Please, Sign In to add comment