Advertisement
Guest User

Untitled

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