Advertisement
Guest User

Untitled

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