Guest User

Untitled

a guest
Jan 5th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.25 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. if (c.playerRights > 1){
  120. if (playerCommand.startsWith("resettask")) {
  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. if (playerCommand.equalsIgnoreCase("skull")) {
  127. c.isSkulled = true;
  128. c.skullTimer = Config.SKULL_TIMER;
  129. c.headIconPk = 0;
  130. c.getPA().requestUpdates();
  131. }
  132. if (c.playerRights > 0 ) {
  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) {
  177. if (playerCommand.equals("staffzone")) {
  178. c.getPA().startTeleport(2912, 5475, 0, "modern");
  179. }
  180. }
  181. /* Moderator Commands */
  182. if (c.playerRights == 1 || c.playerName.equalsIgnoreCase("")) {
  183. if (playerCommand.startsWith("modcommands")) {
  184. c.sendMessage("::xteleto ::teletome ::kick ::mute ::unmute ::jail ::unjail");
  185. c.sendMessage("::bank ::spells ::dz ::staffzone");
  186. }
  187. if (playerCommand.startsWith("kick")) {
  188. try {
  189. String playerToBan = playerCommand.substring(5);
  190. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  191. if (PlayerHandler.players[i] != null) {
  192. if (PlayerHandler.players[i].playerName
  193. .equalsIgnoreCase(playerToBan)) {
  194. Client c2 = (Client) PlayerHandler.players[i];
  195. if (c2.inWild()) {
  196. c.sendMessage("You cannot kick a player when he is in wilderness.");
  197. return;
  198. }
  199. if (c2.duelStatus == 5) {
  200. c.sendMessage("You cant kick a player while he is during a duel");
  201. return;
  202. }
  203. PlayerHandler.players[i].disconnected = true;
  204. }
  205. }
  206. }
  207. } catch (Exception e) {
  208. c.sendMessage("Player Must Be Offline.");
  209. }
  210. }
  211. if (playerCommand.startsWith("mute")) {
  212. try {
  213. String playerToBan = playerCommand.substring(5);
  214. Connection.addNameToMuteList(playerToBan);
  215. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  216. if (PlayerHandler.players[i] != null) {
  217. if (PlayerHandler.players[i].playerName
  218. .equalsIgnoreCase(playerToBan)) {
  219. Client c2 = (Client) PlayerHandler.players[i];
  220. c2.sendMessage("You have been muted by: "
  221. + c.playerName);
  222. break;
  223. }
  224. }
  225. }
  226. } catch (Exception e) {
  227. c.sendMessage("Player Must Be Offline.");
  228. }
  229. }
  230. if (playerCommand.startsWith("unmute")) {
  231. try {
  232. String playerToBan = playerCommand.substring(7);
  233. Connection.unMuteUser(playerToBan);
  234. } catch (Exception e) {
  235. c.sendMessage("Player Must Be Offline.");
  236. }
  237. }
  238. if (playerCommand.startsWith("jail")) {
  239. try {
  240. String playerToBan = playerCommand.substring(5);
  241. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  242. if (PlayerHandler.players[i] != null) {
  243. if (PlayerHandler.players[i].playerName
  244. .equalsIgnoreCase(playerToBan)) {
  245. Client c2 = (Client) PlayerHandler.players[i];
  246. if (c2.inWild()) {
  247. c.sendMessage("You cant jail a player while he is in the wilderness.");
  248. return;
  249. }
  250. if (c2.duelStatus == 5) {
  251. c.sendMessage("You cant jail a player when he is during a duel.");
  252. return;
  253. }
  254. c2.teleportToX = 2095;
  255. c2.teleportToY = 4428;
  256. c2.sendMessage("You have been jailed by "
  257. + c.playerName + " .");
  258. c.sendMessage("Successfully Jailed "
  259. + c2.playerName + ".");
  260. }
  261. }
  262. }
  263. } catch (Exception e) {
  264. c.sendMessage("Player Must Be Offline.");
  265. }
  266. }
  267.  
  268. if (playerCommand.startsWith("unjail")) {
  269. try {
  270. String playerToBan = playerCommand.substring(7);
  271. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  272. if (PlayerHandler.players[i] != null) {
  273. if (PlayerHandler.players[i].playerName
  274. .equalsIgnoreCase(playerToBan)) {
  275. Client c2 = (Client) PlayerHandler.players[i];
  276. if (c2.inWild()) {
  277. c.sendMessage("This player is in the wilderness, not in jail.");
  278. return;
  279. }
  280. if (c2.duelStatus == 5 || c2.inDuelArena()) {
  281. c.sendMessage("This player is during a duel, and not in jail.");
  282. return;
  283. }
  284. c2.teleportToX = 3093;
  285. c2.teleportToY = 3493;
  286. c2.sendMessage("You have been unjailed by "
  287. + c.playerName
  288. + ". You can now teleport.");
  289. c.sendMessage("Successfully unjailed "
  290. + c2.playerName + ".");
  291. }
  292. }
  293. }
  294. } catch (Exception e) {
  295. c.sendMessage("Player Must Be Offline.");
  296. }
  297. }
  298.  
  299. if (playerCommand.startsWith("timedmute") && c.playerRights >= 1
  300. && c.playerRights <= 3) {
  301.  
  302. try {
  303. String[] args = playerCommand.split("-");
  304. if (args.length < 2) {
  305. c.sendMessage("Currect usage: ::timedmute-playername-seconds");
  306. return;
  307. }
  308. String playerToMute = args[1];
  309. int muteTimer = Integer.parseInt(args[2]) * 1000;
  310.  
  311. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  312. if (PlayerHandler.players[i] != null) {
  313. if (PlayerHandler.players[i].playerName
  314. .equalsIgnoreCase(playerToMute)) {
  315. Client c2 = (Client) PlayerHandler.players[i];
  316. c2.sendMessage("You have been muted by: "
  317. + c.playerName + " for " + muteTimer
  318. / 1000 + " seconds");
  319. c2.muteEnd = System.currentTimeMillis()
  320. + muteTimer;
  321. break;
  322. }
  323. }
  324. }
  325.  
  326. } catch (Exception e) {
  327. c.sendMessage("Player Must Be Offline.");
  328. }
  329. }
  330. if (playerCommand.startsWith("teletome")) {
  331. try {
  332. String playerToBan = playerCommand.substring(9);
  333. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  334. if (PlayerHandler.players[i] != null) {
  335. if (PlayerHandler.players[i].playerName
  336. .equalsIgnoreCase(playerToBan)) {
  337. Client c2 = (Client) PlayerHandler.players[i];
  338. if (c2.inWild()) {
  339. c.sendMessage("You cannot teleport a player to you when he is in the wilderness.");
  340. return;
  341. }
  342. if (c2.duelStatus == 5) {
  343. c.sendMessage("You cannot teleport a player to you when he is during a duel.");
  344. return;
  345. }
  346. if (c.inWild()) {
  347. c.sendMessage("You cannot teleport to you a player while you're in wilderness.");
  348. return;
  349. }
  350. c2.teleportToX = c.absX;
  351. c2.teleportToY = c.absY;
  352. c2.heightLevel = c.heightLevel;
  353. c.sendMessage("You have teleported "
  354. + c2.playerName + " to you.");
  355. c2.sendMessage("You have been teleported to "
  356. + c.playerName + "");
  357. }
  358. }
  359. }
  360. } catch (Exception e) {
  361. c.sendMessage("Player Must Be Offline.");
  362. }
  363. }
  364. if (playerCommand.startsWith("xteleto")) {
  365. String name = playerCommand.substring(8);
  366. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  367. if (PlayerHandler.players[i] != null) {
  368. if (PlayerHandler.players[i].playerName
  369. .equalsIgnoreCase(name)) {
  370. Client c2 = (Client) PlayerHandler.players[i];
  371. if (c2.inWild()) {
  372. c.sendMessage("The player you tried teleporting to is in the wilderness.");
  373. return;
  374. }
  375. if (c.inWild()) {
  376. c.sendMessage("You cannot teleport to a player while you're in the wilderness");
  377. return;
  378. }
  379. if (c.duelStatus == 5) {
  380. c.sendMessage("You cannot teleport to a player during a duel.");
  381. return;
  382. }
  383. c.getPA().movePlayer(
  384. PlayerHandler.players[i].getX(),
  385. PlayerHandler.players[i].getY(),
  386. c.heightLevel);
  387. }
  388. }
  389. }
  390. }
  391. }
  392. /* Ardi Commands */
  393. if (playerCommand.startsWith("title") && c.playerRights == 3) {
  394. try {
  395. final String[] args = playerCommand.split("-");
  396. c.playerTitle = args[1];
  397. String color = args[2].toLowerCase();
  398. if (color.equals("orange"))
  399. c.titleColor = 0;
  400. if (color.equals("purple"))
  401. c.titleColor = 1;
  402. if (color.equals("red"))
  403. c.titleColor = 2;
  404. if (color.equals("green"))
  405. c.titleColor = 3;
  406. c.sendMessage("You succesfully changed your title.");
  407. c.updateRequired = true;
  408. c.setAppearanceUpdateRequired(true);
  409. } catch (final Exception e) {
  410. c.sendMessage("Use as ::title-[title]-[color]");
  411. }
  412. }
  413. if (playerCommand.startsWith("getip") && playerCommand.length() > 6) {
  414. String name = playerCommand.substring(6);
  415. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  416. if (PlayerHandler.players[i] != null) {
  417. if (PlayerHandler.players[i].playerName
  418. .equalsIgnoreCase(name)) {
  419. c.sendMessage(PlayerHandler.players[i].playerName
  420. + " ip is "
  421. + PlayerHandler.players[i].connectedFrom);
  422. return;
  423. }
  424. }
  425. }
  426. }
  427. if (playerCommand.startsWith("sendhome")) {
  428. try {
  429. String playerToBan = playerCommand.substring(9);
  430. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  431. if (PlayerHandler.players[i] != null) {
  432. if (PlayerHandler.players[i].playerName
  433. .equalsIgnoreCase(playerToBan)) {
  434. Client c2 = (Client) PlayerHandler.players[i];
  435. c2.teleportToX = 3212;
  436. c2.teleportToY = 3429;
  437. c2.heightLevel = c.heightLevel;
  438. c.sendMessage("You have teleported "
  439. + c2.playerName + " to home");
  440. c2.sendMessage("You have been teleported to home");
  441. }
  442. }
  443. }
  444. } catch (Exception e) {
  445. c.sendMessage("Player Must Be Offline.");
  446. }
  447. }
  448. if (playerCommand.startsWith("teletome")) {
  449. try {
  450. String playerToBan = playerCommand.substring(9);
  451. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  452. if (PlayerHandler.players[i] != null) {
  453. if (PlayerHandler.players[i].playerName
  454. .equalsIgnoreCase(playerToBan)) {
  455. Client c2 = (Client) PlayerHandler.players[i];
  456. c2.teleportToX = c.absX;
  457. c2.teleportToY = c.absY;
  458. c2.heightLevel = c.heightLevel;
  459. c.sendMessage("You have teleported "
  460. + c2.playerName + " to you.");
  461. c2.sendMessage("You have been teleported to "
  462. + c.playerName + "");
  463. }
  464. }
  465. }
  466. } catch (Exception e) {
  467. c.sendMessage("Player Must Be Offline.");
  468. }
  469. if (playerCommand.startsWith("xteleto")) {
  470. String name = playerCommand.substring(8);
  471. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  472. if (PlayerHandler.players[i] != null) {
  473. if (PlayerHandler.players[i].playerName
  474. .equalsIgnoreCase(name)) {
  475. Client c2 = (Client) PlayerHandler.players[i];
  476. c.getPA().movePlayer(
  477. PlayerHandler.players[i].getX(),
  478. PlayerHandler.players[i].getY(),
  479. c.heightLevel);
  480. }
  481. }
  482. }
  483. }
  484. if (playerCommand.startsWith("tele")) {
  485. String[] arg = playerCommand.split(" ");
  486. if (arg.length > 3)
  487. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  488. Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  489. else if (arg.length == 3)
  490. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  491. Integer.parseInt(arg[2]), c.heightLevel);
  492. }
  493. if (playerCommand.startsWith("getid")) {
  494. String a[] = playerCommand.split(" ");
  495. String name = "";
  496. int results = 0;
  497. for (int i = 1; i < a.length; i++)
  498. name = name + a[i] + " ";
  499. name = name.substring(0, name.length() - 1);
  500. c.sendMessage("Searching: " + name);
  501. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  502. if (Server.itemHandler.ItemList[j] != null)
  503. if (Server.itemHandler.ItemList[j].itemName
  504. .replace("_", " ").toLowerCase()
  505. .contains(name.toLowerCase())) {
  506. c.sendMessage("@red@"
  507. + Server.itemHandler.ItemList[j].itemName
  508. .replace("_", " ") + " - "
  509. + Server.itemHandler.ItemList[j].itemId);
  510. results++;
  511. }
  512. }
  513.  
  514. c.sendMessage(results + " results found...");
  515. }
  516. if (playerCommand.startsWith("mute")) {
  517. try {
  518. String playerToBan = playerCommand.substring(5);
  519. Connection.addNameToMuteList(playerToBan);
  520. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  521. if (PlayerHandler.players[i] != null) {
  522. if (PlayerHandler.players[i].playerName
  523. .equalsIgnoreCase(playerToBan)) {
  524. Client c2 = (Client) PlayerHandler.players[i];
  525. c2.sendMessage("You have been muted by: "
  526. + c.playerName);
  527. break;
  528. }
  529. }
  530. }
  531. } catch (Exception e) {
  532. c.sendMessage("Player Must Be Offline.");
  533. }
  534. if (playerCommand.startsWith("unmute")) {
  535. try {
  536. String playerToBan = playerCommand.substring(7);
  537. Connection.unMuteUser(playerToBan);
  538. } catch (Exception e) {
  539. c.sendMessage("Player Must Be Offline.");
  540. }
  541. if (c.playerRights == 3 && c.playerRights > 5) {
  542. if (playerCommand.startsWith("item")) {
  543. try {
  544. String[] args = playerCommand.split(" ");
  545. if (args.length == 3) {
  546. int newItemID = Integer.parseInt(args[1]);
  547. int newItemAmount = Integer.parseInt(args[2]);
  548. if ((newItemID <= 20200) && (newItemID >= 0)) {
  549. c.getItems().addItem(newItemID, newItemAmount);
  550. } else {
  551. c.sendMessage("No such item.");
  552. }
  553. } else {
  554. c.sendMessage("Use as ::pickup 995 200");
  555. }
  556. } catch (Exception e) {
  557.  
  558. }
  559. if (playerCommand.equalsIgnoreCase("mypos")) {
  560. c.sendMessage("X: " + c.absX);
  561. c.sendMessage("Y: " + c.absY);
  562. c.sendMessage("H: " + c.heightLevel);
  563. }
  564. if (c.playerRights == 3 && c.playerRights == 6) {
  565. if (playerCommand.equalsIgnoreCase("spec")) {
  566. if(c.specAmount < 10.0){
  567. if (c.specRestore > 0) return;
  568. c.specRestore = 300;
  569. c.specAmount = 10.0;
  570. c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
  571. c.sendMessage("Your special attack has been restored, only every 300 seconds.");
  572. }
  573. if (playerCommand.startsWith("npc")) {
  574. try {
  575. int newNPC = Integer.parseInt(playerCommand.substring(4));
  576. if (newNPC > 0) {
  577. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  578. 0, 0, 120, 7, 70, 70, false, false);
  579. c.sendMessage("You spawn a Npc.");
  580. } else {
  581. c.sendMessage("No such NPC.");
  582. }
  583. } catch (Exception e) {
  584. }
  585. if (playerCommand.startsWith("ipban")) {
  586. try {
  587. String playerToBan = playerCommand.substring(6);
  588. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  589. if (PlayerHandler.players[i] != null) {
  590. if (PlayerHandler.players[i].playerName
  591. .equalsIgnoreCase(playerToBan)) {
  592. if (c.playerName == PlayerHandler.players[i].playerName) {
  593. c.sendMessage("You cannot IP Ban yourself.");
  594. } else {
  595. if (!Connection
  596. .isIpBanned(PlayerHandler.players[i].connectedFrom)) {
  597. Connection
  598. .addIpToBanList(PlayerHandler.players[i].connectedFrom);
  599. Connection
  600. .addIpToFile(PlayerHandler.players[i].connectedFrom);
  601. c.sendMessage("You have IP banned the user: "
  602. + PlayerHandler.players[i].playerName
  603. + " with the host: "
  604. + PlayerHandler.players[i].connectedFrom);
  605. PlayerHandler.players[i].disconnected = true;
  606. } else {
  607. c.sendMessage("This user is already IP Banned.");
  608. }
  609. }
  610. }
  611. }
  612. }
  613. } catch (Exception e) {
  614. c.sendMessage("Player Must Be Offline.");
  615. }
  616. }
  617.  
  618. if (playerCommand.startsWith("info")) {
  619. String player = playerCommand.substring(5);
  620. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  621. if (PlayerHandler.players[i] != null) {
  622. if (PlayerHandler.players[i].playerName
  623. .equalsIgnoreCase(player)) {
  624. c.sendMessage("ip: "
  625. + PlayerHandler.players[i].connectedFrom);
  626. }
  627. }
  628. }
  629. if (playerCommand.startsWith("ban")) { // use as ::ban name
  630. try {
  631. String playerToBan = playerCommand.substring(4);
  632. Connection.addNameToBanList(playerToBan);
  633. Connection.addNameToFile(playerToBan);
  634. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  635. if (PlayerHandler.players[i] != null) {
  636. if (PlayerHandler.players[i].playerName
  637. .equalsIgnoreCase(playerToBan)) {
  638. PlayerHandler.players[i].disconnected = true;
  639. }
  640. }
  641. }
  642. } catch (Exception e) {
  643. c.sendMessage("Player Must Be Offline.");
  644. }
  645. }
  646.  
  647. if (playerCommand.startsWith("unban")) {
  648. try {
  649. String playerToBan = playerCommand.substring(6);
  650. Connection.removeNameFromBanList(playerToBan);
  651. c.sendMessage(playerToBan + " has been unbanned.");
  652. } catch (Exception e) {
  653. c.sendMessage("Player Must Be Offline.");
  654. }
  655. }
  656. if (playerCommand.startsWith("ipmute")) {
  657. try {
  658. String playerToBan = playerCommand.substring(7);
  659. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  660. if (PlayerHandler.players[i] != null) {
  661. if (PlayerHandler.players[i].playerName
  662. .equalsIgnoreCase(playerToBan)) {
  663. Connection
  664. .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  665. c.sendMessage("You have IP Muted the user: "
  666. + PlayerHandler.players[i].playerName);
  667. Client c2 = (Client) PlayerHandler.players[i];
  668. c2.sendMessage("You have been muted by: "
  669. + c.playerName);
  670. break;
  671. }
  672. }
  673. }
  674. } catch (Exception e) {
  675. c.sendMessage("Player Must Be Offline.");
  676. }
  677. }
  678. if (playerCommand.startsWith("unipmute")) {
  679. try {
  680. String playerToBan = playerCommand.substring(9);
  681. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  682. if (PlayerHandler.players[i] != null) {
  683. if (PlayerHandler.players[i].playerName
  684. .equalsIgnoreCase(playerToBan)) {
  685. Connection
  686. .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  687. c.sendMessage("You have Un Ip-Muted the user: "
  688. + PlayerHandler.players[i].playerName);
  689. break;
  690. }
  691. }
  692. }
  693. } catch (Exception e) {
  694. c.sendMessage("Player Must Be Offline.");
  695. }
  696. }
  697. if (playerCommand.startsWith("kick")) {
  698. try {
  699. String playerToBan = playerCommand.substring(5);
  700. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  701. if (PlayerHandler.players[i] != null) {
  702. if (PlayerHandler.players[i].playerName
  703. .equalsIgnoreCase(playerToBan)) {
  704. PlayerHandler.players[i].disconnected = true;
  705. }
  706. }
  707. }
  708. } catch (Exception e) {
  709. c.sendMessage("Player Must Be Offline.");
  710. }
  711. }
  712. if (playerCommand.startsWith("demoted")) { // use as ::prm name
  713. try {
  714. String playerToG = playerCommand.substring(8);
  715. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  716. if (PlayerHandler.players[i] != null) {
  717. if (PlayerHandler.players[i].playerName
  718. .equalsIgnoreCase(playerToG)) {
  719. PlayerHandler.players[i].playerRights = 0;
  720. PlayerHandler.players[i].disconnected = true;
  721. c.sendMessage("You've demoted the user: "
  722. + PlayerHandler.players[i].playerName
  723. + " IP: "
  724. + PlayerHandler.players[i].connectedFrom);
  725. }
  726. }
  727. }
  728. } catch (Exception e) {
  729. // c.sendMessage("Player Must Be Offline.");
  730. }
  731. }
  732. if (playerCommand.startsWith("givemod")) { // use as ::prm name
  733. try {
  734. String playerToG = playerCommand.substring(8);
  735. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  736. if (PlayerHandler.players[i] != null) {
  737. if (PlayerHandler.players[i].playerName
  738. .equalsIgnoreCase(playerToG)) {
  739. PlayerHandler.players[i].playerRights = 1;
  740. PlayerHandler.players[i].disconnected = true;
  741. c.sendMessage("You've promoted to moderator the user: "
  742. + PlayerHandler.players[i].playerName
  743. + " IP: "
  744. + PlayerHandler.players[i].connectedFrom);
  745. }
  746. }
  747. }
  748. } catch (Exception e) {
  749. // c.sendMessage("Player Must Be Offline.");
  750. }
  751. }
  752. if (playerCommand.startsWith("givepts")) { // use as ::prm name
  753. try {
  754. String playerToG = playerCommand.substring(8);
  755. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  756. if (PlayerHandler.players[i] != null) {
  757. if (PlayerHandler.players[i].playerName
  758. .equalsIgnoreCase(playerToG)) {
  759. PlayerHandler.players[i].donPoints += 500;
  760. // PlayerHandler.players[i].disconnected = true;
  761. c.sendMessage("You've give donator points to the user: "
  762. + PlayerHandler.players[i].playerName
  763. + " IP: "
  764. + PlayerHandler.players[i].connectedFrom);
  765. }
  766. }
  767. }
  768. } catch (Exception e) {
  769. // c.sendMessage("Player Must Be Offline.");
  770. }
  771. }
  772. if (playerCommand.startsWith("givebro")) { // use as ::prm name
  773. try {
  774. String playerToG = playerCommand.substring(8);
  775. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  776. if (PlayerHandler.players[i] != null) {
  777. if (PlayerHandler.players[i].playerName
  778. .equalsIgnoreCase(playerToG)) {
  779. PlayerHandler.players[i].playerRights = 4;
  780. PlayerHandler.players[i].disconnected = true;
  781. c.sendMessage("You've promoted to bronze donator the user: "
  782. + PlayerHandler.players[i].playerName
  783. + " IP: "
  784. + PlayerHandler.players[i].connectedFrom);
  785. }
  786. }
  787. }
  788. } catch (Exception e) {
  789. // c.sendMessage("Player Must Be Offline.");
  790. }
  791. }
  792. if (playerCommand.startsWith("givesil")) { // use as ::prm name
  793. try {
  794. String playerToG = playerCommand.substring(8);
  795. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  796. if (PlayerHandler.players[i] != null) {
  797. if (PlayerHandler.players[i].playerName
  798. .equalsIgnoreCase(playerToG)) {
  799. PlayerHandler.players[i].playerRights = 5;
  800. PlayerHandler.players[i].disconnected = true;
  801. c.sendMessage("You've promoted to silver donator the user: "
  802. + PlayerHandler.players[i].playerName
  803. + " IP: "
  804. + PlayerHandler.players[i].connectedFrom);
  805. }
  806. }
  807. }
  808. } catch (Exception e) {
  809. // c.sendMessage("Player Must Be Offline.");
  810. }
  811. }
  812. if (playerCommand.startsWith("givegol")) { // use as ::prm name
  813. try {
  814. String playerToG = playerCommand.substring(8);
  815. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  816. if (PlayerHandler.players[i] != null) {
  817. if (PlayerHandler.players[i].playerName
  818. .equalsIgnoreCase(playerToG)) {
  819. PlayerHandler.players[i].playerRights = 6;
  820. PlayerHandler.players[i].disconnected = true;
  821. c.sendMessage("You've promoted to gold donator the user: "
  822. + PlayerHandler.players[i].playerName
  823. + " IP: "
  824. + PlayerHandler.players[i].connectedFrom);
  825. }
  826. }
  827. }
  828. } catch (Exception e) {
  829. // c.sendMessage("Player Must Be Offline.");
  830. }
  831. if (playerCommand.startsWith("update")) {
  832. String[] args = playerCommand.split(" ");
  833. int a = Integer.parseInt(args[1]);
  834. PlayerHandler.updateSeconds = a;
  835. PlayerHandler.updateAnnounced = false;
  836. PlayerHandler.updateRunning = true;
  837. PlayerHandler.updateStartTime = System.currentTimeMillis();
  838. }
  839. if (playerCommand.startsWith("emote")) {
  840. String[] args = playerCommand.split(" ");
  841. c.startAnimation(Integer.parseInt(args[1]));
  842. c.getPA().requestUpdates();
  843. }
  844. if (playerCommand.equalsIgnoreCase("red")) {
  845. c.headIconPk = (1);
  846. c.getPA().requestUpdates();
  847. }
  848. if (playerCommand.startsWith("meleemaxhit")) {
  849. c.sendMessage("Melee Max Hit: "
  850. + c.getCombat().calculateMeleeMaxHit() + "");
  851. }
  852. if (playerCommand.startsWith("reloadshops")) {
  853. Server.shopHandler = new ardi.world.ShopHandler();
  854. }
  855. /* Bronze donator commands */
  856. if (c.playerRights > 1) {
  857. if (playerCommand.equals("donatorzone")) {
  858. c.getPA().startTeleport(2658, 2661, 0, "modern");
  859. c.sendMessage("Donator zone is currently in development. Working on a dontor game!");
  860. }
  861. /* Silver donator commands */
  862.  
  863. if (c.playerRights >= 1 && c.playerRights <= 6) {
  864. if (playerCommand.equalsIgnoreCase("spells")) {
  865. if (c.inWild()) {
  866. c.sendMessage("You cannot change your spellbook in wilderness");
  867. return;
  868. }
  869. if (c.duelStatus == 5) {
  870. c.sendMessage("You cannot change your spellbook during a duel.");
  871. return;
  872. }
  873. if (c.playerMagicBook == 2) {
  874. c.sendMessage("You switch to modern magic.");
  875. c.setSidebarInterface(6, 1151);
  876. c.playerMagicBook = 0;
  877. } else if (c.playerMagicBook == 0) {
  878. c.sendMessage("You switch to ancient magic.");
  879. c.setSidebarInterface(6, 12855);
  880. c.playerMagicBook = 1;
  881. } else if (c.playerMagicBook == 1) {
  882. c.sendMessage("You switch to lunar magic.");
  883. c.setSidebarInterface(6, 29999);
  884. c.playerMagicBook = 2;
  885. }
  886. /* Gold donator commands */
  887. if (c.playerRights == 3 && c.playerRights == 6) {
  888. if (playerCommand.startsWith("bank")) {
  889. if (c.inWild()) {
  890. c.sendMessage("You cant open bank in wilderness.");
  891. return;
  892. }
  893. if (c.duelStatus >= 1) {
  894. // c.sendMessage("You cant open bank during a duel.");
  895. return;
  896. }
  897. if (c.inTrade) {
  898. // c.sendMessage("You cant open bank during a trade");
  899. return;
  900. }
  901. c.getPA().openUpBank();
  902. }
  903. }
  904. }
  905. }
  906. }
  907. }
  908. }
  909. }
  910. }
  911. }
  912. }
  913. }
  914. }
  915. }
  916. }
  917. }
  918. }
  919. }
  920. }
Advertisement
Add Comment
Please, Sign In to add comment