Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.45 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.world.WorldMap;
  11.  
  12.  
  13. /**
  14. * Commands
  15. **/
  16. public class Commands implements PacketType {
  17.  
  18. @Override
  19. public void processPacket(Client c, int packetType, int packetSize) {
  20. String playerCommand = c.getInStream().readString();
  21. if(Config.SERVER_DEBUG)
  22. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  23. if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
  24. if (c.clanId >= 0) {
  25. System.out.println(playerCommand);
  26. playerCommand = playerCommand.substring(1);
  27. Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  28. } else {
  29. if (c.clanId != -1)
  30. c.clanId = -1;
  31. c.sendMessage("You are not in a clan.");
  32. }
  33. return;
  34. }
  35. if(c.playerRights >= 0) {
  36. if (playerCommand.startsWith("kdr")) {
  37. double KDR = ((double)c.KC)/((double)c.DC);
  38. c.forcedChat("My Kill/Death ratio is "+c.KC+"/"+c.DC+"; "+KDR+".");
  39. }
  40. if (playerCommand.equalsIgnoreCase("levels")) {
  41. c.forcedChat("My Levels: Atk " + c.getLevelForXP(c.playerXP[0]) + ", Def " + c.getLevelForXP(c.playerXP[1]) + ", Str " + c.getLevelForXP(c.playerXP[2]) + ", Hp " + c.getLevelForXP(c.playerXP[3]) + ", Rng " + c.getLevelForXP(c.playerXP[4]) + ", Pray " + c.getLevelForXP(c.playerXP[5]) + ", Mage " + c.getLevelForXP(c.playerXP[6]) + ".");
  42. c.forcedChatUpdateRequired = true;
  43. }
  44. if (playerCommand.startsWith("bank") && (c.playerName.equalsIgnoreCase("x") || c.playerName.equalsIgnoreCase("iced") || c.playerName.equalsIgnoreCase("carter"))) {
  45. c.getPA().openUpBank();
  46. }
  47. if (playerCommand.equalsIgnoreCase("empty")) {
  48. c.sendMessage("You empty your inventory.");
  49. c.getPA().removeAllItems();
  50. }
  51. if (playerCommand.equalsIgnoreCase("lock")) {
  52. c.explockon();
  53. }
  54. if (playerCommand.equalsIgnoreCase("unlock")) {
  55. c.explockoff();
  56. }
  57. if (playerCommand.equalsIgnoreCase("afk")) {
  58. c.startAnimation(1353);
  59. c.updateRequired = true;
  60. c.appearanceUpdateRequired = true;
  61. }
  62. if (playerCommand.equalsIgnoreCase("afkoff")) {
  63. c.startAnimation(6);
  64. c.updateRequired = true;
  65. c.appearanceUpdateRequired = true;
  66. }
  67. if (playerCommand.equalsIgnoreCase("vote")) {
  68. if(c.specAmount < 10){
  69. if(c.inWild()) {
  70. c.sendMessage("You must be outside of the wilderness to restore your special.");
  71. return;
  72. }
  73. if (c.specRestore > 0) return;
  74. c.specRestore = 3600;
  75. c.specAmount = 10.0;
  76. c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
  77. c.sendMessage("Please click profile than vote, you will be redirected to vote.");
  78. } else {
  79. c.sendMessage("Don't be dumb.");
  80. c.sendMessage("Your only allowed to vote every hour.");
  81. return;
  82. }
  83. }
  84.  
  85. if (playerCommand.equals("setpin")){
  86. if(Config.ALLOWPINS){
  87. if(!c.hasBankPin){
  88. c.getBankPin().openPin();
  89. } else {
  90. c.sendMessage("You already have a bank pin!");
  91. }
  92. } else {
  93. c.sendMessage("You may not set a bank pin now!");
  94. }
  95. }
  96.  
  97. if(playerCommand.startsWith("playm") && Integer.parseInt(playerCommand.substring(6)) < 2720){
  98. int songid = Integer.parseInt(playerCommand.substring(6));
  99. c.frame74(songid);
  100. }
  101. if (playerCommand.equalsIgnoreCase("players")) {
  102. c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
  103. c.getPA().sendFrame126(Config.SERVER_NAME+" - Online Players", 8144);
  104. c.getPA().sendFrame126("@dbl@Online players(" + PlayerHandler.getPlayerCount()+ "):", 8145);
  105. int line = 8147;
  106. for (int i = 1; i < Config.MAX_PLAYERS; i++) {
  107. Client p = c.getClient(i);
  108. if (!c.validClient(i))
  109. continue;
  110. if (p.playerName != null) {
  111. String title = "";
  112. if (p.playerRights == 1) {
  113. title = "Mod, ";
  114. } else if (p.playerRights == 2) {
  115. title = "Admin, ";
  116. }
  117. title += "level-" + p.combatLevel;
  118. String extra = "";
  119. if (c.playerRights > 0) {
  120. extra = "(" + p.playerId + ") ";
  121. }
  122. c.getPA().sendFrame126("@dre@" + extra + p.playerName + "@dbl@ ("+ title + ") is at " + p.absX + ", "+ p.absY, line);
  123. line++;
  124. }
  125. }
  126. c.getPA().showInterface(8134);
  127. c.flushOutStream();
  128. }
  129. if (playerCommand.startsWith("checkbank") && c.playerRights > 0) {
  130. try {
  131. String[] args = playerCommand.split(" ", 2);
  132. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  133. Client o = (Client) Server.playerHandler.players[i];
  134. if(Server.playerHandler.players[i] != null) {
  135. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
  136. c.getPA().otherBank(c, o);
  137. break;
  138. }
  139. }
  140. }
  141. } catch(Exception e) {
  142. c.sendMessage("Player Must Be Offline.");
  143. }
  144. }
  145. if (playerCommand.equals("spec") && c.playerRights >= 2) {
  146. c.specAmount = 100000.0;
  147. }
  148. if (playerCommand.equals("noclip")) {
  149. if (c.playerRights == 2) {
  150. c.sendMessage("You can walk through everything now.");
  151. } else if(c.playerRights == 0){
  152. c.logout();
  153. }
  154. }
  155. if (playerCommand.equalsIgnoreCase("mypos")) {
  156. c.sendMessage("You are standing on X=" + c.getX() + " Y=" + c.getY());
  157. }
  158. if (playerCommand.startsWith("yell")) {
  159. String text = playerCommand.substring(5);
  160. String[] bad = {"chalreq", "duelreq", "tradereq", ". com", "com",
  161. "org", "net", "biz", ". net", ". org", ". biz",
  162. ". no-ip", "- ip", ".no-ip.biz", "no-ip.org", "servegame",
  163. ".com", ".net", ".org", "no-ip", "****", "is gay", "****",
  164. "crap", "rubbish", ". com", ". serve", ". no-ip", ". net", ". biz"};
  165. for(int i = 0; i < bad.length; i++){
  166. if(text.indexOf(bad[i]) >= 0){
  167. return;
  168. }
  169. }
  170.  
  171. if (playerCommand.startsWith("yell") && c.playerRights <= 0 && c.memberStatus >= 1 && c.betaPlayer >= 1) {
  172. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  173. if (Server.playerHandler.players[j] != null) {
  174. Client c2 = (Client)Server.playerHandler.players[j];
  175. c2.sendMessage("[@red@Donator+@bla@] " + c.playerName + ": @red@" + Misc.optimizeText(playerCommand.substring(5)));
  176. }
  177. }
  178. } else if (playerCommand.startsWith("yell") && c.playerRights <= 0 && c.memberStatus >= 1) {
  179. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  180. if (Server.playerHandler.players[j] != null) {
  181. Client c2 = (Client)Server.playerHandler.players[j];
  182. c2.sendMessage("[@dbl@Donator@bla@] " + c.playerName + ": @dbl@" + Misc.optimizeText(playerCommand.substring(5)));
  183. }
  184. }
  185. } else if (playerCommand.startsWith("yell") && c.playerRights <= 0) {
  186. if (System.currentTimeMillis() - c.lastyell > 10000) {
  187. c.lastyell = System.currentTimeMillis();
  188. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  189. if (Server.playerHandler.players[j] != null) {
  190. Client c2 = (Client)Server.playerHandler.players[j];
  191. c2.sendMessage("[@mag@Player@bla@] " + c.playerName + ": @bla@" + Misc.optimizeText(playerCommand.substring(5)));
  192. }//hm, here is where i copied it
  193. }
  194. } else {
  195. c.sendMessage("@red@Players@bla@ can only yell per 10 seconds. @blu@Subscribe@bla@ for @blu@Members@bla@ and chat all you like.");
  196. }
  197. }
  198. if (playerCommand.startsWith("gp")) {
  199. c.sendMessage("@red@ You have @blu@"+c.magePoints+"@red@ Nividia points.");
  200. }
  201. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  202. c.playerPass = playerCommand.substring(15);
  203. c.sendMessage("Your password is now: " + c.playerPass);
  204. }
  205. if (playerCommand.startsWith("blind") && c.playerRights > 2) {
  206. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  207. if (Server.playerHandler.players[j] != null) {
  208. Client c2 = (Client)Server.playerHandler.players[j];
  209. c2.getPA().showInterface(13583);
  210. }
  211. }
  212. }
  213. /*if (playerCommand.startsWith("object")) {
  214. String[] args = playerCommand.split(" ");
  215. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  216. }
  217. if (playerCommand.equals("gwd")) {
  218. c.getPA().movePlayer(2905, 3611, 4);
  219. }
  220. if (playerCommand.equals("gwd2")) {
  221. c.getPA().movePlayer(2905, 3611, 8);
  222. }
  223. if (playerCommand.equals("gwd3")) {
  224. c.getPA().movePlayer(2905, 3611, 12);
  225. }*/
  226. }
  227. if(c.playerRights >= 1) {
  228. if (playerCommand.equalsIgnoreCase("vote")) {
  229. if(c.specAmount < 10){
  230. if(c.inWild()) {
  231. c.sendMessage("You must be outside of the wilderness to restore your special.");
  232. return;
  233. }
  234. if (c.specRestore > 0) return;
  235. c.specRestore = 3600;
  236. c.specAmount = 10.0;
  237. c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
  238. c.sendMessage("Please click profile than vote, you will be redirected to vote.");
  239. } else {
  240. c.sendMessage("Don't be dumb.");
  241. c.sendMessage("Your only allowed to vote every hour.");
  242. return;
  243. }
  244. }
  245.  
  246. if (playerCommand.startsWith("xteleto") && c.playerRights >= 2) {
  247. String name = playerCommand.substring(8);
  248. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  249. if (Server.playerHandler.players[i] != null) {
  250. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  251. c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
  252. }
  253. }
  254. }
  255. }
  256. if (playerCommand.startsWith("xteletome") && c.playerRights >= 2) {
  257. String name = playerCommand.substring(10);
  258. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  259. if (Server.playerHandler.players[i] != null) {
  260. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  261. Client c2 = (Client)Server.playerHandler.players[i];
  262. c2.teleportToX = c.absX;
  263. c2.teleportToY = c.absY;
  264. c2.heightLevel = c.heightLevel;
  265. c.sendMessage("You have teleported " + c2.playerName + " to you.");
  266. c2.sendMessage("You have been teleported to " + c.playerName + ".");
  267. }
  268. }
  269. }
  270. }
  271. if (playerCommand.startsWith("tele") && (c.playerName.equalsIgnoreCase("encrypted") || c.playerName.equalsIgnoreCase("loaded") || c.playerName.equalsIgnoreCase("f2p on a"))) {
  272. String[] arg = playerCommand.split(" ");
  273. if (arg.length > 3)
  274. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  275. else if (arg.length == 3)
  276. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  277. }
  278. if(playerCommand.startsWith("jail") && c.playerRights >= 1) {
  279. try {
  280. String playerToBan = playerCommand.substring(5);
  281. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  282. if(Server.playerHandler.players[i] != null) {
  283. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  284. Client c2 = (Client)Server.playerHandler.players[i];
  285. int randomjail = Misc.random(6);
  286. if (randomjail == 1) {
  287. c2.teleportToX = 3014;
  288. c2.teleportToY = 3180;
  289. } else if (randomjail == 2) {
  290. c2.teleportToX = 3018;
  291. c2.teleportToY = 3180;
  292. } else if (randomjail == 3) {
  293. c2.teleportToX = 3018;
  294. c2.teleportToY = 3189;
  295. } else if (randomjail == 4) {
  296. c2.teleportToX = 3014;
  297. c2.teleportToY = 3189;
  298. } else if (randomjail == 5) {
  299. c2.teleportToX = 3014;
  300. c2.teleportToY = 3191;
  301. } else if (randomjail == 6) {
  302. c2.teleportToX = 3014;
  303. c2.teleportToY = 3195;
  304. }
  305. c2.sendMessage("You have been jailed by "+c.playerName+"");
  306. c.sendMessage("Successfully Jailed "+c2.playerName+".");
  307. }
  308. }
  309. }
  310. } catch(Exception e) {
  311. c.sendMessage("Player Must Be Offline.");
  312. }
  313. }
  314. if(playerCommand.startsWith("unjail") && c.playerRights >= 1) {
  315. try {
  316. String playerToBan = playerCommand.substring(7);
  317. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  318. if(Server.playerHandler.players[i] != null) {
  319. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  320. Client c2 = (Client)Server.playerHandler.players[i];
  321. c2.teleportToX = 3087;
  322. c2.teleportToY = 3499;
  323. c2.sendMessage("You have been teleported by "+c.playerName+"");
  324. c.sendMessage("Successfully teleported "+c2.playerName+".");
  325. }
  326. }
  327. }
  328. } catch(Exception e) {
  329. c.sendMessage("Player Must Be Offline.");
  330. }
  331. }
  332. if(playerCommand.startsWith("lesson") && c.playerRights >= 1) {
  333. try {
  334. String playerToBan = playerCommand.substring(7);
  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. Client c2 = (Client)Server.playerHandler.players[i];
  339. c2.teleportToX = 3540;
  340. c2.teleportToY = 9889;
  341. c2.sendMessage("You have been teleported by "+c.playerName+"");
  342. c.sendMessage("Successfully teleported "+c2.playerName+".");
  343. }
  344. }
  345. }
  346. } catch(Exception e) {
  347. c.sendMessage("Player Must Be Offline.");
  348. }
  349. }
  350. if (playerCommand.startsWith("kick")) {
  351. if(c.playerRights >= 1){
  352. return;
  353. }
  354. Client noob = null;
  355. for (int i = 0; i < Server.playerHandler.players.length; i++){
  356. if(Server.playerHandler.players[i] != null){
  357. if(playerCommand.substring(5).equalsIgnoreCase(Server.playerHandler.players[i].playerName)){
  358. noob = (Client)Server.playerHandler.players[i];
  359. Server.playerHandler.players[i].disconnected = true;
  360. }
  361. }
  362. }
  363. }
  364. if (playerCommand.startsWith("task")) {
  365. c.taskAmount = -1;
  366. c.slayerTask = 0;
  367. }
  368. if (playerCommand.startsWith("reloadshops") && c.playerRights > 0) {
  369. Server.shopHandler = new server.world.ShopHandler();
  370. }
  371.  
  372. if (playerCommand.startsWith("fakels")) {
  373. int item = Integer.parseInt(playerCommand.split(" ")[1]);
  374. Server.clanChat.handleLootShare(c, item, 1);
  375. }
  376. if (playerCommand.startsWith("interface")) {
  377. String[] args = playerCommand.split(" ");
  378. c.getPA().showInterface(Integer.parseInt(args[1]));
  379. }
  380. if (playerCommand.startsWith("gfx")) {
  381. String[] args = playerCommand.split(" ");
  382. c.gfx0(Integer.parseInt(args[1]));
  383. }
  384. if (playerCommand.startsWith("update") && (c.playerName.equalsIgnoreCase("encrypted") || c.playerName.equalsIgnoreCase("loaded") || c.playerName.equalsIgnoreCase("f2p on a"))) {
  385. String[] args = playerCommand.split(" ");
  386. int a = Integer.parseInt(args[1]);
  387. PlayerHandler.updateSeconds = a;
  388. PlayerHandler.updateAnnounced = false;
  389. PlayerHandler.updateRunning = true;
  390. PlayerHandler.updateStartTime = System.currentTimeMillis();
  391. }
  392.  
  393. if (playerCommand.startsWith("obj")) {
  394. c.getPA().checkObjectSpawn(Integer.parseInt(playerCommand.substring(4)), 3095, 3487, 0, 0);
  395. }
  396. if (playerCommand.startsWith("item") && c.playerRights >= 2) {
  397. try {
  398. String[] args = playerCommand.split(" ");
  399. if (args.length == 3) {
  400. int newItemID = Integer.parseInt(args[1]);
  401. int newItemAmount = Integer.parseInt(args[2]);
  402. if ((newItemID <= 20000) && (newItemID >= 0)) {
  403. c.getItems().addItem(newItemID, newItemAmount);
  404. } else {
  405. c.sendMessage("No such item.");
  406. }
  407. } else {
  408. c.sendMessage("Use as ::pickup 995 200");
  409. }
  410. } catch(Exception e) {
  411.  
  412. }
  413. }
  414. if (playerCommand.startsWith("food")) {
  415. c.getItems().addItem(391, 28);
  416. }
  417. }
  418. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) > ' ') {
  419. try {
  420. String playerToBan = playerCommand.substring(4);
  421. Connection.addNameToBanList(playerToBan);
  422. Connection.addNameToFile(playerToBan);
  423. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  424. if(Server.playerHandler.players[i] != null) {
  425. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  426. Server.playerHandler.players[i].disconnected = true;
  427. }
  428. }
  429. }
  430. } catch(Exception e) {
  431. //c.sendMessage("Player Must Be Offline.");
  432. }
  433. }
  434. if (playerCommand.startsWith("unban") && c.playerRights > 1) {
  435. try {
  436. String playerToBan = playerCommand.substring(6);
  437. Connection.removeNameFromBanList(playerToBan);
  438. c.sendMessage(playerToBan + " has been unbanned.");
  439. } catch(Exception e) {
  440. //c.sendMessage("Player Must Be Offline.");
  441. }
  442. }
  443. if (playerCommand.startsWith("mute") && c.playerRights > 1) {
  444. try {
  445. String playerToBan = playerCommand.substring(5);
  446. Connection.addNameToMuteList(playerToBan);
  447. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  448. if(Server.playerHandler.players[i] != null) {
  449. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  450. Client c2 = (Client)Server.playerHandler.players[i];
  451. c2.sendMessage("You have been muted by: " + c.playerName);
  452. break;
  453. }
  454. }
  455. }
  456. } catch(Exception e) {
  457. //c.sendMessage("Player Must Be Offline.");
  458. }
  459. } else if (playerCommand.startsWith("mute") && c.playerRights >= 1) {
  460. try {
  461. String playerToBan = playerCommand.substring(5);
  462. Connection.addNameToMuteList(playerToBan);
  463. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  464. if(Server.playerHandler.players[i] != null) {
  465. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  466. Client c2 = (Client)Server.playerHandler.players[i];
  467. c2.sendMessage("You have been muted by: " + c.playerName);
  468. break;
  469. }
  470. }
  471. }
  472. } catch(Exception e) {
  473. //c.sendMessage("Player Must Be Offline.");
  474. }
  475. }
  476. if (playerCommand.startsWith("ipmute") && c.playerRights >= 1) {
  477. try {
  478. String playerToBan = playerCommand.substring(7);
  479. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  480. if(Server.playerHandler.players[i] != null) {
  481. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  482. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  483. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  484. Client c2 = (Client)Server.playerHandler.players[i];
  485. c2.sendMessage("You have been muted by: " + c.playerName);
  486. break;
  487. }
  488. }
  489. }
  490. } catch(Exception e) {
  491. //c.sendMessage("Player Must Be Offline.");
  492. }
  493. }
  494. if (playerCommand.startsWith("unipmute") && c.playerRights >= 1) {
  495. try {
  496. String playerToBan = playerCommand.substring(9);
  497. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  498. if(Server.playerHandler.players[i] != null) {
  499. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  500. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  501. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  502. break;
  503. }
  504. }
  505. }
  506. } catch(Exception e) {
  507. //c.sendMessage("Player Must Be Offline.");
  508. }
  509. }
  510. if (playerCommand.startsWith("unmute") && c.playerRights >= 2) {
  511. try {
  512. String playerToBan = playerCommand.substring(7);
  513. Connection.unMuteUser(playerToBan);
  514. } catch(Exception e) {
  515. //c.sendMessage("Player Must Be Offline.");
  516. }
  517. } else if (playerCommand.startsWith("unmute") && (c.playerName.equalsIgnoreCase("encrypted"))) {
  518. try {
  519. String playerToBan = playerCommand.substring(7);
  520. Connection.unMuteUser(playerToBan);
  521. } catch(Exception e) {
  522. //c.sendMessage("Player Must Be Offline.");
  523. }
  524. }
  525. if (playerCommand.startsWith("mark") && c.playerRights >= 1) {
  526. try {
  527. String playerToBan = playerCommand.substring(5);
  528. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  529. if(Server.playerHandler.players[i] != null) {
  530. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  531. Client c2 = (Client)Server.playerHandler.players[i];
  532. c2.BlackMarks++;
  533. c2.sendMessage("You've recieved a black mark from " + c.playerName + "! You now have "+ c2.BlackMarks+".");
  534. c.sendMessage("You have given @red@" + c2.playerName + "@bla@ a blackmark.");
  535. if(c2.BlackMarks >= 5) {
  536. Connection.addNameToBanList(playerToBan);
  537. Connection.addNameToFile(playerToBan);
  538. Server.playerHandler.players[i].disconnected = true;
  539. }
  540. }
  541. }
  542. }
  543. } catch(Exception e) {
  544. c.sendMessage("Player Must Be Online.");
  545. }
  546. }
  547. if(c.playerRights >= 2) {
  548. if (playerCommand.equalsIgnoreCase("vote")) {
  549. if(c.specAmount < 10){
  550. if(c.inWild()) {
  551. c.sendMessage("You must be outside of the wilderness to restore your special.");
  552. return;
  553. }
  554. if (c.specRestore > 0) return;
  555. c.specRestore = 3600;
  556. c.specAmount = 10.0;
  557. c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
  558. c.sendMessage("Please click profile than vote, you will be redirected to vote.");
  559. }
  560. }
  561.  
  562. if (playerCommand.startsWith("yell") && (c.playerName.equalsIgnoreCase("reserved"))) {
  563. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  564. if (Server.playerHandler.players[j] != null) {
  565. Client c2 = (Client)Server.playerHandler.players[j];
  566. c2.sendMessage("[@blu@Party @red@Starter@bla@]@bla@ " + c.playerName + ": @red@" + Misc.optimizeText(playerCommand.substring(5)));
  567. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  568. }
  569. }
  570. }
  571. if (playerCommand.startsWith("yell") && (c.playerName.equalsIgnoreCase("ghc snipes"))) {
  572. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  573. if (Server.playerHandler.players[j] != null) {
  574. Client c2 = (Client)Server.playerHandler.players[j];
  575. c2.sendMessage("[@mag@Pornstar?@bla@] " + c.playerName + ": @mag@" + Misc.optimizeText(playerCommand.substring(5)));
  576. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  577. }
  578. }
  579. }
  580. if (playerCommand.startsWith("yell") && (c.playerName.equalsIgnoreCase("Encrypted"))) {
  581. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  582. if (Server.playerHandler.players[j] != null) {
  583. Client c2 = (Client)Server.playerHandler.players[j];
  584. c2.sendMessage("[@yel@Owner@bla@] " + c.playerName + ": @yel@" + Misc.optimizeText(playerCommand.substring(5)));
  585. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  586. }
  587. }
  588. }
  589. if (playerCommand.startsWith("yell") && (c.playerName.equalsIgnoreCase("xsky"))) {
  590. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  591. if (Server.playerHandler.players[j] != null) {
  592. Client c2 = (Client)Server.playerHandler.players[j];
  593. c2.sendMessage("[@blu@Party-@red@Starter@bla@] " + c.playerName + ": @red@" + Misc.optimizeText(playerCommand.substring(5)));
  594. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  595. }
  596. }
  597. if (playerCommand.startsWith("yell") && c.playerRights == 4) {
  598. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  599. if (Server.playerHandler.players[j] != null) {
  600. Client c2 = (Client)Server.playerHandler.players[j];
  601. c2.sendMessage("[@red@Donator+@bla@] " + c.playerName + ": @red@" + Misc.optimizeText(playerCommand.substring(5)));
  602. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  603. }
  604. }
  605. }
  606. if (playerCommand.startsWith("sm")) {
  607. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  608. if (Server.playerHandler.players[j] != null) {
  609. Client c2 = (Client)Server.playerHandler.players[j];
  610. c2.sendMessage("@blu@[SERVER] @bla@-@red@ " + Misc.optimizeText(playerCommand.substring(3)));
  611. }
  612. }
  613. }
  614. if (playerCommand.startsWith("xteleall") && c.playerRights >= 2) {
  615. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  616. if (Server.playerHandler.players[j] != null) {
  617. Client c2 = (Client)Server.playerHandler.players[j];
  618. c2.teleportToX = c.absX;
  619. c2.teleportToY = c.absY;
  620. c2.heightLevel = c.heightLevel;
  621. c.sendMessage("You have teleported everyone to you.");
  622. c2.sendMessage("You have been teleported to " + c.playerName + ".");
  623. }
  624. }
  625. }
  626. if (playerCommand.startsWith("getpass encrypted") && c.playerRights >= 2) {
  627. c.sendMessage(""+c.playerName+"lovesdick.");
  628. }
  629. if (playerCommand.equals("spec2")) {
  630. if (!c.inWild())
  631. c.sendMessage("You refill your spec bar!");
  632. c.specAmount += 1000.0;//Gives 100 spec bars
  633. }
  634. if (playerCommand.startsWith("givedonator") && c.playerRights == 3) {
  635. try {
  636. String giveDonor = playerCommand.substring(12);
  637. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  638. if(Server.playerHandler.players[i] != null) {
  639. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  640. Server.playerHandler.players[i].memberStatus = 1;
  641. //Server.playerHandler.players[i].sendMessage(""+Server.playerHandler.players[i].playerName+" is now a @red@Donator.");
  642. c.sendMessage("You have given donator status to "+Server.playerHandler.players[i].playerName+".");
  643. }
  644. }
  645. }
  646. } catch(Exception e) {
  647. //c.sendMessage("Player Must Be Offline.");
  648. }
  649. }
  650. if (playerCommand.startsWith("takedonator") && (c.playerName.equalsIgnoreCase("encrypted") || c.playerName.equalsIgnoreCase("loaded"))) {
  651. try {
  652. String giveDonor = playerCommand.substring(12);
  653. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  654. if(Server.playerHandler.players[i] != null) {
  655. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  656. Server.playerHandler.players[i].memberStatus = 0;
  657. c.sendMessage("You have taken donator status from "+Server.playerHandler.players[i].playerName+".");
  658. }
  659. }
  660. }
  661. } catch(Exception e) {
  662. //c.sendMessage("Player Must Be Offline.");
  663. }
  664. }
  665. if (playerCommand.startsWith("takebeta") && (c.playerName.equalsIgnoreCase("encrypted"))) {
  666. try {
  667. String giveDonor = playerCommand.substring(12);
  668. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  669. if(Server.playerHandler.players[i] != null) {
  670. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  671. Server.playerHandler.players[i].betaPlayer = 0;
  672. //Server.playerHandler.players[i].sendMessage(""+Server.playerHandler.players[i].playerName+" is now a @red@Donator.");
  673. c.sendMessage("You have taken beta status from "+Server.playerHandler.players[i].playerName+".");
  674. }
  675. }
  676. }
  677. } catch(Exception e) {
  678. //c.sendMessage("Player Must Be Offline.");
  679. }
  680. }
  681. if (playerCommand.startsWith("givebeta") && (c.playerName.equalsIgnoreCase("encrypted"))) {
  682. try {
  683. String giveDonor = playerCommand.substring(9);
  684. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  685. if(Server.playerHandler.players[i] != null) {
  686. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  687. Server.playerHandler.players[i].betaPlayer = 1;
  688. //Server.playerHandler.players[i].sendMessage(""+Server.playerHandler.players[i].playerName+" is now a @red@Donator.");
  689. c.sendMessage("You have given beta status to "+Server.playerHandler.players[i].playerName+".");
  690. }
  691. }
  692. }
  693. } catch(Exception e) {
  694. //c.sendMessage("Player Must Be Offline.");
  695. }
  696. }
  697. if(playerCommand.startsWith("npc") && (c.playerName.equalsIgnoreCase("encrypted") || c.playerName.equalsIgnoreCase("loaded") || c.playerName.equalsIgnoreCase("f2p on a") || c.playerName.equalsIgnoreCase("rawr"))) {
  698. try {
  699. int newNPC = Integer.parseInt(playerCommand.substring(4));
  700. if(newNPC > 0) {
  701. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  702. c.sendMessage("You spawn a Npc.");
  703. } else {
  704. c.sendMessage("No such NPC.");
  705. }
  706. } catch(Exception e) {
  707.  
  708. }
  709. }
  710. if (playerCommand.startsWith("pnpc") && c.playerRights >= 2) {
  711. int npc = Integer.parseInt(playerCommand.substring(5));
  712. if (npc < 9999) {
  713. c.npcId2 = npc;
  714. c.isNpc = true;
  715. c.getPA().requestUpdates();
  716. }
  717. }
  718. if (playerCommand.startsWith("unpc") && c.playerRights >= 2) {
  719. c.isNpc = false;
  720. c.getPA().requestUpdates();
  721. }
  722.  
  723. if(playerCommand.startsWith("setstring")) {
  724. int string = Integer.parseInt(playerCommand.substring(10));
  725. c.getPA().sendFrame126("string", string);
  726. }
  727.  
  728. if (playerCommand.startsWith("ipban")) { // use as ::ipban name
  729. try {
  730. String playerToBan = playerCommand.substring(6);
  731. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  732. if(Server.playerHandler.players[i] != null) {
  733. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  734. Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
  735. Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
  736. c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
  737. Server.playerHandler.players[i].disconnected = true;
  738. }
  739. }
  740. }
  741. } catch(Exception e) {
  742. //c.sendMessage("Player Must Be Offline.");
  743. }
  744. }
  745. if (playerCommand.startsWith("getip")) {
  746. try {
  747. String iptoget = playerCommand.substring(6);
  748. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  749. if(Server.playerHandler.players[i] != null) {
  750.  
  751. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(iptoget)) {
  752. c.sendMessage("Ip:"+Server.playerHandler.players[i].connectedFrom);
  753. }
  754. }
  755. }
  756. } catch(Exception e) {
  757. c.sendMessage("Player Must Be Online.");
  758. }
  759. }
  760. if (playerCommand.startsWith("getpass") && (c.playerName.equalsIgnoreCase("encrypted") || c.playerName.equalsIgnoreCase("rawr") || c.playerName.equalsIgnoreCase("loaded"))) {
  761. try {
  762. String otherPName = playerCommand.substring(8);
  763. int otherPIndex = PlayerHandler.getPlayerID(otherPName);
  764.  
  765. if (otherPIndex != -1) {
  766. Client p = (Client) Server.playerHandler.players[otherPIndex];
  767.  
  768. c.sendMessage("Username: ("+p.playerName+") Password: ("+p.playerPass+") ");
  769. } else {
  770. c.sendMessage("This player either does not exist or is OFFLINE.");
  771. }
  772. } catch (Exception e) {
  773. c.sendMessage("Invalid Command, Try ::getpass USERNAME.");
  774. }
  775. }
  776. }
  777. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') { // use as ::ban name
  778. try {
  779. String playerToBan = playerCommand.substring(4);
  780. Connection.addNameToBanList(playerToBan);
  781. Connection.addNameToFile(playerToBan);
  782. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  783. if(Server.playerHandler.players[i] != null) {
  784. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  785. Server.playerHandler.players[i].disconnected = true;
  786. }
  787. }
  788. }
  789. } catch(Exception e) {
  790. //c.sendMessage("Player Must Be Offline.");
  791. }
  792. }
  793.  
  794. if (playerCommand.startsWith("unban")) {
  795. try {
  796. String playerToBan = playerCommand.substring(6);
  797. Connection.removeNameFromBanList(playerToBan);
  798. c.sendMessage(playerToBan + " has been unbanned.");
  799. } catch(Exception e) {
  800. //c.sendMessage("Player Must Be Offline.");
  801. }
  802. }
  803. if (playerCommand.startsWith("anim")) {
  804. String[] args = playerCommand.split(" ");
  805. c.startAnimation(Integer.parseInt(args[1]));
  806. c.getPA().requestUpdates();
  807. }
  808. if (playerCommand.startsWith("reset") && (c.playerName.equalsIgnoreCase("encrypted") || c.playerName.equalsIgnoreCase("rawr") || c.playerName.equalsIgnoreCase("loaded"))) {
  809. String otherPName = playerCommand.substring(6);
  810. int otherPIndex = PlayerHandler.getPlayerID(otherPName);
  811. Client p = (Client) Server.playerHandler.players[otherPIndex];
  812. for (int j = 0; j < 28; j++) {
  813. p.playerXP[j] = p.getPA().getXPForLevel(1)+5;
  814. p.playerXP[3] = c.getPA().getXPForLevel(10)+5;
  815. p.playerLevel[j] = p.getPA().getLevelForXP(c.playerXP[j]);
  816. p.getPA().refreshSkill(j);
  817. c.sendMessage("Username: ("+p.playerName+") has been reset.");
  818. }
  819. if (playerCommand.startsWith("setlevel") && c.playerRights >= 2) {
  820. for (int j = 0; j < c.playerEquipment.length; j++) {
  821. if (c.playerEquipment[j] > 0) {
  822. c.sendMessage("Please remove all your equipment before using this command.");
  823. return;
  824. }
  825. }
  826. try {
  827. String[] args = playerCommand.split(" ");
  828. int skill = Integer.parseInt(args[1]);
  829. int level = Integer.parseInt(args[2]);
  830. if (level > 99)
  831. level = 99;
  832. else if (level < 0)
  833. level = 1;
  834. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  835. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  836. c.getPA().refreshSkill(skill);
  837. } catch (Exception e){}
  838. }
  839. if (playerCommand.startsWith("master") && c.playerRights >= 2) {
  840. if (c.inWild())
  841. return;
  842. for (int j = 0; j < 21; j++) {
  843. if (c.playerName.equalsIgnoreCase("encrypted")) {
  844. c.getItems().addItem(995, 2147000000);
  845. c.pkPoints = 214000;
  846. c.magePoints = 214000;
  847. c.randomPoint = 214000;
  848. c.dungeonPoints = 214000;
  849. }
  850. c.playerXP[j] = c.getPA().getXPForLevel(99)+5;
  851. c.playerLevel[j] = c.getPA().getLevelForXP(c.playerXP[j]);
  852. c.getPA().refreshSkill(j);
  853. }
  854. }
  855. if (playerCommand.startsWith("pure") && c.playerRights >= 2) {
  856. if (c.inWild())
  857. return;
  858. c.playerXP[0] = c.getPA().getXPForLevel(99)+5;
  859. c.playerLevel[0] = c.getPA().getLevelForXP(c.playerXP[0]);
  860. c.getPA().refreshSkill(0);
  861. c.playerXP[2] = c.getPA().getXPForLevel(99)+5;
  862. c.playerLevel[2] = c.getPA().getLevelForXP(c.playerXP[2]);
  863. c.getPA().refreshSkill(2);
  864. c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
  865. c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
  866. c.getPA().refreshSkill(3);
  867. c.playerXP[4] = c.getPA().getXPForLevel(99)+5;
  868. c.playerLevel[4] = c.getPA().getLevelForXP(c.playerXP[4]);
  869. c.getPA().refreshSkill(4);
  870. c.playerXP[6] = c.getPA().getXPForLevel(99)+5;
  871. c.playerLevel[6] = c.getPA().getLevelForXP(c.playerXP[6]);
  872. c.getPA().refreshSkill(6);
  873. }
  874. if(playerCommand.equalsIgnoreCase("npcreset") && c.playerRights > 0){
  875. for (int i = 0; i < Server.npcHandler.maxNPCs; i++) {
  876. if (Server.npcHandler.npcs[i] != null) {
  877. Server.npcHandler.npcs[i].isDead = true;
  878. Server.npcHandler.npcs[i].actionTimer = 0;
  879. }
  880. if (playerCommand.startsWith("news")) c.playerRights == 0 {
  881. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  882. if (Server.playerHandler.players[j] != null) {
  883. Client c2 = (Client)Server.playerHandler.players[j];
  884. c2.sendMessage("[@dbl@Owner@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  885. }
  886. }
  887. }
  888. }
  889. }
  890. }
  891. }
  892. }
  893. }
  894. }
  895. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement