Advertisement
Guest User

Untitled

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