Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.66 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. * Andrew Most commands need
  16. * player rights added to them and
  17. * ::item needs to be fixed don't
  18. * remove the things that are erroring it
  19. * thanks Ryley!@ Aka Coder Kid!
  20. *
  21. *
  22. *
  23. *
  24. *
  25. *
  26. *
  27. *
  28. *
  29. *
  30. *
  31. *
  32. *
  33. *
  34. *
  35. *
  36. *
  37. *
  38. *
  39. *
  40. *
  41. **/
  42. public class Commands implements PacketType {
  43.  
  44. @Override
  45. public void processPacket(Client c, int packetType, int packetSize) {
  46. String playerCommand = c.getInStream().readString();
  47. if(Config.SERVER_DEBUG)
  48. Misc.println(c.playerName+" playerCommand: "+playerCommand);
  49. if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
  50. if (c.clanId >= 0) {
  51. System.out.println(playerCommand);
  52. playerCommand = playerCommand.substring(1);
  53. Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
  54. } else {
  55. if (c.clanId != -1)
  56. c.clanId = -1;
  57. c.sendMessage("You are not in a clan.");
  58. }
  59. return;
  60. }
  61. if (playerCommand.startsWith("kdr")) {
  62. double KDR = ((double)c.KC)/((double)c.DC);
  63. c.forcedChat("My Kill/Death ratio is "+c.KC+"/"+c.DC+"; "+KDR+".");
  64. }
  65. if (playerCommand.equalsIgnoreCase("levels")) {
  66. 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]) + ".");
  67. c.forcedChatUpdateRequired = true;
  68. }
  69. if (playerCommand.equalsIgnoreCase("empty")) {
  70. c.sendMessage("You empty your inventory.");
  71. c.getPA().removeAllItems();
  72. }
  73. if (playerCommand.equalsIgnoreCase("lock")) {
  74. c.explockon();
  75. }
  76. if (playerCommand.equalsIgnoreCase("unlock")) {
  77. c.explockoff();
  78. }
  79. if (playerCommand.equalsIgnoreCase("afk")) {
  80. c.startAnimation(1353);
  81. c.updateRequired = true;
  82. c.appearanceUpdateRequired = true;
  83. }
  84. if (playerCommand.equalsIgnoreCase("afkoff")) {
  85. c.startAnimation(6);
  86. c.updateRequired = true;
  87. c.appearanceUpdateRequired = true;
  88. }
  89. if (playerCommand.equalsIgnoreCase("players")) {
  90. c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
  91. c.getPA().sendFrame126(Config.SERVER_NAME+" - Online Players", 8144);
  92. c.getPA().sendFrame126("@dbl@Online players(" + PlayerHandler.getPlayerCount()+ "):", 8145);
  93. int line = 8147;
  94. for (int i = 1; i < Config.MAX_PLAYERS; i++) {
  95. Client p = c.getClient(i);
  96. if (!c.validClient(i))
  97. continue;
  98. if (p.playerName != null) {
  99. String title = "";
  100. if (p.playerRights == 1) {
  101. title = "Mod, ";
  102. } else if (p.playerRights == 2) {
  103. title = "Admin, ";
  104. }
  105. title += "level-" + p.combatLevel;
  106. String extra = "";
  107. if (c.playerRights > 0) {
  108. extra = "(" + p.playerId + ") ";
  109. }
  110. c.getPA().sendFrame126("@dre@" + extra + p.playerName + "@dbl@ ("+ title + ") is at " + p.absX + ", "+ p.absY, line);
  111. line++;
  112. }
  113. }
  114. c.getPA().showInterface(8134);
  115. c.flushOutStream();
  116. }
  117. if (playerCommand.equals("spec") && c.playerRights >= 3) {
  118. c.specAmount = 100000000.0;
  119. }
  120.  
  121. if (playerCommand.startsWith("noclip")) {
  122. if(c.playerRights == 0){
  123. c.logout();
  124. }
  125. }
  126. if (playerCommand.equalsIgnoreCase("mypos")) {
  127. c.sendMessage("You are standing on X=" + c.getX() + " Y=" + c.getY());
  128. }
  129. if (playerCommand.startsWith("yell") && c.playerRights <= 0 && c.memberStatus >= 1 && c.betaPlayer >= 1) {
  130. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  131. if (Server.playerHandler.players[j] != null) {
  132. Client c2 = (Client)Server.playerHandler.players[j];
  133. c2.sendMessage("[@gr3@Beta-Donator@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  134. }
  135. }
  136. } else if (playerCommand.startsWith("yell") && c.memberStatus >= 1 && c.playerName.equalsIgnoreCase("gfublow")) {
  137. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  138. if (Server.playerHandler.players[j] != null) {
  139. Client c2 = (Client)Server.playerHandler.players[j];
  140. c2.sendMessage("[@gr3@Top-Donator@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  141. }
  142. }
  143. } else if (playerCommand.startsWith("yell") && c.playerRights <= 0 && c.memberStatus >= 1) {
  144. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  145. if (Server.playerHandler.players[j] != null) {
  146. Client c2 = (Client)Server.playerHandler.players[j];
  147. c2.sendMessage("[@gr3@Donator@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  148. }
  149. }
  150. } else if (playerCommand.startsWith("yell") && c.playerRights <= 0 && c.memberStatus >= 0 && c.betaPlayer >= 1) {
  151. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  152. if (Server.playerHandler.players[j] != null) {
  153. Client c2 = (Client)Server.playerHandler.players[j];
  154. c2.sendMessage("[@mag@Beta-Player@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  155. }
  156. }
  157. } else if (playerCommand.startsWith("yell") && c.playerRights <= 0) {
  158. if (System.currentTimeMillis() - c.lastyell > 30000) {
  159. c.lastyell = System.currentTimeMillis();
  160. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  161. if (Server.playerHandler.players[j] != null) {
  162. Client c2 = (Client)Server.playerHandler.players[j];
  163. c2.sendMessage("[@mag@Player@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  164. }//hm, here is where i copied it
  165. }
  166. } else {
  167. c.sendMessage("Regular players can only yell once per 30 seconds.");
  168. }
  169. }
  170. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  171. c.playerPass = playerCommand.substring(15);
  172. c.sendMessage("Your password is now: " + c.playerPass);
  173. }
  174. if (playerCommand.startsWith("blind") && c.playerRights > 2) {
  175. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  176. if (Server.playerHandler.players[j] != null) {
  177. Client c2 = (Client)Server.playerHandler.players[j];
  178. c2.getPA().showInterface(13583);
  179. }
  180. }
  181. if(c.playerRights >= 1) {
  182. if (playerCommand.startsWith("xteleto")) {
  183. String name = playerCommand.substring(8);
  184. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  185. if (Server.playerHandler.players[i] != null) {
  186. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  187. c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
  188. }
  189. }
  190. }
  191. }
  192. if (playerCommand.startsWith("xteletome")) {
  193. if(c.playerRights >= 1) {
  194. String name = playerCommand.substring(8);
  195. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  196. if (Server.playerHandler.players[i] != null) {
  197. if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
  198. Client c2 = (Client)Server.playerHandler.players[i];
  199. c2.teleportToX = c.absX;
  200. c2.teleportToY = c.absY;
  201. c2.heightLevel = c.heightLevel;
  202. c.sendMessage("You have teleported " + c2.playerName + " to you.");
  203. c2.sendMessage("You have been teleported to " + c.playerName + ".");
  204. }
  205. }
  206. }
  207. }
  208. if (playerCommand.startsWith("tele")) {
  209. if(c.playerRights >= 1) {
  210.  
  211. String[] arg = playerCommand.split(" ");
  212. if (arg.length > 3)
  213. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),Integer.parseInt(arg[3]));
  214. else if (arg.length == 3)
  215. c.getPA().movePlayer(Integer.parseInt(arg[1]),Integer.parseInt(arg[2]),c.heightLevel);
  216. }
  217. if(playerCommand.startsWith("jail")) {
  218. if(c.playerRights >= 1) {
  219.  
  220. try {
  221. String playerToBan = playerCommand.substring(5);
  222. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  223. if(Server.playerHandler.players[i] != null) {
  224. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  225. Client c2 = (Client)Server.playerHandler.players[i];
  226. int randomjail = Misc.random(6);
  227. if (randomjail == 1) {
  228. c2.teleportToX = 3014;
  229. c2.teleportToY = 3180;
  230. } else if (randomjail == 2) {
  231. c2.teleportToX = 3018;
  232. c2.teleportToY = 3180;
  233. } else if (randomjail == 3) {
  234. c2.teleportToX = 3018;
  235. c2.teleportToY = 3189;
  236. } else if (randomjail == 4) {
  237. c2.teleportToX = 3014;
  238. c2.teleportToY = 3189;
  239. } else if (randomjail == 5) {
  240. c2.teleportToX = 3014;
  241. c2.teleportToY = 3191;
  242. } else if (randomjail == 6) {
  243. c2.teleportToX = 3014;
  244. c2.teleportToY = 3195;
  245. }
  246. c2.sendMessage("You have been jailed by "+c.playerName+"");
  247. c.sendMessage("Successfully Jailed "+c2.playerName+".");
  248. }
  249. }
  250. }
  251. } catch(Exception e) {
  252. c.sendMessage("Player Must Be Offline.");
  253. }
  254. }
  255. if(playerCommand.startsWith("unjail")) {
  256. if(c.playerRights >= 1) {
  257.  
  258. try {
  259. String playerToBan = playerCommand.substring(7);
  260. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  261. if(Server.playerHandler.players[i] != null) {
  262. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  263. Client c2 = (Client)Server.playerHandler.players[i];
  264. c2.teleportToX = 3087;
  265. c2.teleportToY = 3500;
  266. c2.sendMessage("You have been unjailed by "+c.playerName+"");
  267. c.sendMessage("Successfully unjailed "+c2.playerName+".");
  268. }
  269. }
  270. }
  271. } catch(Exception e) {
  272. c.sendMessage("Player Must Be Offline.");
  273. }
  274. }
  275. if (playerCommand.startsWith("kick")) {
  276. if(c.playerRights == 0){
  277. return;
  278. }
  279. Client noob = null;
  280. for (int i = 0; i < Server.playerHandler.players.length; i++){
  281. if(Server.playerHandler.players[i] != null){
  282. if(playerCommand.substring(5).equalsIgnoreCase(Server.playerHandler.players[i].playerName)){
  283. noob = (Client)Server.playerHandler.players[i];
  284. Server.playerHandler.players[i].disconnected = true;
  285. }
  286. }
  287. }
  288. }
  289. if (playerCommand.startsWith("task")) {
  290. c.taskAmount = -1;
  291. c.slayerTask = 0;
  292. }
  293. if (playerCommand.startsWith("yell") && c.playerRights == 1) {
  294. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  295. if (Server.playerHandler.players[j] != null) {
  296. Client c2 = (Client)Server.playerHandler.players[j];
  297. c2.sendMessage("[@red@PMOD@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  298. }
  299. }
  300. } else if (playerCommand.startsWith("yell") && c.memberStatus >= 1 && c.playerRights == 1 && c.playerName.equalsIgnoreCase("pride f0rce")) {
  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@Web-Master@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  305. }
  306. }
  307. }
  308. if (playerCommand.startsWith("reloadshops") && c.playerRights > 0) {
  309. Server.shopHandler = new server.world.ShopHandler();
  310. }
  311.  
  312. if (playerCommand.startsWith("fakels")) {
  313. int item = Integer.parseInt(playerCommand.split(" ")[1]);
  314. Server.clanChat.handleLootShare(c, item, 1);
  315. }
  316.  
  317. if (playerCommand.startsWith("interface")) {
  318. String[] args = playerCommand.split(" ");
  319. c.getPA().showInterface(Integer.parseInt(args[1]));
  320. }
  321. if (playerCommand.startsWith("gfx")) {
  322. String[] args = playerCommand.split(" ");
  323. c.gfx0(Integer.parseInt(args[1]));
  324. }
  325. if (playerCommand.startsWith("update")) {
  326. if(c.playerRights >= 1) {
  327.  
  328. String[] args = playerCommand.split(" ");
  329. int a = Integer.parseInt(args[1]);
  330. PlayerHandler.updateSeconds = a;
  331. PlayerHandler.updateAnnounced = false;
  332. PlayerHandler.updateRunning = true;
  333. PlayerHandler.updateStartTime = System.currentTimeMillis();
  334. }
  335.  
  336. if (playerCommand.startsWith("obj")) {
  337. if(c.playerRights >= 1) {
  338.  
  339. c.getPA().checkObjectSpawn(Integer.parseInt(playerCommand.substring(4)), 3095, 3487, 0, 0);
  340. }
  341.  
  342. if (playerCommand.equalsIgnoreCase("debug")) {
  343. Server.playerExecuted = true;
  344. }
  345. if (playerCommand.startsWith("interface")) {
  346. try {
  347. String[] args = playerCommand.split(" ");
  348. int a = Integer.parseInt(args[1]);
  349. c.getPA().showInterface(a);
  350. } catch(Exception e) {
  351. c.sendMessage("::interface ####");
  352. }
  353. }
  354. }
  355. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) > ' ') {
  356. if(c.playerRights >= 1) {
  357.  
  358. try {
  359. String playerToBan = playerCommand.substring(4);
  360. Connection.addNameToBanList(playerToBan);
  361. Connection.addNameToFile(playerToBan);
  362. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  363. if(Server.playerHandler.players[i] != null) {
  364. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  365. Server.playerHandler.players[i].disconnected = true;
  366. }
  367. }
  368. }
  369. } catch(Exception e) {
  370. //c.sendMessage("Player Must Be Offline.");
  371. }
  372. }
  373. if (playerCommand.startsWith("unban") && c.playerRights > 1) {
  374. try {
  375. String playerToBan = playerCommand.substring(6);
  376. Connection.removeNameFromBanList(playerToBan);
  377. c.sendMessage(playerToBan + " has been unbanned.");
  378. } catch(Exception e) {
  379. //c.sendMessage("Player Must Be Offline.");
  380. }
  381. }
  382. if (playerCommand.startsWith("mute") && c.playerRights > 1) {
  383. try {
  384. String playerToBan = playerCommand.substring(5);
  385. Connection.addNameToMuteList(playerToBan);
  386. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  387. if(Server.playerHandler.players[i] != null) {
  388. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  389. Client c2 = (Client)Server.playerHandler.players[i];
  390. c2.sendMessage("You have been muted by: " + c.playerName);
  391. break;
  392. }
  393. }
  394. }
  395. } catch(Exception e) {
  396. //c.sendMessage("Player Must Be Offline.");
  397. }
  398. } else if (playerCommand.startsWith("mute") && c.playerRights >= 1) {
  399. try {
  400. String playerToBan = playerCommand.substring(5);
  401. Connection.addNameToMuteList(playerToBan);
  402. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  403. if(Server.playerHandler.players[i] != null) {
  404. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  405. Client c2 = (Client)Server.playerHandler.players[i];
  406. c2.sendMessage("You have been 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("item")) {
  416. if(c.playerRights >= 1) {
  417.  
  418. try {
  419. String[] args = playerCommand.split(" ");
  420. if (args.length == 3) {
  421. int newItemID = Integer.parseInt(args[1]);
  422. int newItemAmount = Integer.parseInt(args[2]);
  423. if ((newItemID <= 20000) && (newItemID >= 0)) {
  424. c.getItems().addItem(newItemID, newItemAmount);
  425. } else {
  426. c.sendMessage("That item ID does not exist.");
  427. }
  428. } else {
  429. c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
  430. }
  431. } catch(Exception e) {
  432.  
  433. } // HERE?
  434. } // HERE?
  435.  
  436. if (playerCommand.startsWith("ipmute") && c.playerRights >= 1) {
  437. try {
  438. String playerToBan = playerCommand.substring(7);
  439. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  440. if(Server.playerHandler.players[i] != null) {
  441. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  442. Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
  443. c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
  444. Client c2 = (Client)Server.playerHandler.players[i];
  445. c2.sendMessage("You have been muted by: " + c.playerName);
  446. break;
  447. }
  448. }
  449. }
  450. } catch(Exception e) {
  451. //c.sendMessage("Player Must Be Offline.");
  452. }
  453. }
  454. if (playerCommand.startsWith("unipmute") && c.playerRights >= 1) {
  455. try {
  456. String playerToBan = playerCommand.substring(9);
  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. Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
  461. c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
  462. break;
  463. }
  464. }
  465. }
  466. } catch(Exception e) {
  467. //c.sendMessage("Player Must Be Offline.");
  468. }
  469. }
  470. if (playerCommand.startsWith("unmute") && c.playerRights >= 1) {
  471. try {
  472. String playerToBan = playerCommand.substring(7);
  473. Connection.unMuteUser(playerToBan);
  474. } catch(Exception e) {
  475. //c.sendMessage("Player Must Be Offline.");
  476. }
  477. } else if (playerCommand.startsWith("unmute") && (c.playerName.equalsIgnoreCase("i ranged u"))) {
  478. try {
  479. String playerToBan = playerCommand.substring(7);
  480. Connection.unMuteUser(playerToBan);
  481. } catch(Exception e) {
  482. //c.sendMessage("Player Must Be Offline.");
  483. }
  484. }
  485. if (playerCommand.startsWith("mark") && c.playerRights >= 1) {
  486. try {
  487. String playerToBan = playerCommand.substring(5);
  488. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  489. if(Server.playerHandler.players[i] != null) {
  490. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  491. Client c2 = (Client)Server.playerHandler.players[i];
  492. c2.BlackMarks++;
  493. c2.sendMessage("You've recieved a black mark from " + c.playerName + "! You now have "+ c2.BlackMarks+".");
  494. c.sendMessage("You have given @red@" + c2.playerName + "@bla@ a blackmark.");
  495. if(c2.BlackMarks >= 5) {
  496. Connection.addNameToBanList(playerToBan);
  497. Connection.addNameToFile(playerToBan);
  498. Server.playerHandler.players[i].disconnected = true;
  499. }
  500. }
  501. }
  502. }
  503. } catch(Exception e) {
  504. c.sendMessage("Player Must Be Online.");
  505. }
  506. }
  507. if(c.playerRights >= 2) {
  508. if (playerCommand.startsWith("yell") && c.playerRights == 2) {
  509. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  510. if (Server.playerHandler.players[j] != null) {
  511. Client c2 = (Client)Server.playerHandler.players[j];
  512. c2.sendMessage("[@whi@Head Mod@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  513. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  514. }
  515. }
  516. }
  517. if (playerCommand.startsWith("yell") && c.playerRights > 2) {
  518. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  519. if (Server.playerHandler.players[j] != null) {
  520. Client c2 = (Client)Server.playerHandler.players[j];
  521. c2.sendMessage("[@blu@Administrator@bla@] " + c.playerName + ": @dre@" + Misc.optimizeText(playerCommand.substring(5)));
  522. System.out.println("Yell: " + c.playerName + " - " + Misc.optimizeText(playerCommand.substring(5)));
  523. }
  524. }
  525. }
  526. if (playerCommand.startsWith("sm")) {
  527. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  528. if (Server.playerHandler.players[j] != null) {
  529. Client c2 = (Client)Server.playerHandler.players[j];
  530. c2.sendMessage("@blu@[SERVER] @bla@-@red@ " + Misc.optimizeText(playerCommand.substring(3)));
  531. }
  532. }
  533. }
  534.  
  535. if (playerCommand.startsWith("xteleall")&& c.playerRights >= 3) {
  536. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  537. if (Server.playerHandler.players[j] != null) {
  538. Client c2 = (Client)Server.playerHandler.players[j];
  539. c2.teleportToX = c.absX;
  540. c2.teleportToY = c.absY;
  541. c2.heightLevel = c.heightLevel;
  542. c.sendMessage("You have teleported everyone to you.");
  543. c2.sendMessage("You have been teleported to " + c.playerName + ".");
  544. }
  545. }
  546. }
  547. if (playerCommand.equals("spec2")) {
  548. if (!c.inWild())
  549. c.sendMessage("You refill your spec bar!");
  550. c.specAmount += 1000.0;//Gives 100 spec bars
  551. }
  552. if (playerCommand.startsWith("givedonator")&& c.playerRights >= 3) {
  553. try {
  554. String giveDonor = playerCommand.substring(12);
  555. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  556. if(Server.playerHandler.players[i] != null) {
  557. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  558. Server.playerHandler.players[i].memberStatus = 1;
  559. //Server.playerHandler.players[i].sendMessage(""+Server.playerHandler.players[i].playerName+" is now a @red@Donator.");
  560. c.sendMessage("You have given donator status to "+Server.playerHandler.players[i].playerName+".");
  561. }
  562. }
  563. }
  564. } catch(Exception e) {
  565. //c.sendMessage("Player Must Be Offline.");
  566. }
  567. }
  568. if (playerCommand.startsWith("takedonator") && c.playerRights >= 3) {
  569. try {
  570. String giveDonor = playerCommand.substring(12);
  571. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  572. if(Server.playerHandler.players[i] != null) {
  573. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  574. Server.playerHandler.players[i].memberStatus = 0;
  575. c.sendMessage("You have taken donator status from "+Server.playerHandler.players[i].playerName+".");
  576. }
  577. }
  578. }
  579. } catch(Exception e) {
  580. //c.sendMessage("Player Must Be Offline.");
  581. }
  582. }
  583. if (playerCommand.startsWith("takebeta") && c.playerRights >= 3) {
  584. try {
  585. String giveDonor = playerCommand.substring(12);
  586. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  587. if(Server.playerHandler.players[i] != null) {
  588. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  589. Server.playerHandler.players[i].betaPlayer = 0;
  590. //Server.playerHandler.players[i].sendMessage(""+Server.playerHandler.players[i].playerName+" is now a @red@Donator.");
  591. c.sendMessage("You have taken beta status from "+Server.playerHandler.players[i].playerName+".");
  592. }
  593. }
  594. }
  595. } catch(Exception e) {
  596. //c.sendMessage("Player Must Be Offline.");
  597. }
  598. }
  599. if (playerCommand.startsWith("givebeta") && c.playerRights >= 3) {
  600. try {
  601. String giveDonor = playerCommand.substring(9);
  602. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  603. if(Server.playerHandler.players[i] != null) {
  604. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(giveDonor)) {
  605. Server.playerHandler.players[i].betaPlayer = 1;
  606. //Server.playerHandler.players[i].sendMessage(""+Server.playerHandler.players[i].playerName+" is now a @red@Donator.");
  607. c.sendMessage("You have given beta status to "+Server.playerHandler.players[i].playerName+".");
  608. }
  609. }
  610. }
  611. } catch(Exception e) {
  612. //c.sendMessage("Player Must Be Offline.");
  613. }
  614. }
  615. if(playerCommand.startsWith("npc") && c.playerRights >= 2) {
  616. try {
  617. int newNPC = Integer.parseInt(playerCommand.substring(4));
  618. if(newNPC > 0) {
  619. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  620. c.sendMessage("You spawn a Npc.");
  621. } else {
  622. c.sendMessage("No such NPC.");
  623. }
  624. } catch(Exception e) {
  625.  
  626. }
  627. }
  628. if (playerCommand.startsWith("pnpc")&& c.playerRights >= 2) {
  629. int npc = Integer.parseInt(playerCommand.substring(5));
  630. if (npc < 9999) {
  631. c.npcId2 = npc;
  632. c.isNpc = true;
  633. c.getPA().requestUpdates();
  634. }
  635. }
  636. if (playerCommand.startsWith("unpc") && c.playerRights >= 2) {
  637. c.isNpc = false;
  638. c.getPA().requestUpdates();
  639. }
  640.  
  641. if(playerCommand.startsWith("setstring")) {
  642. int string = Integer.parseInt(playerCommand.substring(10));
  643. c.getPA().sendFrame126("string", string);
  644. }
  645.  
  646. if (playerCommand.startsWith("ipban")) { // use as ::ipban name
  647. try {
  648. String playerToBan = playerCommand.substring(6);
  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(playerToBan)) {
  652. Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
  653. Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
  654. c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
  655. Server.playerHandler.players[i].disconnected = true;
  656. }
  657. }
  658. }
  659. } catch(Exception e) {
  660. //c.sendMessage("Player Must Be Offline.");
  661. }
  662. }
  663. if (playerCommand.startsWith("getip")) {
  664. try {
  665. String iptoget = playerCommand.substring(6);
  666. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  667. if(Server.playerHandler.players[i] != null) {
  668.  
  669. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(iptoget)) {
  670. c.sendMessage("Ip:"+Server.playerHandler.players[i].connectedFrom);
  671. }
  672. }
  673. }
  674. } catch(Exception e) {
  675. c.sendMessage("Player Must Be Online.");
  676. }
  677. }
  678. if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') { // use as ::ban name
  679. try {
  680. String playerToBan = playerCommand.substring(4);
  681. Connection.addNameToBanList(playerToBan);
  682. Connection.addNameToFile(playerToBan);
  683. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  684. if(Server.playerHandler.players[i] != null) {
  685. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
  686. Server.playerHandler.players[i].disconnected = true;
  687. }
  688. }
  689. }
  690. } catch(Exception e) {
  691. //c.sendMessage("Player Must Be Offline.");
  692. }
  693. }
  694.  
  695. if (playerCommand.startsWith("unban")&& c.playerRights >= 2) {
  696. try {
  697. String playerToBan = playerCommand.substring(6);
  698. Connection.removeNameFromBanList(playerToBan);
  699. c.sendMessage(playerToBan + " has been unbanned.");
  700. } catch(Exception e) {
  701. //c.sendMessage("Player Must Be Offline.");
  702. }
  703. }
  704. if (playerCommand.startsWith("anim")) {
  705. String[] args = playerCommand.split(" ");
  706. c.startAnimation(Integer.parseInt(args[1]));
  707. c.getPA().requestUpdates();
  708. }
  709. if (playerCommand.startsWith("packages")) {
  710. c.getItems().addItem(15290, 1);
  711. c.getItems().addItem(15291, 1);
  712. c.getItems().addItem(15292, 1);
  713. c.getItems().addItem(15293, 1);
  714. c.getItems().addItem(15294, 1);
  715. }
  716. if (playerCommand.startsWith("setlevel") && c.playerRights >= 2) {
  717. if (c.inWild())
  718. return;
  719. for (int j = 0; j < c.playerEquipment.length; j++) {
  720. if (c.playerEquipment[j] > 0) {
  721. c.sendMessage("Please remove all your equipment before using this command.");
  722. return;
  723. }
  724. }
  725. try {
  726. String[] args = playerCommand.split(" ");
  727. int skill = Integer.parseInt(args[1]);
  728. int level = Integer.parseInt(args[2]);
  729. if (level > 99)
  730. level = 99;
  731. else if (level < 0)
  732. level = 1;
  733. c.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
  734. c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
  735. c.getPA().refreshSkill(skill);
  736. } catch (Exception e){}
  737. }
  738. if (playerCommand.startsWith("master")&& c.playerRights >= 3) {
  739. if (c.inWild())
  740. return;
  741. for (int j = 0; j < 7; j++) {
  742. if (c.playerName.equalsIgnoreCase("alex")) {
  743. c.getItems().addItem(995, 2147000000);
  744. c.pkPoints = 50000;
  745. }
  746. c.playerXP[j] = c.getPA().getXPForLevel(99)+5;
  747. c.playerLevel[j] = c.getPA().getLevelForXP(c.playerXP[j]);
  748. c.getPA().refreshSkill(j);
  749. }
  750. }
  751. if (playerCommand.startsWith("pure")&& c.playerRights >= 3) {
  752. if (c.inWild())
  753. return;
  754. c.playerXP[0] = c.getPA().getXPForLevel(99)+5;
  755. c.playerLevel[0] = c.getPA().getLevelForXP(c.playerXP[0]);
  756. c.getPA().refreshSkill(0);
  757. c.playerXP[2] = c.getPA().getXPForLevel(99)+5;
  758. c.playerLevel[2] = c.getPA().getLevelForXP(c.playerXP[2]);
  759. c.getPA().refreshSkill(2);
  760. c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
  761. c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
  762. c.getPA().refreshSkill(3);
  763. c.playerXP[4] = c.getPA().getXPForLevel(99)+5;
  764. c.playerLevel[4] = c.getPA().getLevelForXP(c.playerXP[4]);
  765. c.getPA().refreshSkill(4);
  766. c.playerXP[6] = c.getPA().getXPForLevel(99)+5;
  767. c.playerLevel[6] = c.getPA().getLevelForXP(c.playerXP[6]);
  768. c.getPA().refreshSkill(6);
  769. }
  770. if(playerCommand.equalsIgnoreCase("npcreset") && c.playerRights > 3){
  771. for (int i = 0; i < Server.npcHandler.maxNPCs; i++) {
  772. if (Server.npcHandler.npcs[i] != null) {
  773. Server.npcHandler.npcs[i].isDead = true;
  774. Server.npcHandler.npcs[i].actionTimer = 0;
  775. }
  776. }
  777. }
  778. }
  779. }
  780. }
  781. }
  782. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement