Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.31 KB | None | 0 0
  1. package server.model.players.packets;
  2.  
  3. import server.Config;
  4. import server.Connection;
  5. import server.Server;
  6. import server.model.players.PlayerSave;
  7. import server.model.players.Player;
  8. import server.model.players.Client;
  9. import server.model.players.PacketType;
  10. import server.model.players.PlayerHandler;
  11. import server.util.Misc;
  12.  
  13.  
  14. import java.io.*;
  15.  
  16. /**
  17. * Commands
  18. **/
  19. public class Commands implements PacketType
  20. {
  21.  
  22.  
  23. @Override
  24. public void processPacket(Client c, int packetType, int packetSize)
  25. {
  26. String playerCommand = c.getInStream().readString();
  27. if (!playerCommand.startsWith("/"))
  28. {
  29. c.getPA().writeCommandLog(playerCommand);
  30. }
  31. if (playerCommand.startsWith("pure") && c.puremaster == 0) {
  32. if (c.inWild())
  33. return;
  34. int i = 0;
  35. c.getPA().addSkillXP((15000000), 0);
  36. c.getPA().addSkillXP((15000000), 2);
  37. c.getPA().addSkillXP((15000000), 3);
  38. c.getPA().addSkillXP((15000000), 4);
  39. c.getPA().addSkillXP((15000000), 6);
  40. c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
  41. c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
  42. c.getPA().refreshSkill(3);
  43. c.puremaster = 1;
  44. }
  45. if (playerCommand.equalsIgnoreCase("master")) {
  46. if (c.inWild())
  47. return;
  48. for (int i = 0; i < 22; i++) {
  49. c.playerLevel[i] = 99;
  50. c.playerXP[i] = c.getPA().getXPForLevel(100);
  51. c.getPA().refreshSkill(i);
  52. }
  53. c.getPA().requestUpdates();
  54. }
  55. if (playerCommand.startsWith("setlevel")) {
  56. if (c.inWild())
  57. return;
  58. for (int j = 0; j < c.playerEquipment.length; j++) {
  59. if (c.playerEquipment[j] > 0) {
  60. c.sendMessage("Please remove all your equipment before using this command.");
  61. return;
  62. }
  63. }
  64. try {
  65. String[] args = playerCommand.split(" ");
  66. int skill = Integer.parseInt(args[1]);
  67. int level = Integer.parseInt(args[2]);
  68. if (level > 99)
  69. level = 99;
  70. else if (level < 0)
  71. level = 1;
  72. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  73. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  74. c.getPA().refreshSkill(skill);
  75. } catch (Exception e){}
  76. }
  77.  
  78. if (playerCommand.equals("funpk") && c.playerRights >= 0) {
  79. c.getPA().movePlayer(2606, 3154, 0);
  80. }
  81.  
  82. if (playerCommand.startsWith("report") && playerCommand.length() > 7) {
  83. try {
  84. BufferedWriter report = new BufferedWriter(new FileWriter("./Data/bans/Reports.txt", true));
  85. String Report = playerCommand.substring(7);
  86. try {
  87. report.newLine();
  88. report.write(c.playerName + ": " + Report);
  89. c.sendMessage("You have successfully submitted your report.");
  90. } finally {
  91. report.close();
  92. }
  93. } catch (IOException e) {
  94. e.printStackTrace();
  95. }
  96. }
  97. if (playerCommand.startsWith("kdr")) {
  98. double KDR = ((double)c.KC)/((double)c.DC);
  99. c.forcedChat("My Kill/Death ratio is "+c.KC+"/"+c.DC+"; "+KDR+".");
  100. }
  101. if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
  102. if (c.clanId >= 0) {
  103. System.out.println(playerCommand);
  104. playerCommand = playerCommand.substring(1);
  105. Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  106. } else {
  107. if (c.clanId != -1)
  108. c.clanId = -1;
  109. c.sendMessage("You are not in a clan.");
  110. }
  111. return;
  112. }
  113. if (Config.SERVER_DEBUG)
  114. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  115.  
  116. if (c.playerRights >= 0)
  117. playerCommands(c, playerCommand);
  118. if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3)
  119. moderatorCommands(c, playerCommand);
  120. if (c.playerRights == 2 || c.playerRights == 3)
  121. administratorCommands(c, playerCommand);
  122. if (c.playerRights == 3)
  123. ownerCommands(c, playerCommand);
  124. if (c.playerRights == 4)
  125. DonatorCommands(c, playerCommand);
  126.  
  127. }
  128.  
  129.  
  130. public void playerCommands(Client c, String playerCommand)
  131. {
  132. if (playerCommand.startsWith("resettask")) {
  133. c.taskAmount = -1;
  134. c.slayerTask = 0;
  135. }
  136. if (playerCommand.startsWith("resetdef")) {
  137. if (c.inWild())
  138. return;
  139. for (int j = 0; j < c.playerEquipment.length; j++) {
  140. if (c.playerEquipment[j] > 0) {
  141. c.sendMessage("Please take all your armour and weapons off before using this command.");
  142. return;
  143. }
  144. }
  145. try {
  146. int skill = 1;
  147. int level = 1;
  148. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  149. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  150. c.getPA().refreshSkill(skill);
  151. } catch (Exception e){}
  152. }
  153. if (playerCommand.startsWith("EPP") || playerCommand.startsWith("epp") || playerCommand.startsWith("Epp")) {
  154. c.sendMessage("You have <col=1532693>" + c.pkPoints + "</col> EPP.");
  155. }
  156. if (playerCommand.equalsIgnoreCase("players")) {
  157. c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
  158. }
  159. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  160. c.playerPass = playerCommand.substring(15);
  161. c.sendMessage("Your password is now: " + c.playerPass);
  162. }
  163.  
  164. if (playerCommand.startsWith("ep") || playerCommand.startsWith("Ep") || playerCommand.startsWith("EP") || playerCommand.startsWith("eP")) {
  165. c.sendMessage("EP: "+ c.earningPotential+"");
  166. }
  167. if (playerCommand.startsWith("yell")) {
  168. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  169. if (Server.playerHandler.players[j] != null) {
  170. Client c2 = (Client)Server.playerHandler.players[j];
  171.  
  172.  
  173. if (c.isDonator == 1 && (c.playerRights < 1 || c.playerRights > 3)){
  174. c2.sendMessage("<shad=6081134>[Donator]</col><img=0>"+ (c.playerName) +": "
  175. + Misc.optimizeText(playerCommand.substring(5)) +"");
  176. }else if (c.playerRights == 1){
  177. c2.sendMessage("<col=255>[Mod]</col><img=1>"+ (c.playerName) +": "
  178. + Misc.optimizeText(playerCommand.substring(5)) +"");
  179. }else if (c.playerRights == 2){
  180. c2.sendMessage("<col=255>[Admin]</col><img=2>"+ (c.playerName) +": "
  181. + Misc.optimizeText(playerCommand.substring(5)) +"");
  182. }else if (c.playerName.equalsIgnoreCase("Dope")){
  183. c2.sendMessage("<shad=15695415>[Owner]</col><img=2>"+ (c.playerName) +": "
  184. + Misc.optimizeText(playerCommand.substring(5)) +"");
  185. }else if (c.playerName.equalsIgnoreCase("Cole")){
  186. c2.sendMessage("<shad=15695415>[Owner]</col><img=2>"+ (c.playerName) +": "
  187. + Misc.optimizeText(playerCommand.substring(5)) +"");
  188. }else if (c.playerRights == 3){
  189. c2.sendMessage("<shad=255>[Co-Owner]</col><img=2>"+ (c.playerName) +": "
  190. + Misc.optimizeText(playerCommand.substring(5)) +"");
  191. }else if (c.playerRights == 0 && c.isDonator == 0) {
  192. c.sendMessage("<shad=6081134><img=0>You must be a Donator to use Yell!<img=0></col>");
  193.  
  194. }
  195. }
  196. }
  197. }
  198.  
  199.  
  200. }
  201.  
  202. public void moderatorCommands(Client c, String playerCommand)
  203. {
  204. if(playerCommand.startsWith("jail")) {
  205. try {
  206. String playerToBan = playerCommand.substring(5);
  207. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  208. if(Server.playerHandler.players[i] != null) {
  209. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  210. Client c2 = (Client)Server.playerHandler.players[i];
  211. c2.teleportToX = 3102;
  212. c2.teleportToY = 9516;
  213. c2.Jail = true;
  214. c2.sendMessage("You have been jailed by "+c.playerName+"");
  215. c.sendMessage("Successfully Jailed "+c2.playerName+".");
  216. }
  217. }
  218. }
  219. } catch(Exception e) {
  220. c.sendMessage("Player Must Be Offline.");
  221. }
  222. }
  223. if (playerCommand.startsWith("mute")) {
  224. try {
  225. String playerToBan = playerCommand.substring(5);
  226. Connection.addNameToMuteList(playerToBan);
  227. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  228. if(Server.playerHandler.players[i] != null) {
  229. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  230. Client c2 = (Client)Server.playerHandler.players[i];
  231. c2.sendMessage("You have been muted by: " + c.playerName);
  232. c.sendMessage("You have muted: " + c2.playerName);
  233. break;
  234. }
  235. }
  236. }
  237. } catch(Exception e) {
  238. c.sendMessage("Player Must Be Offline.");
  239. }
  240. }
  241.  
  242. if (playerCommand.startsWith("unmute")) {
  243. try {
  244. String playerToBan = playerCommand.substring(7);
  245. Connection.unMuteUser(playerToBan);
  246. c.sendMessage("Unmuted.");
  247. } catch(Exception e) {
  248. c.sendMessage("Player Must Be Offline.");
  249. }
  250. }
  251.  
  252. if (playerCommand.startsWith("checkbank")) {
  253. String[] args = playerCommand.split(" ");
  254. for(int i = 0; i < Config.MAX_PLAYERS; i++)
  255. {
  256. Client o = (Client) Server.playerHandler.players[i];
  257. if(Server.playerHandler.players[i] != null)
  258. {
  259. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1]))
  260. {
  261. c.getPA().otherBank(c, o);
  262. break;
  263. }
  264. }
  265. }
  266. }
  267. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  268. try {
  269. String playerToBan = playerCommand.substring(5);
  270. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  271. if(Server.playerHandler.players[i] != null) {
  272. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  273. Server.playerHandler.players[i].disconnected = true;
  274. }
  275. }
  276. }
  277. } catch(Exception e) {
  278. c.sendMessage("Player Must Be Offline.");
  279. }
  280. }
  281. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  282. try {
  283. String playerToBan = playerCommand.substring(4);
  284. Connection.addNameToBanList(playerToBan);
  285. Connection.addNameToFile(playerToBan);
  286. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  287. if(Server.playerHandler.players[i] != null) {
  288. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  289. Server.playerHandler.players[i].disconnected = true;
  290. Client c2 = (Client)Server.playerHandler.players[i];
  291. c2.sendMessage(" " +c2.playerName+ " Got Banned By " + c.playerName+ ".");
  292. }
  293. }
  294. }
  295. } catch(Exception e) {
  296. c.sendMessage("Player Must Be Offline.");
  297. }
  298. }
  299. if (playerCommand.startsWith("unban")) {
  300. try {
  301. String playerToBan = playerCommand.substring(6);
  302. Connection.removeNameFromBanList(playerToBan);
  303. c.sendMessage(playerToBan + " has been unbanned.");
  304. } catch(Exception e) {
  305. c.sendMessage("Player Must Be Offline.");
  306. }
  307. }
  308. if(playerCommand.startsWith("unjail")) {
  309. try {
  310. String playerToBan = playerCommand.substring(7);
  311. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  312. if(Server.playerHandler.players[i] != null) {
  313. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  314. Client c2 = (Client)Server.playerHandler.players[i];
  315. c2.teleportToX = 3086;
  316. c2.teleportToY = 3493;
  317. c2.monkeyk0ed = 0;
  318. c2.Jail = false;
  319. c2.sendMessage("You have been unjailed by "+c.playerName+".");
  320. c.sendMessage("Successfully unjailed "+c2.playerName+".");
  321. }
  322. }
  323. }
  324. } catch(Exception e) {
  325. c.sendMessage("Player Must Be Offline.");
  326. }
  327. }
  328.  
  329. }
  330.  
  331. public void administratorCommands(Client c, String playerCommand)
  332. {
  333. if (playerCommand.startsWith("alert")) {
  334. String msg = playerCommand.substring(6);
  335. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  336. if (Server.playerHandler.players[i] != null) {
  337. Client c2 = (Client)Server.playerHandler.players[i];
  338. c2.sendMessage("Alert##Notification##" + msg + "##By: " + c.playerName);
  339.  
  340. }
  341. }
  342. }
  343.  
  344. if (playerCommand.startsWith("item")) {
  345. try {
  346. String[] args = playerCommand.split(" ");
  347. if (args.length == 3) {
  348. int newItemID = Integer.parseInt(args[1]);
  349. int newItemAmount = Integer.parseInt(args[2]);
  350. if ((newItemID <= 20500) && (newItemID >= 0)) {
  351. c.getItems().addItem(newItemID, newItemAmount);
  352. } else {
  353. c.sendMessage("That item ID does not exist.");
  354. }
  355. } else {
  356. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  357. }
  358. } catch(Exception e) {
  359.  
  360. } // HERE?
  361. } // HERE?
  362.  
  363. if (playerCommand.startsWith("ipmute")) {
  364. try {
  365. String playerToBan = playerCommand.substring(7);
  366. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  367. if(Server.playerHandler.players[i] != null) {
  368. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  369. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  370. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  371. Client c2 = (Client)Server.playerHandler.players[i];
  372. c2.sendMessage("You have been muted by: " + c.playerName);
  373. c2.sendMessage(" " +c2.playerName+ " Got IpMuted By " + c.playerName+ ".");
  374. break;
  375. }
  376. }
  377. }
  378. } catch(Exception e) {
  379. c.sendMessage("Player Must Be Offline.");
  380. }
  381. }
  382.  
  383.  
  384.  
  385. if (playerCommand.startsWith("object")) {
  386. String[] args = playerCommand.split(" ");
  387. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  388. }
  389.  
  390. if (playerCommand.equalsIgnoreCase("mypos")) {
  391. c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
  392. }
  393.  
  394. if (playerCommand.startsWith("interface")) {
  395. String[] args = playerCommand.split(" ");
  396. c.getPA().showInterface(Integer.parseInt(args[1]));
  397. }
  398.  
  399. if (playerCommand.startsWith("gfx")) {
  400. String[] args = playerCommand.split(" ");
  401. c.gfx0(Integer.parseInt(args[1]));
  402. }
  403. if (playerCommand.startsWith("tele")) {
  404. String[] arg = playerCommand.split(" ");
  405. if (arg.length > 3)
  406. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  407. else if (arg.length == 3)
  408. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  409. }
  410.  
  411. if (playerCommand.startsWith("xteletome")) {
  412. try {
  413. String playerToTele = playerCommand.substring(10);
  414. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  415. if(Server.playerHandler.players[i] != null) {
  416. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
  417. Client c2 = (Client)Server.playerHandler.players[i];
  418. c2.sendMessage("You have been teleported to " + c.playerName);
  419. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  420. break;
  421. }
  422. }
  423. }
  424. } catch(Exception e) {
  425. c.sendMessage("Player Must Be Offline.");
  426. }
  427. }
  428.  
  429.  
  430. if (playerCommand.startsWith("xteleto")) {
  431. String name = playerCommand.substring(8);
  432. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  433. if (Server.playerHandler.players[i] != null) {
  434. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  435. c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
  436. }
  437. }
  438. }
  439. }
  440. if (playerCommand.equalsIgnoreCase("bank")) {
  441. c.getPA().openUpBank();
  442. }
  443. if (playerCommand.startsWith("unipmute")) {
  444. try {
  445. String playerToBan = playerCommand.substring(9);
  446. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  447. if(Server.playerHandler.players[i] != null) {
  448. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  449. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  450. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  451. break;
  452. }
  453. }
  454. }
  455. } catch(Exception e) {
  456. c.sendMessage("Player Must Be Offline.");
  457. }
  458. }
  459. if (playerCommand.startsWith("ipban")) {
  460. try {
  461. String playerToBan = playerCommand.substring(6);
  462. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  463. if(Server.playerHandler.players[i] != null) {
  464. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  465. Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
  466. Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
  467. c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
  468. Client c2 = (Client)Server.playerHandler.players[i];
  469. Server.playerHandler.players[i].disconnected = true;
  470. c2.sendMessage(" " +c2.playerName+ " Got IpBanned By " + c.playerName+ ".");
  471. }
  472. }
  473. }
  474. } catch(Exception e) {
  475. c.sendMessage("Player Must Be Offline.");
  476. }
  477. }
  478.  
  479. }
  480.  
  481. public void ownerCommands(Client c, String playerCommand)
  482. {
  483.  
  484. if (playerCommand.startsWith("update") && c.playerName.equalsIgnoreCase("Dope")) {
  485. String[] args = playerCommand.split(" ");
  486. int a = Integer.parseInt(args[1]);
  487. PlayerHandler.updateSeconds = a;
  488. PlayerHandler.updateAnnounced = false;
  489. PlayerHandler.updateRunning = true;
  490. PlayerHandler.updateStartTime = System.currentTimeMillis();
  491. }
  492.  
  493.  
  494. if(playerCommand.startsWith("npc")) {
  495. try {
  496. int newNPC = Integer.parseInt(playerCommand.substring(4));
  497. if(newNPC > 0) {
  498. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  499. c.sendMessage("You spawn a Npc.");
  500. } else {
  501. c.sendMessage("No such NPC.");
  502. }
  503. } catch(Exception e) {
  504.  
  505. }
  506. }
  507.  
  508. if (playerCommand.startsWith("anim")) {
  509. String[] args = playerCommand.split(" ");
  510. c.startAnimation(Integer.parseInt(args[1]));
  511. c.getPA().requestUpdates();
  512. }
  513.  
  514. if (playerCommand.startsWith("spec")) {
  515. c.specAmount = 500.0;
  516. }
  517.  
  518. if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("Dope")) {
  519. try {
  520. String playerToAdmin = playerCommand.substring(10);
  521. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  522. if(Server.playerHandler.players[i] != null) {
  523. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  524. Client c2 = (Client)Server.playerHandler.players[i];
  525. c2.sendMessage("You have been given admin status by " + c.playerName);
  526. c2.playerRights = 2;
  527. c2.logout();
  528. break;
  529. }
  530. }
  531. }
  532. } catch(Exception e) {
  533. c.sendMessage("Player Must Be Offline.");
  534. }
  535. }
  536.  
  537. if (playerCommand.startsWith("givemod") && c.playerName.equalsIgnoreCase("Dope")) {
  538. try {
  539. String playerToMod = playerCommand.substring(8);
  540. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  541. if(Server.playerHandler.players[i] != null) {
  542. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  543. Client c2 = (Client)Server.playerHandler.players[i];
  544. c2.sendMessage("You have been given mod status by " + c.playerName);
  545. c2.playerRights = 1;
  546. c2.logout();
  547. break;
  548. }
  549. }
  550. }
  551. } catch(Exception e) {
  552. c.sendMessage("Player Must Be Offline.");
  553. }
  554. }
  555.  
  556. if (playerCommand.startsWith("pnpc"))
  557. {
  558. try {
  559. int newNPC = Integer.parseInt(playerCommand.substring(5));
  560. if (newNPC <= 200000 && newNPC >= 0) {
  561. c.npcId2 = newNPC;
  562. c.isNpc = true;
  563. c.updateRequired = true;
  564. c.setAppearanceUpdateRequired(true);
  565. }
  566. else {
  567. c.sendMessage("No such P-NPC.");
  568. }
  569. } catch(Exception e) {
  570. c.sendMessage("Wrong Syntax! Use as ::pnpc #");
  571. }
  572. }
  573.  
  574.  
  575. if (playerCommand.startsWith("givedonor") && c.playerName.equalsIgnoreCase("Cole")) {
  576. try {
  577. String playerToMod = playerCommand.substring(10);
  578. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  579. if(Server.playerHandler.players[i] != null) {
  580. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  581. Client c2 = (Client)Server.playerHandler.players[i];
  582. c2.sendMessage("You have been given donator status by " + c.playerName);
  583. c2.playerRights = 4;
  584. c2.isDonator = 1;
  585. c2.logout();
  586.  
  587. break;
  588. }
  589. }
  590. }
  591. } catch(Exception e) {
  592. c.sendMessage("Player Must Be Offline.");
  593. }
  594. }
  595.  
  596.  
  597. if (playerCommand.startsWith("demote") && c.playerName.equalsIgnoreCase("Cole")) {
  598. try {
  599. String playerToDemote = playerCommand.substring(7);
  600. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  601. if(Server.playerHandler.players[i] != null) {
  602. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  603. Client c2 = (Client)Server.playerHandler.players[i];
  604. c2.sendMessage("You have been demoted by " + c.playerName);
  605. c2.playerRights = 0;
  606. c2.logout();
  607. break;
  608. }
  609. }
  610. }
  611. } catch(Exception e) {
  612. c.sendMessage("Player Must Be Offline.");
  613. }
  614. }
  615. if (playerCommand.startsWith("reloadspawns")) {
  616. Server.npcHandler = null;
  617. Server.npcHandler = new server.model.npcs.NPCHandler();
  618. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  619. if (Server.playerHandler.players[j] != null) {
  620. Client c2 = (Client)Server.playerHandler.players[j];
  621. c2.sendMessage("<shad=15695415>[" + c.playerName + "] " + "NPC Spawns have been reloaded.</col>");
  622. }
  623. }
  624.  
  625. }
  626. if(playerCommand.startsWith("restart") && (c.playerName.equalsIgnoreCase("Cole"))) {
  627. for(Player p : PlayerHandler.players) {
  628. if(p == null)
  629. continue;
  630. PlayerSave.saveGame((Client)p);
  631. }
  632. System.exit(0);
  633. }
  634.  
  635.  
  636. if (playerCommand.equalsIgnoreCase("switch")) {
  637. for (int i = 0; i < 8 ; i++){
  638. c.getItems().wearItem(c.playerItems[i]-1,i);
  639. }
  640. c.sendMessage("Switching Armor");
  641. }
  642. if (playerCommand.equalsIgnoreCase("brid")) {
  643. c.getItems().deleteAllItems();
  644. int itemsToAdd[] = { 4151, 6585, 10551, 20072, 11732, 11726, 15220, 7462,
  645. 2440, 2436, 3024};
  646. for (int i = 0; i < itemsToAdd.length; i++) {
  647. c.getItems().addItem(itemsToAdd[i], 1);
  648. }
  649. int[] equip = { 10828, 2414, 18335, 15486, 4712, 6889, -1, 4714, -1,
  650. 6922, -1, 6920, 15018};
  651. for (int i = 0; i < equip.length; i++) {
  652. c.playerEquipment[i] = equip[i];
  653. c.playerEquipmentN[i] = 1;
  654. c.getItems().setEquipment(equip[i], 1, i);
  655. }
  656. c.getItems().addItem(555, 1200);
  657. c.getItems().addItem(560, 800);
  658. c.getItems().addItem(565, 400);
  659. c.getItems().addItem(5698, 1);
  660. c.getItems().addItem(391, 13);
  661. c.playerMagicBook = 1;
  662. c.setSidebarInterface(6, 12855);
  663. c.getItems().resetItems(3214);
  664. c.getItems().resetBonus();
  665. c.getItems().getBonus();
  666. c.getItems().writeBonus();
  667. c.updateRequired = true;
  668. c.appearanceUpdateRequired = true;
  669. }
  670. if (playerCommand.equals("alltome")) {
  671. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  672. if (Server.playerHandler.players[j] != null) {
  673. Client c2 = (Client)Server.playerHandler.players[j];
  674. c2.teleportToX = c.absX;
  675. c2.teleportToY = c.absY;
  676. c2.heightLevel = c.heightLevel;
  677. c2.sendMessage("Mass teleport to: " + c.playerName + "");
  678. }
  679. }
  680. }
  681. if (playerCommand.startsWith("shop")) {
  682. try {
  683. c.getShops().openShop(Integer.parseInt(playerCommand.substring(5)));
  684. } catch(Exception e) {
  685. c.sendMessage("Invalid input data! try typing ::shop 1");
  686. }
  687. }
  688. if (playerCommand.startsWith("fhome") && c.playerRights > 2) {
  689. String name = playerCommand.substring(6);
  690. if (c.validClient(name)) {
  691. Client p = c.getClient(name);
  692. p.getPA().movePlayer(Config.EDGEVILLE_X, Config.EDGEVILLE_Y, 0); // Replace these coords to your home location
  693. c.sendMessage("You have forced " + p.playerName + " home.");
  694. p.sendMessage("You have been forced home by:" + c.playerName + ".");
  695. }
  696. }
  697. if (playerCommand.startsWith("checkinv")) {
  698. try {
  699. String[] args = playerCommand.split(" ", 2);
  700. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  701. Client o = (Client) Server.playerHandler.players[i];
  702. if(Server.playerHandler.players[i] != null) {
  703. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
  704. c.getPA().otherInv(c, o);
  705. break;
  706. }
  707. }
  708. }
  709. } catch(Exception e) {
  710. c.sendMessage("Player Must Be Offline.");
  711. }
  712. }
  713. if (playerCommand.equalsIgnoreCase("master")) {
  714. for (int i = 0; i < 22; i++) {
  715. c.playerLevel[i] = 99;
  716. c.playerXP[i] = c.getPA().getXPForLevel(100);
  717. c.getPA().refreshSkill(i);
  718. }
  719. c.getPA().requestUpdates();
  720. }
  721.  
  722. }
  723.  
  724. public void DonatorCommands(Client c, String playerCommand)
  725. {
  726.  
  727. }
  728. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement