Advertisement
Guest User

Untitled

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