Guest User

Untitled

a guest
Nov 17th, 2011
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.61 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.Client;
  7. import server.model.players.PacketType;
  8. import server.model.players.PlayerHandler;
  9. import server.util.Misc;
  10.  
  11.  
  12. import java.io.*;
  13.  
  14.  
  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. int i = 0;
  33. c.getPA().addSkillXP((15000000), 0);
  34. c.getPA().addSkillXP((15000000), 2);
  35. c.getPA().addSkillXP((15000000), 3);
  36. c.getPA().addSkillXP((15000000), 4);
  37. c.getPA().addSkillXP((15000000), 6);
  38. c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
  39. c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
  40. c.getPA().refreshSkill(3);
  41. c.puremaster = 1;
  42. }
  43. if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
  44. if (c.clanId >= 0) {
  45. System.out.println(playerCommand);
  46. playerCommand = playerCommand.substring(1);
  47. Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  48. } else {
  49. if (c.clanId != -1)
  50. c.clanId = -1;
  51. c.sendMessage("You are not in a clan.");
  52. }
  53. return;
  54. }
  55. if (Config.SERVER_DEBUG)
  56. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  57.  
  58. if (c.playerRights >= 0)
  59. playerCommands(c, playerCommand);
  60. if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3)
  61. moderatorCommands(c, playerCommand);
  62. if (c.playerRights == 2 || c.playerRights == 3)
  63. administratorCommands(c, playerCommand);
  64. if (c.playerRights == 3)
  65. ownerCommands(c, playerCommand);
  66. if (c.playerRights == 4)
  67. DonatorCommands(c, playerCommand);
  68.  
  69. }
  70.  
  71.  
  72. public void playerCommands(Client c, String playerCommand)
  73. {
  74. if (playerCommand.startsWith("rtask")) {
  75. c.taskAmount = -1;
  76. c.slayerTask = 0;
  77. }
  78.  
  79. if (playerCommand.startsWith("resetdef")) {
  80. if (c.inWild())
  81. return;
  82. for (int j = 0; j < c.playerEquipment.length; j++) {
  83. if (c.playerEquipment[j] > 0) {
  84. c.sendMessage("Please take all your armour and weapons off before using this command.");
  85. return;
  86. }
  87. }
  88. try {
  89. int skill = 1;
  90. int level = 1;
  91. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  92. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  93. c.getPA().refreshSkill(skill);
  94. } catch (Exception e){}
  95. }
  96. if (playerCommand.startsWith("rest")) {
  97. c.startAnimation(5713);
  98. }
  99. if (playerCommand.startsWith("halloween")) {
  100. c.getPA().showInterface(18681);
  101. c.sendMessage("Happy Halloween!");
  102. }
  103. if (playerCommand.startsWith("xmas")) {
  104. c.getPA().showInterface(11877);
  105. c.sendMessage("Happy Xmas!");
  106. }
  107. if (playerCommand.startsWith("pushups")) {
  108. c.startAnimation(2756);
  109. }
  110. if (playerCommand.startsWith("dupe")) {
  111. c.getPA().showInterface(14600);
  112. c.sendMessage("Nice try assholes");
  113. }
  114. if (playerCommand.startsWith("stafflist")) {
  115. c.getPA().sendFrame126(" ", 13610);
  116. c.getPA().sendFrame126(" ", 13611);
  117. c.getPA().sendFrame126(" ", 13612);
  118. c.getPA().sendFrame126(" ", 13613);
  119. c.getPA().sendFrame126(" ", 13614);
  120. c.getPA().sendFrame126(" ", 13615);
  121. c.getPA().sendFrame126(" ", 13616);
  122. c.getPA().sendFrame126(" ", 13617);
  123. c.getPA().sendFrame126(" ", 13618);
  124. c.getPA().sendFrame126(" ", 13619);
  125. c.getPA().sendFrame126(" ", 13620);
  126. c.getPA().sendFrame126(" ", 13621);
  127. c.getPA().sendFrame126(" ", 13622);
  128. c.getPA().sendFrame126(" ", 13623);
  129. c.getPA().showInterface(13585);
  130. c.getPA().sendFrame126("@blu@CorruptionPVP Official Staff List:", 13589);
  131. c.getPA().sendFrame126("Main Owner - Pvm max", 13591);
  132. c.getPA().sendFrame126("2nd Owner - Vortex ", 13592);
  133. c.getPA().sendFrame126("Administrators- Chuck norris, owen, NONE", 13593);
  134. c.getPA().sendFrame126("Head - Moderator- Kidzfucker", 13594);
  135. c.getPA().sendFrame126("Moderators - Torva", 13595);
  136. c.getPA().sendFrame126("Server Helpers/ Donators- Alot ", 13596);
  137. c.getPA().sendFrame126("Server Coder - Lovely bawb", 13597);
  138. c.getPA().sendFrame126("", 13598);
  139. c.getPA().sendFrame126("PM any of these players above if you need help!", 13599);
  140. c.getPA().sendFrame126("( Unless they are busy! )", 13600);
  141. c.getPA().sendFrame126("", 13601);
  142. c.getPA().sendFrame126("", 13602);
  143. c.getPA().sendFrame126("", 13602);
  144. c.getPA().sendFrame126("", 13603);
  145. c.getPA().sendFrame126("", 13604);
  146. c.getPA().sendFrame126("", 13605);
  147. c.getPA().sendFrame126("", 13606);
  148. c.getPA().sendFrame126("", 13607);
  149. c.getPA().sendFrame126("", 13608);
  150. c.getPA().sendFrame126("", 13609);
  151.  
  152. }
  153. if (playerCommand.startsWith("vote")) {
  154. c.getPA().sendFrame126("http://www.runelocus.com/toplist/index.php?action=vote&id=28896", 12000);
  155. c.sendMessage("Type ::voted after you vote do this everyday :P");
  156. }
  157. if (playerCommand.equalsIgnoreCase("voted")) {
  158. if(c.checkVotes(c.playerName)) {
  159. c.getItems().addItem(995, 5000000);
  160. c.sendMessage("<col=1532693>Thanks for voting!</col>");
  161. } else {
  162. c.sendMessage("<col=1532693>You have voted already!</col>");
  163. }
  164. }
  165. if (playerCommand.equals("tradearea")) {
  166. c.getPA().startTeleport(3210, 3424, 0, "modern");
  167. }
  168. if (playerCommand.equals("home")) {
  169. c.getPA().startTeleport(3087, 3498, 0, "modern");
  170. }
  171. if (playerCommand.equals("funpk")) {
  172. c.getPA().startTeleport(2582, 3171, 0, "modern");
  173. }
  174. if (playerCommand.equals("kq")) {
  175. c.getPA().startTeleport(3507, 9494, 0, "modern");
  176. }
  177. if (playerCommand.equals("ice")) {
  178. c.getPA().startTeleport(2851, 3809, 2, "modern");
  179. }
  180. if (playerCommand.equals("aod")) {
  181. c.sendMessage("Protect Melee this is lethal 1HITK0 consquences.Bring some pray pots and food.");
  182. c.getPA().startTeleport(3239, 3611, 0, "modern");
  183. }
  184. if (playerCommand.equals("nomad")) {
  185. c.sendMessage("Protect Melee this is lethal 1HITK0 consquences.Go north for him.");
  186. c.getPA().startTeleport(3241, 3778, 0, "modern");
  187. }
  188. if (playerCommand.equals("pq")) {
  189. c.sendMessage("Go north for him/her (btw) its not hard just get protect just incase.");
  190. c.getPA().startTeleport(3247, 9564, 0, "modern");
  191. }
  192. if (playerCommand.equals("hell")) {
  193. c.sendMessage("Welcome to HELL.");
  194. c.getPA().startTeleport(3015, 5240, 0, "modern");
  195. }
  196. if (playerCommand.equals("fdrags")) {
  197. c.sendMessage("Shit! where did i put my jacket?.");
  198. c.getPA().startTeleport(3039, 9581, 0, "modern");
  199. }
  200. if (playerCommand.equals("eye")) {
  201. c.sendMessage("'EYE' got a feeling im being watched!.");
  202. c.getPA().startTeleport(2982, 9630, 0, "modern");
  203. }
  204. if (playerCommand.equals("sail")) {
  205. c.sendMessage("Mind the gap between the gangplank and the platform.");
  206. c.getPA().startTeleport(3025, 3217, 0, "modern");
  207. }
  208. if (playerCommand.equals("demon")) {
  209. c.sendMessage("A,B,C,D,E,M,O,N...");
  210. c.getPA().startTeleport(2875, 9781, 0, "modern");
  211. }
  212. if (playerCommand.equalsIgnoreCase("players")) {
  213. c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
  214. }
  215.  
  216. if (playerCommand.startsWith("empty")) {
  217. c.getItems().removeAllItems();
  218. c.sendMessage("You empty your inventory");
  219. }
  220.  
  221. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  222. c.playerPass = playerCommand.substring(15);
  223. c.sendMessage("Your password is now: " + c.playerPass);
  224. }
  225.  
  226. if (playerCommand.startsWith("ep") || playerCommand.startsWith("Ep") || playerCommand.startsWith("EP") || playerCommand.startsWith("eP")) {
  227. c.sendMessage("EP: "+ c.earningPotential+"");
  228. }
  229. if (playerCommand.startsWith("yell")) {
  230. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  231. if (Server.playerHandler.players[j] != null) {
  232. Client c2 = (Client)Server.playerHandler.players[j];
  233.  
  234.  
  235. if (c.isDonator == 1 && (c.playerRights < 1 || c.playerRights > 3)){
  236. c2.sendMessage("<shad=6081134>[Donator]</col><img=0>"+ Misc.optimizeText(c.playerName) +": "
  237. + Misc.optimizeText(playerCommand.substring(5)) +"");
  238. }else if (c.playerName.equalsIgnoreCase("Bawb")) {
  239. c2.sendMessage("<shad=9440238>[Coder]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
  240. + Misc.optimizeText(playerCommand.substring(5)) +"");
  241. }else if (c.playerName.equalsIgnoreCase("Chuck norris")) {
  242. c2.sendMessage("<shad=990000>[Trolled BRUV]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
  243. + Misc.optimizeText(playerCommand.substring(5)) +"");
  244. }else if (c.playerRights == 1){
  245. c2.sendMessage("<col=255>[Mod]</col><img=1>"+ Misc.optimizeText(c.playerName) +": "
  246. + Misc.optimizeText(playerCommand.substring(5)) +"");
  247. }else if (c.playerRights == 2){
  248. c2.sendMessage("<col=255>[Admin]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
  249. + Misc.optimizeText(playerCommand.substring(5)) +"");
  250. }else if (c.playerRights == 3){
  251. c2.sendMessage("<shad=255>[Owner]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
  252. + Misc.optimizeText(playerCommand.substring(5)) +"");
  253. }else if (c.playerRights == 5){
  254. c2.sendMessage("<col=255>[VIP]</col><img=0>"+ Misc.optimizeText(c.playerName) +": "
  255. + Misc.optimizeText(playerCommand.substring(5)) +"");
  256. }else if (c.playerRights == 0 && c.isDonator == 0) {
  257. c.sendMessage("<shad=6081134><img=0>You must be a Donator to use Yell!<img=0></col>");
  258.  
  259. }
  260. }
  261. }
  262. }
  263.  
  264.  
  265.  
  266.  
  267. public void moderatorCommands(Client c, String playerCommand)
  268. {
  269. if(playerCommand.startsWith("jail")) {
  270. try {
  271. String playerToBan = playerCommand.substring(5);
  272. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  273. if(Server.playerHandler.players[i] != null) {
  274. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  275. Client c2 = (Client)Server.playerHandler.players[i];
  276. c2.teleportToX = 3102;
  277. c2.teleportToY = 9516;
  278. c2.Jail = true;
  279. c2.sendMessage("You have been jailed by "+c.playerName+"");
  280. c.sendMessage("Successfully Jailed "+c2.playerName+".");
  281. }
  282. }
  283. }
  284. } catch(Exception e) {
  285. c.sendMessage("Player Must Be Offline.");
  286. }
  287. }
  288. if (playerCommand.startsWith("mute")) {
  289. try {
  290. String playerToBan = playerCommand.substring(5);
  291. Connection.addNameToMuteList(playerToBan);
  292. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  293. if(Server.playerHandler.players[i] != null) {
  294. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  295. Client c2 = (Client)Server.playerHandler.players[i];
  296. c2.sendMessage("You have been muted by: " + c.playerName);
  297. c.sendMessage("You have muted: " + c2.playerName);
  298. break;
  299. }
  300. }
  301. }
  302. } catch(Exception e) {
  303. c.sendMessage("Player Must Be Offline.");
  304. }
  305. }
  306.  
  307. if (playerCommand.startsWith("unmute")) {
  308. try {
  309. String playerToBan = playerCommand.substring(7);
  310. Connection.unMuteUser(playerToBan);
  311. c.sendMessage("Unmuted.");
  312. } catch(Exception e) {
  313. c.sendMessage("Player Must Be Offline.");
  314. }
  315. }
  316.  
  317. if (playerCommand.startsWith("checkbank")) {
  318. String[] args = playerCommand.split(" ");
  319. for(int i = 0; i < Config.MAX_PLAYERS; i++)
  320. {
  321. Client o = (Client) Server.playerHandler.players[i];
  322. if(Server.playerHandler.players[i] != null)
  323. {
  324. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1]))
  325. {
  326. c.getPA().otherBank(c, o);
  327. break;
  328. }
  329. }
  330. }
  331. }
  332. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  333. try {
  334. String playerToBan = playerCommand.substring(5);
  335. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  336. if(Server.playerHandler.players[i] != null) {
  337. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  338. Server.playerHandler.players[i].disconnected = true;
  339. }
  340. }
  341. }
  342. } catch(Exception e) {
  343. c.sendMessage("Player Must Be Offline.");
  344. }
  345. }
  346. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  347. try {
  348. String playerToBan = playerCommand.substring(4);
  349. Connection.addNameToBanList(playerToBan);
  350. Connection.addNameToFile(playerToBan);
  351. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  352. if(Server.playerHandler.players[i] != null) {
  353. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  354. Server.playerHandler.players[i].disconnected = true;
  355. Client c2 = (Client)Server.playerHandler.players[i];
  356. c2.sendMessage(" " +c2.playerName+ " Got Banned By " + c.playerName+ ".");
  357. }
  358. }
  359. }
  360. } catch(Exception e) {
  361. c.sendMessage("Player Must Be Offline.");
  362. }
  363. }
  364. if (playerCommand.startsWith("unban")) {
  365. try {
  366. String playerToBan = playerCommand.substring(6);
  367. Connection.removeNameFromBanList(playerToBan);
  368. c.sendMessage(playerToBan + " has been unbanned.");
  369. } catch(Exception e) {
  370. c.sendMessage("Player Must Be Offline.");
  371. }
  372. }
  373. if(playerCommand.startsWith("unjail")) {
  374. try {
  375. String playerToBan = playerCommand.substring(7);
  376. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  377. if(Server.playerHandler.players[i] != null) {
  378. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  379. Client c2 = (Client)Server.playerHandler.players[i];
  380. c2.teleportToX = 3086;
  381. c2.teleportToY = 3493;
  382. c2.monkeyk0ed = 0;
  383. c2.Jail = false;
  384. c2.sendMessage("You have been unjailed by "+c.playerName+".");
  385. c.sendMessage("Successfully unjailed "+c2.playerName+".");
  386. }
  387. }
  388. }
  389. } catch(Exception e) {
  390. c.sendMessage("Player Must Be Offline.");
  391. }
  392. }
  393.  
  394. }
  395.  
  396. public void administratorCommands(Client c, String playerCommand)
  397. {
  398. if (playerCommand.startsWith("alert") && c.playerRights > 1) {
  399. String msg = playerCommand.substring(6);
  400. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  401. if (Server.playerHandler.players[i] != null) {
  402. Client c2 = (Client)Server.playerHandler.players[i];
  403. c2.sendMessage("Alert##Notification##" + msg + "##By: " + c.playerName);
  404.  
  405. }
  406. }
  407. }
  408.  
  409. if (playerCommand.startsWith("ipmute")) {
  410. try {
  411. String playerToBan = playerCommand.substring(7);
  412. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  413. if(Server.playerHandler.players[i] != null) {
  414. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  415. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  416. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  417. Client c2 = (Client)Server.playerHandler.players[i];
  418. c2.sendMessage("You have been muted by: " + c.playerName);
  419. c2.sendMessage(" " +c2.playerName+ " Got IpMuted By " + c.playerName+ ".");
  420. break;
  421. }
  422. }
  423. }
  424. } catch(Exception e) {
  425. c.sendMessage("Player Must Be Offline.");
  426. }
  427. }
  428.  
  429.  
  430.  
  431. if (playerCommand.startsWith("object")) {
  432. String[] args = playerCommand.split(" ");
  433. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  434. }
  435.  
  436. if (playerCommand.equalsIgnoreCase("mypos")) {
  437. c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
  438. }
  439.  
  440. if (playerCommand.startsWith("interface")) {
  441. String[] args = playerCommand.split(" ");
  442. c.getPA().showInterface(Integer.parseInt(args[1]));
  443. }
  444.  
  445. if (playerCommand.startsWith("gfx")) {
  446. String[] args = playerCommand.split(" ");
  447. c.gfx0(Integer.parseInt(args[1]));
  448. }
  449. if (playerCommand.startsWith("tele")) {
  450. String[] arg = playerCommand.split(" ");
  451. if (arg.length > 3)
  452. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  453. else if (arg.length == 3)
  454. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  455. }
  456.  
  457. if (playerCommand.startsWith("xteletome")) {
  458. try {
  459. String playerToTele = playerCommand.substring(10);
  460. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  461. if(Server.playerHandler.players[i] != null) {
  462. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
  463. Client c2 = (Client)Server.playerHandler.players[i];
  464. c2.sendMessage("You have been teleported to " + c.playerName);
  465. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  466. break;
  467. }
  468. }
  469. }
  470. } catch(Exception e) {
  471. c.sendMessage("Player Must Be Offline.");
  472. }
  473. }
  474.  
  475.  
  476. if (playerCommand.startsWith("xteleto")) {
  477. String name = playerCommand.substring(8);
  478. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  479. if (Server.playerHandler.players[i] != null) {
  480. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  481. c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
  482. }
  483. }
  484. }
  485. }
  486. if (playerCommand.equalsIgnoreCase("bank")) {
  487. c.getPA().openUpBank();
  488. }
  489. if (playerCommand.startsWith("unipmute")) {
  490. try {
  491. String playerToBan = playerCommand.substring(9);
  492. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  493. if(Server.playerHandler.players[i] != null) {
  494. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  495. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  496. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  497. break;
  498. }
  499. }
  500. }
  501. } catch(Exception e) {
  502. c.sendMessage("Player Must Be Offline.");
  503. }
  504. }
  505. if (playerCommand.startsWith("ipban")) {
  506. try {
  507. String playerToBan = playerCommand.substring(6);
  508. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  509. if(Server.playerHandler.players[i] != null) {
  510. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  511. Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
  512. Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
  513. c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
  514. Client c2 = (Client)Server.playerHandler.players[i];
  515. Server.playerHandler.players[i].disconnected = true;
  516. c2.sendMessage(" " +c2.playerName+ " Got IpBanned By " + c.playerName+ ".");
  517. }
  518. }
  519. }
  520. } catch(Exception e) {
  521. c.sendMessage("Player Must Be Offline.");
  522. }
  523. }
  524.  
  525.  
  526. }
  527.  
  528. public void ownerCommands(Client c, String playerCommand)
  529. {
  530.  
  531. if (playerCommand.startsWith("update") && c.playerName.equalsIgnoreCase("bawb")) {
  532. String[] args = playerCommand.split(" ");
  533. int a = Integer.parseInt(args[1]);
  534. PlayerHandler.updateSeconds = a;
  535. PlayerHandler.updateAnnounced = false;
  536. PlayerHandler.updateRunning = true;
  537. PlayerHandler.updateStartTime = System.currentTimeMillis();
  538. }
  539.  
  540.  
  541. if(playerCommand.startsWith("npc")) {
  542. try {
  543. int newNPC = Integer.parseInt(playerCommand.substring(4));
  544. if(newNPC > 0) {
  545. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  546. c.sendMessage("You spawn a Npc.");
  547. } else {
  548. c.sendMessage("No such NPC.");
  549. }
  550. } catch(Exception e) {
  551.  
  552. }
  553. }
  554.  
  555. if (playerCommand.startsWith("anim")) {
  556. String[] args = playerCommand.split(" ");
  557. c.startAnimation(Integer.parseInt(args[1]));
  558. c.getPA().requestUpdates();
  559. }
  560.  
  561. if (playerCommand.startsWith("spec")) {
  562. c.specAmount = 500.0;
  563. }
  564.  
  565. if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("Pvm Max")) {
  566. try {
  567. String playerToAdmin = playerCommand.substring(10);
  568. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  569. if(Server.playerHandler.players[i] != null) {
  570. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  571. Client c2 = (Client)Server.playerHandler.players[i];
  572. c2.sendMessage("You have been given admin status by " + c.playerName);
  573. c2.playerRights = 2;
  574. c2.logout();
  575. break;
  576. }
  577. }
  578. }
  579. } catch(Exception e) {
  580. c.sendMessage("Player Must Be Offline.");
  581. }
  582. }
  583.  
  584.  
  585. if (playerCommand.startsWith("givemod") && c.playerName.equalsIgnoreCase("Pvm Max")) {
  586. try {
  587. String playerToMod = playerCommand.substring(8);
  588. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  589. if(Server.playerHandler.players[i] != null) {
  590. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  591. Client c2 = (Client)Server.playerHandler.players[i];
  592. c2.sendMessage("You have been given mod status by " + c.playerName);
  593. c2.playerRights = 1;
  594. c2.logout();
  595. break;
  596. }
  597. }
  598. }
  599. } catch(Exception e) {
  600. c.sendMessage("Player Must Be Offline.");
  601. }
  602. }
  603.  
  604. if (playerCommand.startsWith("pnpc"))
  605. {
  606. try {
  607. int newNPC = Integer.parseInt(playerCommand.substring(5));
  608. if (newNPC <= 200000 && newNPC >= 0) {
  609. c.npcId2 = newNPC;
  610. c.isNpc = true;
  611. c.updateRequired = true;
  612. c.setAppearanceUpdateRequired(true);
  613. }
  614. else {
  615. c.sendMessage("No such P-NPC.");
  616. }
  617. } catch(Exception e) {
  618. c.sendMessage("Wrong Syntax! Use as ::pnpc #");
  619. }
  620. }
  621.  
  622.  
  623. if (playerCommand.startsWith("givedonor") && c.playerName.equalsIgnoreCase("Pvm Max")) {
  624. try {
  625. String playerToMod = playerCommand.substring(10);
  626. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  627. if(Server.playerHandler.players[i] != null) {
  628. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  629. Client c2 = (Client)Server.playerHandler.players[i];
  630. c2.sendMessage("You have been given donator status by " + c.playerName);
  631. c2.playerRights = 4;
  632. c2.isDonator = 1;
  633. c2.logout();
  634.  
  635. break;
  636. }
  637. }
  638. }
  639. } catch(Exception e) {
  640. c.sendMessage("Player Must Be Offline.");
  641. }
  642. }
  643.  
  644.  
  645. if (playerCommand.startsWith("demote") && c.playerName.equalsIgnoreCase("Pvm Max")) {
  646. try {
  647. String playerToDemote = playerCommand.substring(7);
  648. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  649. if(Server.playerHandler.players[i] != null) {
  650. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  651. Client c2 = (Client)Server.playerHandler.players[i];
  652. c2.sendMessage("You have been demoted by " + c.playerName);
  653. c2.playerRights = 0;
  654. c2.logout();
  655. break;
  656. }
  657. }
  658. }
  659. } catch(Exception e) {
  660. c.sendMessage("Player Must Be Offline.");
  661. }
  662. }
  663. if (playerCommand.startsWith("reloadspawns")) {
  664. Server.npcHandler = null;
  665. Server.npcHandler = new server.model.npcs.NPCHandler();
  666. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  667. if (Server.playerHandler.players[j] != null) {
  668. Client c2 = (Client)Server.playerHandler.players[j];
  669. c2.sendMessage("<shad=15695415>[" + c.playerName + "] " + "NPC Spawns have been reloaded.</col>");
  670. }
  671. }
  672.  
  673. }
  674.  
  675. if (playerCommand.startsWith("item")) {
  676. try {
  677. String[] args = playerCommand.split(" ");
  678. if (args.length == 3) {
  679. int newItemID = Integer.parseInt(args[1]);
  680. int newItemAmount = Integer.parseInt(args[2]);
  681. if ((newItemID <= 20500) && (newItemID >= 0)) {
  682. c.getItems().addItem(newItemID, newItemAmount);
  683. } else {
  684. c.sendMessage("That item ID does not exist.");
  685. }
  686. } else {
  687. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  688. }
  689. } catch(Exception e) {
  690.  
  691. } // HERE?
  692. } // HERE?
  693.  
  694. if (playerCommand.startsWith("pickup") && c.playerRights == 2) {
  695. if (c.inWild()) {
  696. c.sendMessage("you can't spawn items in the wilderness!");
  697. return;
  698. }
  699. try {
  700. String[] args = playerCommand.split(" ");
  701. if (args.length == 3) {
  702. int newItemID = Integer.parseInt(args[1]);
  703. int newItemAmount = Integer.parseInt(args[2]);
  704. // add restricted items here.
  705. int restrictedItems[] = {15773, 15774, 15818, 15888, 15889, 15890, 15891, 15924, 15935, 15946, 16001, 16023, 16034, 16045, 16090, 16126, 16137, 16152, 16184, 16206, 16217, 16258, 16259, 16260, 16261, 16272, 16293, 16294, 16315, 16316, 16359, 16360, 16381, 16382, 16403, 16404, 16425, 16426, 16667, 16668, 16689, 16690, 16711, 16712, 16733, 16734, 16837, 16838, 16839, 16840, 16841, 16842, 16843, 16844, 16909, 16910, 16955, 16956, 17039, 17040, 17143, 17144, 17145, 17146, 17147, 17148, 17149, 17150, 17259, 17260, 17361, 17362, 20822, 20832, 20824, 20825, 20826, 20833, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 2422, 13531, 13532, 13533, 13534, 13535, 13536, 1053, 1054, 1055, 1056, 1057, 1058, 13538, 13539, 13540, 18786, 19780, 19784, 19669, 13362, 13361, 13359, 13358, 13355, 13354, 13352, 13351, 13350, 13348, 13347, 13346, 13345, 13344, 13343, 13342, 13341, 13340, 13339, 13370, 13371, 13369, 13336, 13335};
  706.  
  707. for (int i : restrictedItems) {
  708. if (i == newItemID) {
  709. if (c.playerRights != 3) {
  710. c.sendMessage("You can't spawn this item!");
  711. return;
  712. }
  713. }
  714. }
  715. if ((newItemID <= 30000) && (newItemID >= 0)) {
  716. c.getItems().addItem(newItemID, newItemAmount);
  717. } else {
  718. c.sendMessage("You can't spawn this item!");
  719. }
  720. } else {
  721. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  722. }
  723. } catch(Exception e) {
  724. }}
  725.  
  726. if (playerCommand.startsWith("giveitem")) {
  727.  
  728. try {
  729. String[] args = playerCommand.split(" ");
  730. int newItemID = Integer.parseInt(args[1]);
  731. int newItemAmount = Integer.parseInt(args[2]);
  732. String otherplayer = args[3];
  733. Client c2 = null;
  734. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  735. if(Server.playerHandler.players[i] != null) {
  736. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  737. c2 = (Client)Server.playerHandler.players[i];
  738. break;
  739. }
  740. }
  741. }
  742. if (c2 == null) {
  743. c.sendMessage("Player doesn't exist.");
  744. return;
  745. }
  746. c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +"." );
  747. c2.sendMessage("You have just been given item(s)." );
  748. c2.getItems().addItem(newItemID, newItemAmount);
  749. } catch(Exception e) {
  750. c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
  751. }
  752. }
  753.  
  754. if (playerCommand.startsWith("copy") && c.playerRights == 3) {
  755. int[] arm = new int[14];
  756. String name = playerCommand.substring(5);
  757. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  758. if (Server.playerHandler.players[j] != null) {
  759. Client c2 = (Client)Server.playerHandler.players[j];
  760. if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))){
  761. for(int q = 0; q < c2.playerEquipment.length; q++) {
  762. arm[q] = c2.playerEquipment[q];
  763. c.playerEquipment[q] = c2.playerEquipment[q];
  764. }
  765. for(int q = 0; q < arm.length; q++) {
  766. c.getItems().setEquipment(arm[q],1,q);
  767. }
  768. }
  769. }
  770. }
  771. }
  772.  
  773. if (playerCommand.startsWith("hail") && c.playerRights == 3) {
  774. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  775. if (Server.playerHandler.players[j] != null) {
  776. Client p = (Client)Server.playerHandler.players[j];
  777. p.forcedChat("KOOKIES! PVM & bawb & VORTEX OWNZ! ;)");
  778. p.startAnimation(1651);
  779. }
  780. }
  781. }
  782.  
  783. if (playerCommand.startsWith("takeitem")) {
  784.  
  785. try {
  786. String[] args = playerCommand.split(" ");
  787. int takenItemID = Integer.parseInt(args[1]);
  788. int takenItemAmount = Integer.parseInt(args[2]);
  789. String otherplayer = args[3];
  790. Client c2 = null;
  791. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  792. if(Server.playerHandler.players[i] != null) {
  793. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  794. c2 = (Client)Server.playerHandler.players[i];
  795. break;
  796. }
  797. }
  798. }
  799. if (c2 == null) {
  800. c.sendMessage("Player doesn't exist.");
  801. return;
  802. }
  803. c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
  804. c2.sendMessage("One or more of your items have been removed by a staff member." );
  805. c2.getItems().deleteItem(takenItemID, takenItemAmount);
  806. } catch(Exception e) {
  807. c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
  808. }
  809. }
  810.  
  811. if (playerCommand.equals("alltome")) {
  812. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  813. if (Server.playerHandler.players[j] != null) {
  814. Client c2 = (Client)Server.playerHandler.players[j];
  815. c2.teleportToX = c.absX;
  816. c2.teleportToY = c.absY;
  817. c2.heightLevel = c.heightLevel;
  818. c2.sendMessage("Mass teleport to: " + c.playerName + "");
  819. }
  820. }
  821. }
  822.  
  823. if (playerCommand.startsWith("interface") && (c.playerRights >= 3)) {
  824. try {
  825. String[] args = playerCommand.split(" ");
  826. int a = Integer.parseInt(args[1]);
  827. c.getPA().showInterface(a);
  828. } catch (Exception e) {
  829. c.sendMessage("::interface ####");
  830. }
  831. }
  832.  
  833. if (playerCommand.equalsIgnoreCase("master")) {
  834. for (int i = 0; i < 22; i++) {
  835. c.playerLevel[i] = 99;
  836. c.playerXP[i] = c.getPA().getXPForLevel(100);
  837. c.getPA().refreshSkill(i);
  838. }
  839. c.getPA().requestUpdates();
  840. }
  841.  
  842. }
  843.  
  844.  
  845. public void DonatorCommands(Client c, String playerCommand)
  846. {
  847.  
  848. }
  849. }
  850.  
Advertisement
Add Comment
Please, Sign In to add comment