Advertisement
Guest User

Untitled

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