Advertisement
Guest User

Untitled

a guest
Sep 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.36 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.model.items.ItemAssistant;
  10. import server.util.Misc;
  11.  
  12.  
  13. import java.io.*;
  14.  
  15. /**
  16. * Commands
  17. **/
  18. public class Commands implements PacketType {
  19. private int[] restrictedItems = { 11694, 11777, 6570, 10551, 11283, 7459, 7462, 8850, 11730, 11931, 13794, 13796, 13812, 13808, 13810, 995, 13752, 15335, 13740, 13742, 13746, 13748, 13750, 11724, 11726, 13754, 13756, 13738, 13736, 8178, 8427, 8428, 8176, 8423, 8424, 8169, 8429, 8430, 8177, 8425, 8426, 8175, 8421, 8422, 8173, 15020, 15019, 15018, 15220};
  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("/") && playerCommand.length() > 1) {
  32. if (c.clanId >= 0) {
  33. System.out.println(playerCommand);
  34. playerCommand = playerCommand.substring(1);
  35. Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  36. } else {
  37. if (c.clanId != -1)
  38. c.clanId = -1;
  39. c.sendMessage("You are not in a clan.");
  40. }
  41. return;
  42. }
  43. if (Config.SERVER_DEBUG)
  44. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  45.  
  46. if (c.playerRights >= 0)
  47. playerCommands(c, playerCommand);
  48. if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3)
  49. moderatorCommands(c, playerCommand);
  50. if (c.playerRights == 2 || c.playerRights == 3)
  51. administratorCommands(c, playerCommand);
  52. if (c.playerRights == 3)
  53. ownerCommands(c, playerCommand);
  54. if (c.playerRights == 4 || c.playerRights == 5 || c.playerRights == 6)
  55. DonatorCommands(c, playerCommand);
  56.  
  57. }
  58.  
  59.  
  60. public void playerCommands(Client c, String playerCommand)
  61. {
  62. if (playerCommand.equalsIgnoreCase("players")) {
  63. c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
  64. }
  65. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  66. c.playerPass = playerCommand.substring(15);
  67. c.sendMessage("Your password is now: " + c.playerPass);
  68. }
  69.  
  70.  
  71.  
  72. if (playerCommand.equalsIgnoreCase("TP")) {
  73. c.sendMessage("You have "+c.pcPoints+ " TP.");
  74.  
  75. }
  76.  
  77. if (playerCommand.equalsIgnoreCase("save")) {
  78. c.SaveGame();
  79. c.sendMessage("Your acc has been saved.");
  80. }
  81.  
  82. if (playerCommand.startsWith("resetsum")) {
  83. if (c.inWild())
  84. return;
  85. for (int j = 0; j < c.playerEquipment.length; j++) {
  86. if (c.playerEquipment[j] > 0) {
  87. c.sendMessage("Please take all your armour and weapons off before using this command.");
  88. return;
  89. }
  90. }
  91. try {
  92.  
  93. int skill = 24;
  94. int level = 1;
  95. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  96. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  97. c.getPA().refreshSkill(skill);
  98. c.getPA().sendFrame126("Combat Level: "+c.getCombatLevel()+"", 3983);
  99. } catch (Exception e){}
  100. }
  101. if (playerCommand.startsWith("resetdef")) {
  102. if (c.inWild())
  103. return;
  104. for (int j = 0; j < c.playerEquipment.length; j++) {
  105. if (c.playerEquipment[j] > 0) {
  106. c.sendMessage("Please take all your armour and weapons off before using this command.");
  107. return;
  108. }
  109. }
  110. try {
  111. int skill = 1;
  112. int level = 1;
  113. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  114. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  115. c.getPA().refreshSkill(skill);
  116. } catch (Exception e){}
  117. }
  118. if (playerCommand.startsWith("resetrange")) {
  119. if (c.inWild())
  120. return;
  121. for (int j = 0; j < c.playerEquipment.length; j++) {
  122. if (c.playerEquipment[j] > 0) {
  123. c.sendMessage("Please take all your armour and weapons off before using this command.");
  124. return;
  125. }
  126. }
  127. try {
  128. int skill = 4;
  129. int level = 1;
  130. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  131. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  132. c.getPA().refreshSkill(skill);
  133. } catch (Exception e){}
  134. }
  135. if (playerCommand.startsWith("resetmage")) {
  136. if (c.inWild())
  137. return;
  138. for (int j = 0; j < c.playerEquipment.length; j++) {
  139. if (c.playerEquipment[j] > 0) {
  140. c.sendMessage("Please take all your armour and weapons off before using this command.");
  141. return;
  142. }
  143. }
  144. try {
  145. int skill = 6;
  146. int level = 1;
  147. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  148. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  149. c.getPA().refreshSkill(skill);
  150. } catch (Exception e){}
  151. }
  152. if (playerCommand.startsWith("resetatt")) {
  153. if (c.inWild())
  154. return;
  155. for (int j = 0; j < c.playerEquipment.length; j++) {
  156. if (c.playerEquipment[j] > 0) {
  157. c.sendMessage("Please take all your armour and weapons off before using this command.");
  158. return;
  159. }
  160. }
  161. try {
  162. int skill = 0;
  163. int level = 1;
  164. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  165. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  166. c.getPA().refreshSkill(skill);
  167. } catch (Exception e){}
  168. }
  169. if (playerCommand.startsWith("resetstr")) {
  170. if (c.inWild())
  171. return;
  172. for (int j = 0; j < c.playerEquipment.length; j++) {
  173. if (c.playerEquipment[j] > 0) {
  174. c.sendMessage("Please take all your armour and weapons off before using this command.");
  175. return;
  176. }
  177. }
  178. try {
  179. int skill = 2;
  180. int level = 1;
  181. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  182. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  183. c.getPA().refreshSkill(skill);
  184. } catch (Exception e){}
  185. }
  186. if (playerCommand.startsWith("resetprayer")) {
  187. if (c.inWild())
  188. return;
  189. for (int j = 0; j < c.playerEquipment.length; j++) {
  190. if (c.playerEquipment[j] > 0) {
  191. c.sendMessage("Please take all your armour and weapons off before using this command.");
  192. return;
  193. }
  194. }
  195. try {
  196. int skill = 5;
  197. int level = 1;
  198. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  199. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  200. c.getPA().refreshSkill(skill);
  201. } catch (Exception e){}
  202. }
  203.  
  204. if (playerCommand.equals("hunter")) {
  205. c.getPA().startTeleport(2604, 4772, 0, "modern");
  206. c.sendMessage("<shad=6081134>Sell the impling Jar's to the general shop!");
  207. c.sendMessage("<shad=6081134>Buy a Butterfly Net at Bob store in bank if you dont have one");
  208. }
  209. if (playerCommand.startsWith("rules")) {
  210.  
  211. c.sendMessage("1. Flaming another member is not tolerated, you can be muted including members.");
  212. c.sendMessage("2. Advertisement on the server is an automatic ipban from the server.");
  213. c.sendMessage("3. Spamming on the server is not allowed, is using Auto-Talker do 8-10 Secs.");
  214. c.sendMessage("4. Hacking on the server is not allowed, one's account will be ipbanned forever.");
  215. c.sendMessage("5. Argueing with the staff team is not allowed, you can be muted, our decesion is final.");
  216. c.sendMessage("6. Purchasing or Selling RSGP, RL Items (acounts, items, money) is a jail or mute.");
  217. c.sendMessage("7. Invaiding other communities is not allowed, we respect them all.");
  218. c.sendMessage("8. Abuse of Glitches/Bugsis not allowed, you can be banned at any time if doing so.");
  219. c.sendMessage("9. Usernames must be appropiate, you can be requested to have it changed by staff.");
  220. c.sendMessage("10. 3rd Party Software it not allowed, can be banned exluding Auto-Talkers.");
  221. c.sendMessage("11. Tavlonia does not have Pking Rules, do not come to us and complain.");
  222. c.sendMessage("12. Requesting a staff posotion can lead to a mute after a while of asking.");
  223. c.sendMessage("13. Members who are scammed aren't our problem, do not come to the staff team.");
  224. }
  225. if (playerCommand.startsWith("commands")) {
  226.  
  227. c.sendMessage("These are the commands for regular players.");
  228. c.sendMessage("kdr, gwd, unsit, tp.");
  229. c.sendMessage("resetsum, resetdef, resetrange, resetmage, resetatt.");
  230. c.sendMessage("resetstr, resetprayer, hunter, rules.");
  231. c.sendMessage("strykeworms, train.");
  232. }
  233.  
  234. if (playerCommand.startsWith("strykeworms")) {
  235. c.sendMessage("You can find these in your teleports.");
  236. }
  237. if (playerCommand.equals("train")) {
  238. c.getPA().startTeleport(2672, 3718, 0, "modern");
  239. }
  240. if (playerCommand.equals("icestrykeworm")) {
  241. c.getPA().startTeleport(3052, 9576, 0, "modern");
  242. }
  243. if (playerCommand.equals("junglestrykeworm")) {
  244. c.getPA().startTeleport(2785, 2700, 0, "modern");
  245. }
  246. if (playerCommand.equals("desertstrykeworm")) {
  247. c.getPA().startTeleport(3336, 3065, 0, "modern");
  248. }
  249. if (playerCommand.startsWith("item")) {
  250. try {
  251. String[] args = playerCommand.split(" ");
  252. if (args.length == 3) {
  253. int newItemID = Integer.parseInt(args[1]);
  254. int newItemAmount = Integer.parseInt(args[2]);
  255. if(c.inWild()) {
  256. c.sendMessage("You cannot spawn in the wilderness!");
  257. return;
  258. }
  259. if(c.isInJail()) {
  260. c.sendMessage("You cannot spawn in Jail!");
  261. return;
  262. }
  263. if ((newItemID <= 20000) && (newItemID >= 0)) {
  264. c.getItems().addItem(newItemID, newItemAmount);
  265. } else {
  266. c.sendMessage("No such item.");
  267. }
  268. } else {
  269. c.sendMessage("Use as ::item 995 200 for example 200 gp");
  270. }
  271. } catch(Exception e) {
  272.  
  273. }
  274. }
  275.  
  276. if (playerCommand.equals("drags")) {
  277. c.getPA().startTeleport(2894, 9799, 0, "modern");
  278. c.sendMessage("Run easts for Green Drags And Baby blue drags.");
  279. }
  280. if (playerCommand.startsWith("ep") || playerCommand.startsWith("Ep") || playerCommand.startsWith("EP") || playerCommand.startsWith("eP")) {
  281. c.sendMessage("EP: "+ c.earningPotential+"");
  282. }
  283.  
  284. if (playerCommand.startsWith("yell")) {
  285. /*
  286. *This is the sensor for the yell command
  287. */
  288. String text = playerCommand.substring(5);
  289. String[] bad = {"<img=1>", "<img=2>", "<img=0>", "Fuck", "Nigger", "Cunt", "Faggot"};
  290. for(int i = 0; i < bad.length; i++){
  291. if(text.indexOf(bad[i]) >= 0){
  292. return;
  293. }
  294. }
  295. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  296. if (Server.playerHandler.players[j] != null) {
  297. Client c2 = (Client)Server.playerHandler.players[j];
  298.  
  299. if (c.playerName.equalsIgnoreCase("")) {
  300. c2.sendMessage("<shad=15369497>[Extreme Donator]"+ Misc.optimizeText(c.playerName) +": "
  301. + Misc.optimizeText(playerCommand.substring(5)) +"");
  302. } else if (c.playerName.equalsIgnoreCase("Rene")) {
  303. c2.sendMessage("<shad=15695415>[Owner]"+ Misc.optimizeText(c.playerName) +": "
  304. + Misc.optimizeText(playerCommand.substring(5)) +"");
  305. } else if (c.isDonator == 1 && (c.playerRights == 4 )) {
  306. c2.sendMessage("<shad=6081134>[Donator]"+ Misc.optimizeText(c.playerName) +": "
  307. + Misc.optimizeText(playerCommand.substring(5)) +"");
  308. } else if (c.playerRights == 1) {
  309. c2.sendMessage("<shad=3781373>[Moderator]"+ Misc.optimizeText(c.playerName) +": "
  310. + Misc.optimizeText(playerCommand.substring(5)) +"");
  311. } else if (c.playerRights == 2) {
  312. c2.sendMessage("<shad=16112652>[Administrator]"+ Misc.optimizeText(c.playerName) +": "
  313. + Misc.optimizeText(playerCommand.substring(5)) +"");
  314. } else if (c.playerName.equalsIgnoreCase("Rene")) {
  315. c2.sendMessage("<shad=15695415>[Owner]"+ Misc.optimizeText(c.playerName) +": "
  316. + Misc.optimizeText(playerCommand.substring(5)) +"");
  317. } else if (c.playerName.equalsIgnoreCase("james")) {
  318. c2.sendMessage("<shad=15695415>[Co-Owner]"+ Misc.optimizeText(c.playerName) +": "
  319. + Misc.optimizeText(playerCommand.substring(5)) +"");
  320. } else if (c.playerName.equalsIgnoreCase("jordon")) {
  321. c2.sendMessage("<shad=15695415>[Developer]"+ Misc.optimizeText(c.playerName) +": "
  322. + Misc.optimizeText(playerCommand.substring(5)) +"");
  323. } else if (c.playerName.equalsIgnoreCase("charlie")) {
  324. c2.sendMessage("<shad=15695415>[Owner]"+ Misc.optimizeText(c.playerName) +": "
  325. + Misc.optimizeText(playerCommand.substring(5)) +"");
  326. } else if (c.isDonator == 0) {
  327. c.sendMessage("You must be a donator to use this command!");
  328. } else {
  329. if (c.isInJail()) {
  330. c.sendMessage("You cannot yell while you are in Jail!");
  331. return;
  332. }
  333.  
  334. }
  335. }
  336. }
  337. }
  338.  
  339. }
  340.  
  341.  
  342. public void moderatorCommands(Client c, String playerCommand)
  343. {
  344.  
  345. if (playerCommand.startsWith("dzone")) {
  346. c.getPA().startTeleport(2037, 4526, 0, "modern");
  347. }
  348.  
  349. if (playerCommand.startsWith("movehome")) {
  350. try {
  351. String playerToBan = playerCommand.substring(9);
  352. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  353. if(Server.playerHandler.players[i] != null) {
  354. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  355. Client c2 = (Client)Server.playerHandler.players[i];
  356. c2.teleportToX = 3086;
  357. c2.teleportToY = 3493;
  358. c2.heightLevel = c.heightLevel;
  359. c.sendMessage("You have teleported " + c2.playerName + " to Home");
  360. c2.sendMessage("You have been teleported to home");
  361. }
  362. }
  363. }
  364. } catch(Exception e) {
  365. c.sendMessage("Player Must Be Offline.");
  366. }
  367. }
  368. if (playerCommand.startsWith("afk")) {
  369. String Message = "<shad=6081134>["+ c.playerName +"] is now AFK, don't message me; I won't reply";
  370.  
  371. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  372. if (Server.playerHandler.players[j] != null) {
  373. Client c2 = (Client)Server.playerHandler.players[j];
  374. c2.sendMessage(Message);
  375. }
  376. }
  377. }
  378. if(playerCommand.startsWith("jail")) {
  379. try {
  380. String playerToBan = playerCommand.substring(5);
  381. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  382. if(Server.playerHandler.players[i] != null) {
  383. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  384. Client c2 = (Client)Server.playerHandler.players[i];
  385. c2.teleportToX = 3102;
  386. c2.teleportToY = 9516;
  387. c2.Jail = true;
  388. c2.sendMessage("You have been jailed by "+c.playerName+"");
  389. c.sendMessage("Successfully Jailed "+c2.playerName+".");
  390. }
  391. }
  392. }
  393. } catch(Exception e) {
  394. c.sendMessage("Player Must Be Offline.");
  395. }
  396. }
  397. if (playerCommand.startsWith("mute")) {
  398. try {
  399. String playerToBan = playerCommand.substring(5);
  400. Connection.addNameToMuteList(playerToBan);
  401. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  402. if(Server.playerHandler.players[i] != null) {
  403. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  404. Client c2 = (Client)Server.playerHandler.players[i];
  405. c2.sendMessage("You have been muted by: " + c.playerName);
  406. c2.sendMessage(" " +c2.playerName+ " Got Muted By " + c.playerName+ ".");
  407. break;
  408. }
  409. }
  410. }
  411. } catch(Exception e) {
  412. c.sendMessage("Player Must Be Offline.");
  413. }
  414. }
  415. if (playerCommand.startsWith("unmute")) {
  416. try {
  417. String playerToBan = playerCommand.substring(7);
  418. Connection.unMuteUser(playerToBan);
  419. Connection.removeNameFromMuteList(playerToBan);
  420. c.sendMessage("You have unmuted "+c.playerName+".");
  421. } catch(Exception e) {
  422. c.sendMessage("Player Must Be Offline.");
  423.  
  424. }
  425. }
  426.  
  427. if (playerCommand.startsWith("xteleto")) {
  428. String name = playerCommand.substring(8);
  429. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  430. if (Server.playerHandler.players[i] != null) {
  431. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  432. c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
  433. }
  434. }
  435. }
  436. }
  437. if (playerCommand.startsWith("xteletome")) {
  438. try {
  439. String playerToTele = playerCommand.substring(10);
  440. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  441. if(Server.playerHandler.players[i] != null) {
  442. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
  443. Client c2 = (Client)Server.playerHandler.players[i];
  444. c2.sendMessage("You have been teleported to " + c.playerName);
  445. c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
  446. break;
  447. }
  448. }
  449. }
  450. } catch(Exception e) {
  451. c.sendMessage("Player Must Be Offline.");
  452. }
  453. }
  454. if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
  455. try {
  456. String playerToBan = playerCommand.substring(5);
  457. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  458. if(Server.playerHandler.players[i] != null) {
  459. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  460. Server.playerHandler.players[i].disconnected = true;
  461. }
  462. }
  463. }
  464. } catch(Exception e) {
  465. c.sendMessage("Player Must Be Offline.");
  466. }
  467. }
  468. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  469. try {
  470. String playerToBan = playerCommand.substring(4);
  471. Connection.addNameToBanList(playerToBan);
  472. Connection.addNameToFile(playerToBan);
  473. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  474. if(Server.playerHandler.players[i] != null) {
  475. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  476. Server.playerHandler.players[i].disconnected = true;
  477. Client c2 = (Client)Server.playerHandler.players[i];
  478. c2.sendMessage(" " +c2.playerName+ " Got Banned By " + c.playerName+ ".");
  479. }
  480. }
  481. }
  482. } catch(Exception e) {
  483. c.sendMessage("Player Must Be Offline.");
  484. }
  485. }
  486. if (playerCommand.startsWith("unban")) {
  487. try {
  488. String playerToBan = playerCommand.substring(6);
  489. Connection.removeNameFromBanList(playerToBan);
  490. c.sendMessage(playerToBan + " has been unbanned.");
  491. } catch(Exception e) {
  492. c.sendMessage("Player Must Be Offline.");
  493. }
  494. }
  495. if (playerCommand.startsWith("ipmute")) {
  496. try {
  497. String playerToBan = playerCommand.substring(7);
  498. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  499. if(Server.playerHandler.players[i] != null) {
  500. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  501. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  502. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  503. Client c2 = (Client)Server.playerHandler.players[i];
  504. c2.sendMessage("You have been muted by: " + c.playerName);
  505. c2.sendMessage(" " +c2.playerName+ " Got IpMuted By " + c.playerName+ ".");
  506. break;
  507. }
  508. }
  509. }
  510. } catch(Exception e) {
  511. c.sendMessage("Player Must Be Offline.");
  512. }
  513. }
  514. if (playerCommand.startsWith("unipmute")) {
  515. try {
  516. String playerToBan = playerCommand.substring(9);
  517. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  518. if(Server.playerHandler.players[i] != null) {
  519. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  520. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  521. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  522. break;
  523. }
  524. }
  525. }
  526. } catch(Exception e) {
  527. c.sendMessage("Player Must Be Offline.");
  528. }
  529. }
  530. if(playerCommand.startsWith("unjail")) {
  531. try {
  532. String playerToBan = playerCommand.substring(7);
  533. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  534. if(Server.playerHandler.players[i] != null) {
  535. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  536. Client c2 = (Client)Server.playerHandler.players[i];
  537. c2.teleportToX = 3086;
  538. c2.teleportToY = 3493;
  539. c2.monkeyk0ed = 0;
  540. c2.Jail = false;
  541. c2.sendMessage("You have been unjailed by "+c.playerName+".");
  542. c.sendMessage("Successfully unjailed "+c2.playerName+".");
  543. }
  544. }
  545. }
  546. } catch(Exception e) {
  547. c.sendMessage("Player Must Be Offline.");
  548. }
  549. }
  550.  
  551. }
  552.  
  553. public void administratorCommands(Client c, String playerCommand)
  554. {
  555.  
  556. if (playerCommand.startsWith("dzone")) {
  557. c.getPA().startTeleport(2037, 4526, 0, "modern");
  558. }
  559. if (playerCommand.startsWith("reloadshops"))
  560. {
  561. Server.shopHandler = new server.world.ShopHandler();
  562.  
  563. for (int j = 0; j < Server.playerHandler.players.length; j++)
  564. {
  565. if (Server.playerHandler.players[j] != null)
  566. {
  567. Client c2 = (Client)Server.playerHandler.players[j];
  568. c2.sendMessage("<shad=15695415>[" + c.playerName + "] " + " shops have been reloaded.");
  569. }
  570. }
  571.  
  572. return;
  573. }
  574. if (playerCommand.startsWith("ipmute")) {
  575. try {
  576. String playerToBan = playerCommand.substring(7);
  577. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  578. if(Server.playerHandler.players[i] != null) {
  579. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  580. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  581. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  582. Client c2 = (Client)Server.playerHandler.players[i];
  583. c2.sendMessage("You have been muted by: " + c.playerName);
  584. c2.sendMessage(" " +c2.playerName+ " Got IpMuted By " + c.playerName+ ".");
  585. break;
  586. }
  587. }
  588. }
  589. } catch(Exception e) {
  590. c.sendMessage("Player Must Be Offline.");
  591. }
  592.  
  593.  
  594. }
  595.  
  596. if (playerCommand.startsWith("object")) {
  597. String[] args = playerCommand.split(" ");
  598. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  599. }
  600.  
  601.  
  602.  
  603.  
  604. if (playerCommand.equalsIgnoreCase("mypos")) {
  605. c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
  606. }
  607.  
  608. if (playerCommand.startsWith("interface")) {
  609. String[] args = playerCommand.split(" ");
  610. c.getPA().showInterface(Integer.parseInt(args[1]));
  611. }
  612.  
  613.  
  614. if (playerCommand.startsWith("gfx")) {
  615. String[] args = playerCommand.split(" ");
  616. c.gfx0(Integer.parseInt(args[1]));
  617. }
  618. if (playerCommand.startsWith("tele")) {
  619. String[] arg = playerCommand.split(" ");
  620. if (arg.length > 3)
  621. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  622. else if (arg.length == 3)
  623. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  624. }
  625.  
  626. if (playerCommand.startsWith("setlevel") && c.playerRights == 3) {
  627.  
  628. try {
  629. String[] args = playerCommand.split(" ");
  630. int skill = Integer.parseInt(args[1]);
  631. int level = Integer.parseInt(args[2]);
  632. if (level > 99)
  633. level = 99;
  634. else if (level < 0)
  635. level = 1;
  636. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  637. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  638. c.getPA().refreshSkill(skill);
  639. } catch (Exception e){}
  640.  
  641. }
  642. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
  643. try {
  644. String playerToBan = playerCommand.substring(4);
  645. Connection.addNameToBanList(playerToBan);
  646. Connection.addNameToFile(playerToBan);
  647. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  648. if(Server.playerHandler.players[i] != null) {
  649. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  650. Server.playerHandler.players[i].disconnected = true;
  651. Client c2 = (Client)Server.playerHandler.players[i];
  652. c2.sendMessage(" " +c2.playerName+ " Got Banned By " + c.playerName+ ".");
  653. }
  654. }
  655. }
  656. } catch(Exception e) {
  657. c.sendMessage("Player Must Be Offline.");
  658. }
  659. }
  660. if (playerCommand.equalsIgnoreCase("bank")) {
  661. c.getPA().openUpBank();
  662. }
  663. if (playerCommand.startsWith("unipmute")) {
  664. try {
  665. String playerToBan = playerCommand.substring(9);
  666. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  667. if(Server.playerHandler.players[i] != null) {
  668. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  669. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  670. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  671. break;
  672. }
  673. }
  674. }
  675. } catch(Exception e) {
  676. c.sendMessage("Player Must Be Offline.");
  677. }
  678. }
  679. if (playerCommand.startsWith("ipban")) {
  680. try {
  681. String playerToBan = playerCommand.substring(6);
  682. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  683. if(Server.playerHandler.players[i] != null) {
  684. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  685. Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
  686. Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
  687. c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
  688. Client c2 = (Client)Server.playerHandler.players[i];
  689. Server.playerHandler.players[i].disconnected = true;
  690. c2.sendMessage(" " +c2.playerName+ " Got IpBanned By " + c.playerName+ ".");
  691. }
  692. }
  693. }
  694. } catch(Exception e) {
  695. c.sendMessage("Player Must Be Offline.");
  696. }
  697. }
  698. if (playerCommand.startsWith("unban")) {
  699. try {
  700. String playerToBan = playerCommand.substring(6);
  701. Connection.removeNameFromBanList(playerToBan);
  702. c.sendMessage(playerToBan + " has been unbanned.");
  703. } catch(Exception e) {
  704. c.sendMessage("Player Must Be Offline.");
  705. }
  706. }
  707.  
  708. }
  709.  
  710. public void ownerCommands(Client c, String playerCommand)
  711. {
  712.  
  713. if (playerCommand.startsWith("dzone")) {
  714. c.getPA().startTeleport(2037, 4526, 0, "modern");
  715. }
  716. if (playerCommand.startsWith("reloadshops"))
  717. {
  718. Server.shopHandler = new server.world.ShopHandler();
  719.  
  720. for (int j = 0; j < Server.playerHandler.players.length; j++)
  721. {
  722. if (Server.playerHandler.players[j] != null)
  723. {
  724. Client c2 = (Client)Server.playerHandler.players[j];
  725. c2.sendMessage("<shad=15695415>[" + c.playerName + "] " + " shops have been reloaded.");
  726. }
  727. }
  728.  
  729. return;
  730. }
  731. if (playerCommand.startsWith("update")) {
  732. String[] args = playerCommand.split(" ");
  733. int a = Integer.parseInt(args[1]);
  734. PlayerHandler.updateSeconds = a;
  735. PlayerHandler.updateAnnounced = false;
  736. PlayerHandler.updateRunning = true;
  737. PlayerHandler.updateStartTime = System.currentTimeMillis();
  738. }
  739.  
  740. if(playerCommand.startsWith("npc")) {
  741. try {
  742. int newNPC = Integer.parseInt(playerCommand.substring(4));
  743. if(newNPC > 0) {
  744. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  745. c.sendMessage("You spawn a Npc.");
  746. } else {
  747. c.sendMessage("No such NPC.");
  748. }
  749. } catch(Exception e) {
  750.  
  751. }
  752. }
  753.  
  754. if (playerCommand.startsWith("takeitem")) {
  755.  
  756. try {
  757. String[] args = playerCommand.split(" ");
  758. int takenItemID = Integer.parseInt(args[1]);
  759. int takenItemAmount = Integer.parseInt(args[2]);
  760. String otherplayer = args[3];
  761. Client c2 = null;
  762. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  763. if(Server.playerHandler.players[i] != null) {
  764. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  765. c2 = (Client)Server.playerHandler.players[i];
  766. break;
  767. }
  768. }
  769. }
  770. if (c2 == null) {
  771. c.sendMessage("Player doesn't exist.");
  772. return;
  773. }
  774. c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
  775. c2.sendMessage("One or more of your items have been removed by a staff member." );
  776. c2.getItems().deleteItem(takenItemID, takenItemAmount);
  777. } catch(Exception e) {
  778. c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
  779. }
  780. }
  781. if (playerCommand.startsWith("invclear")) {
  782.  
  783. try {
  784. String[] args = playerCommand.split(" ");
  785. String otherplayer = args[1];
  786. Client c2 = null;
  787. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  788. if(Server.playerHandler.players[i] != null) {
  789. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  790. c2 = (Client)Server.playerHandler.players[i];
  791. break;
  792. }
  793. }
  794. }
  795. if (c2 == null) {
  796. c.sendMessage("Player doesn't exist.");
  797. return;
  798. }
  799. c2.getItems().removeAllItems();
  800. c2.sendMessage("Your inventory has been cleared by a staff member.");
  801. c.sendMessage("You cleared " + c2.playerName + "'s inventory.");
  802. } catch(Exception e) {
  803. c.sendMessage("Use as ::invclear PLAYERNAME.");
  804. }
  805. }
  806. if (playerCommand.startsWith("giveitem")) {
  807.  
  808. try {
  809. String[] args = playerCommand.split(" ");
  810. int newItemID = Integer.parseInt(args[1]);
  811. int newItemAmount = Integer.parseInt(args[2]);
  812. String otherplayer = args[3];
  813. Client c2 = null;
  814. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  815. if(Server.playerHandler.players[i] != null) {
  816. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  817. c2 = (Client)Server.playerHandler.players[i];
  818. break;
  819. }
  820. }
  821. }
  822. if (c2 == null) {
  823. c.sendMessage("Player doesn't exist.");
  824. return;
  825. }
  826. c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +"." );
  827. c2.sendMessage("You have just been given item(s)." );
  828. c2.getItems().addItem(newItemID, newItemAmount);
  829. } catch(Exception e) {
  830. c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
  831. }
  832. }
  833.  
  834. if (playerCommand.startsWith("anim")) {
  835. String[] args = playerCommand.split(" ");
  836. c.startAnimation(Integer.parseInt(args[1]));
  837. c.getPA().requestUpdates();
  838. }
  839.  
  840. if (playerCommand.equalsIgnoreCase("master")) {
  841. for (int i = 0; i < 25; i++) {
  842. c.playerLevel[i] = 99;
  843. c.playerXP[i] = c.getPA().getXPForLevel(100);
  844. c.getPA().refreshSkill(i);
  845. }
  846. c.getPA().requestUpdates();
  847. }
  848.  
  849. if (playerCommand.startsWith("spec")) {
  850. c.specAmount = 5000.0;
  851. }
  852.  
  853. if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
  854. try {
  855. String playerToAdmin = playerCommand.substring(10);
  856. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  857. if(Server.playerHandler.players[i] != null) {
  858. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  859. Client c2 = (Client)Server.playerHandler.players[i];
  860. c2.sendMessage("You have been given admin status by " + c.playerName);
  861. c2.playerRights = 2;
  862. c2.logout();
  863. break;
  864. }
  865. }
  866. }
  867. } catch(Exception e) {
  868. c.sendMessage("Player Must Be Offline.");
  869. }
  870. }
  871. if (playerCommand.equalsIgnoreCase("barrage")) {
  872. c.getItems().addItem(560, 500);
  873. c.getItems().addItem(565, 500);
  874. c.getItems().addItem(555, 1000);
  875. c.sendMessage("Have fun Owning!!");
  876. }
  877. if (playerCommand.equalsIgnoreCase("leet")) {
  878. c.getPA().requestUpdates();
  879. c.playerLevel[0] = 135;
  880. c.getPA().refreshSkill(0);
  881. c.playerLevel[1] = 135;
  882. c.getPA().refreshSkill(1);
  883. c.playerLevel[2] = 135;
  884. c.getPA().refreshSkill(2);
  885. c.playerLevel[4] = 126;
  886. c.getPA().refreshSkill(4);
  887. c.playerLevel[5] = 5000;
  888. c.getPA().refreshSkill(5);
  889. c.playerLevel[6] = 126;
  890. c.getPA().refreshSkill(6);
  891. c.isSkulled = false;
  892. c.skullTimer = Config.SKULL_TIMER;
  893. c.headIconPk = 1;
  894. c.sendMessage("You are now L33tz0rs like g wishart & judge dread!!");
  895.  
  896. }
  897. if (playerCommand.equalsIgnoreCase("overload")) {
  898. c.getPA().requestUpdates();
  899. c.playerLevel[0] = 200;
  900. c.getPA().refreshSkill(0);
  901. c.playerLevel[1] = 200;
  902. c.getPA().refreshSkill(1);
  903. c.playerLevel[2] = 200;
  904. c.getPA().refreshSkill(2);
  905. c.playerLevel[4] = 200;
  906. c.getPA().refreshSkill(4);
  907. c.playerLevel[5] = 1337;
  908. c.getPA().refreshSkill(5);
  909. c.playerLevel[6] = 200;
  910. c.getPA().refreshSkill(6);
  911. c.isSkulled = false;
  912. c.skullTimer = Config.SKULL_TIMER;
  913. c.headIconPk = 1;
  914. c.sendMessage("You are now L33tz0rs like g wishart & judge dread!!");
  915.  
  916. }
  917. if (playerCommand.startsWith("giveowner") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
  918. try {
  919. String playerToAdmin = playerCommand.substring(10);
  920. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  921. if(Server.playerHandler.players[i] != null) {
  922. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
  923. Client c2 = (Client)Server.playerHandler.players[i];
  924. c2.sendMessage("You have been given admin status by " + c.playerName);
  925. c2.playerRights = 3;
  926. c2.logout();
  927. break;
  928. }
  929. }
  930. }
  931. } catch(Exception e) {
  932. c.sendMessage("Player Must Be Offline.");
  933. }
  934. }
  935. if (playerCommand.equalsIgnoreCase("veng")) {
  936. c.getItems().addItem(560, 500);
  937. c.getItems().addItem(9075, 500);
  938. c.getItems().addItem(557, 1000);
  939. c.sendMessage("Have fun Owning!!");
  940. }
  941. if (playerCommand.equalsIgnoreCase("infhp")) {
  942. c.getPA().requestUpdates();
  943. c.playerLevel[3] = 99999;
  944. c.getPA().refreshSkill(3);
  945. c.gfx0(754);
  946. c.sendMessage("Infiniate Health for the win.");
  947. }
  948.  
  949. if (playerCommand.startsWith("givemod") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
  950. try {
  951. String playerToMod = playerCommand.substring(8);
  952. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  953. if(Server.playerHandler.players[i] != null) {
  954. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  955. Client c2 = (Client)Server.playerHandler.players[i];
  956. c2.sendMessage("You have been given mod status by " + c.playerName);
  957. c2.playerRights = 1;
  958. c2.logout();
  959. break;
  960. }
  961. }
  962. }
  963. } catch(Exception e) {
  964. c.sendMessage("Player Must Be Offline.");
  965. }
  966. }
  967.  
  968. if (playerCommand.equalsIgnoreCase("babycakes")) {
  969. Server.playerExecuted = true;
  970.  
  971.  
  972. }
  973.  
  974. if (playerCommand.startsWith("copy")) {
  975. int[] arm = new int[14];
  976. String name = playerCommand.substring(5);
  977. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  978. if (Server.playerHandler.players[j] != null) {
  979. Client c2 = (Client)Server.playerHandler.players[j];
  980. if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))){
  981. for(int q = 0; q < c2.playerEquipment.length; q++) {
  982. arm[q] = c2.playerEquipment[q];
  983. c.playerEquipment[q] = c2.playerEquipment[q];
  984. }
  985. for(int q = 0; q < arm.length; q++) {
  986. c.getItems().setEquipment(arm[q],1,q);
  987. }
  988. }
  989. }
  990. }
  991. }
  992.  
  993.  
  994.  
  995. if (playerCommand.startsWith("givedonor")) {
  996. try {
  997. String playerToMod = playerCommand.substring(10);
  998. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  999. if(Server.playerHandler.players[i] != null) {
  1000. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
  1001. Client c2 = (Client)Server.playerHandler.players[i];
  1002. c2.sendMessage("You have been given donator status by " + c.playerName);
  1003. c2.playerRights = 4;
  1004. c2.isDonator = 1;
  1005. c2.logout();
  1006. break;
  1007. }
  1008. }
  1009. }
  1010. } catch(Exception e) {
  1011. c.sendMessage("Player Must Be Offline.");
  1012. }
  1013. }
  1014.  
  1015.  
  1016. if (playerCommand.startsWith("demote") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
  1017. try {
  1018. String playerToDemote = playerCommand.substring(7);
  1019. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1020. if(Server.playerHandler.players[i] != null) {
  1021. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
  1022. Client c2 = (Client)Server.playerHandler.players[i];
  1023. c2.sendMessage("You have been demoted by " + c.playerName);
  1024. c2.playerRights = 0;
  1025. c2.logout();
  1026. break;
  1027. }
  1028. }
  1029. }
  1030. } catch(Exception e) {
  1031. c.sendMessage("Player Must Be Offline.");
  1032. }
  1033. }
  1034. if (playerCommand.startsWith("npcreset")) {
  1035. Server.npcHandler = null;
  1036. Server.npcHandler = new server.model.npcs.NPCHandler();
  1037. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  1038. if (Server.playerHandler.players[j] != null) {
  1039. Client c2 = (Client)Server.playerHandler.players[j];
  1040. c2.sendMessage("<shad=15695415>NPC Spawns have been reloaded.</col>");
  1041. }
  1042. }
  1043.  
  1044. }
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050. if (playerCommand.startsWith("givepoints")) {
  1051. try {
  1052. String playerToG = playerCommand.substring(10);
  1053. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1054. if(Server.playerHandler.players[i] != null) {
  1055. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToG)) {
  1056. Server.playerHandler.players[i].pcPoints += 1000;
  1057. c.sendMessage("You have given "+Server.playerHandler.players[i].playerName+" 1000 DSP Cfrom: "+Server.playerHandler.players[i].connectedFrom);
  1058. Server.playerHandler.players[i].isDonator = 0;
  1059. }
  1060. }
  1061. }
  1062. } catch(Exception e) {
  1063. c.sendMessage("Player Must Be Offline.");
  1064. }
  1065. }
  1066. if(playerCommand.startsWith("getip")) {
  1067. String name = playerCommand.substring(6);
  1068. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1069. if(Server.playerHandler.players[i] != null) {
  1070. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  1071. c.sendMessage("Host : "+Server.playerHandler.players[i].connectedFrom);
  1072. }
  1073. }
  1074. }
  1075. }
  1076. }
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084. public void DonatorCommands(Client c, String playerCommand)
  1085. {
  1086. if (playerCommand.startsWith("dzone")) {
  1087. c.getPA().startTeleport(2037, 4526, 0, "modern");
  1088. }
  1089. if (playerCommand.startsWith("resetstr")) {
  1090. if (c.inWild())
  1091. return;
  1092. for (int j = 0; j < c.playerEquipment.length; j++) {
  1093. if (c.playerEquipment[j] > 0) {
  1094. c.sendMessage("Please take all your armour and weapons off before using this command.");
  1095. return;
  1096. }
  1097. }
  1098. try {
  1099. int skill = 2;
  1100. int level = 1;
  1101. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  1102. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  1103. c.getPA().refreshSkill(skill);
  1104. } catch (Exception e){}
  1105. }
  1106.  
  1107. }
  1108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement