Advertisement
Guest User

Untitled

a guest
Mar 4th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 105.52 KB | None | 0 0
  1. /**
  2. * New command system. Uses predicates / enum to store commands. Much cleaner.
  3. *
  4. * The enum name is the string used to execute the command. After is the predicate that handles the requirement to
  5. * perform the command. Finally, after that is any additional strings that can be used to execute the command.
  6. * @author Advocatus
  7. *
  8. */
  9. public enum Commands {
  10.  
  11.  
  12. AUTH {
  13. @Override
  14. public void execute(Player c, String input) {
  15. final Motivote motivote = new Motivote("shayzien", "a5cd615ed2c9c784933532e7522f16a4");
  16.  
  17.  
  18. String auth = input.replace("auth ", "");
  19. System.out.println("Auth command was used, auth was: " + auth);
  20. try {
  21. Result r1 = motivote.redeem(SearchField.AUTH_CODE, auth);
  22. if (r1.success()) {
  23. // if(Server.voteWinner(c))
  24. // return;
  25. if (c.getRights() == Rights.SUPER_V_I_P && c.getRights() == Rights.ELITE)
  26. if (Misc.random(2) == 2) {
  27. c.getItems().addItemUnderAnyCircumstance(784, 1);
  28. } else
  29. if (Misc.random(3) == 3) {
  30. c.getItems().addItemUnderAnyCircumstance(784, 1);
  31. } else
  32. if (c.getRights() == Rights.LEGENDARY) {
  33. c.getItems().addItemUnderAnyCircumstance(784, 1);
  34. }
  35.  
  36.  
  37.  
  38. c.claimedAuth += 1;
  39. c.votePoints += 1;
  40. if (c.claimedAuth == 20) {
  41. PlayerHandler.executeGlobalMessage("@cr10@ Another 20 auth codes have been redeemed, vote now using ::vote!");
  42. c.claimedAuth = 0;
  43. }
  44.  
  45.  
  46.  
  47. // PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
  48. // + " @bla@has just voted for OS-World and received a voting rewards book.");
  49. c.sendMessage("Auth "+auth+" redeemed, thanks for voting!");
  50.  
  51. } else {
  52. c.sendMessage("Invalid auth supplied, please try again later.");
  53. }
  54.  
  55. }
  56. catch (Exception ex) {
  57. ex.printStackTrace();
  58. c.sendMessage("Unable to check auth, please try again later.");
  59. }
  60. }
  61.  
  62. },
  63.  
  64.  
  65.  
  66.  
  67.  
  68. BOO(owner()) {
  69. @Override
  70. public void execute(Player c, String input) {
  71. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  72. if (optionalPlayer.isPresent()) {
  73. Player c2 = optionalPlayer.get();
  74. c2.getPA().showInterface(18681);
  75. c.sendMessage("You've probably just ruined " + c2.playerName + "s day.");
  76. c2.sendMessage("@red@WOOOOOOOOOOOOOOOOOOOOOOOO!");
  77. }
  78. }
  79. },
  80. /*RFD(owner()) {
  81. @Override
  82. public void execute(Player c, String input) {
  83. RFDHandler.enterRfd(c);
  84. }
  85. },*/
  86. RFDKC(owner()) {
  87. @Override
  88. public void execute(Player c, String input) {
  89. c.sendMessage("current spawn "+c.currentSpawn+"");
  90. }
  91. },
  92. IMP(owner()) {
  93. @Override
  94. public void execute(Player c, String input) {
  95. //Cerberus.ghostData(c);
  96. Server.npcHandler.spawnNpc(c, 1654, c.absX, c.absY, c.heightLevel, 0, 10, 1, 1, 1, false, false);
  97. }
  98. },
  99.  
  100.  
  101. MASTER() {
  102. @Override
  103. public void execute(Player c, String input) {
  104. for (int i = 0; i < 22; i++) {
  105. c.playerLevel[i] = 99;
  106. c.playerXP[i] = c.getPA().getXPForLevel(100);
  107. c.getPA().refreshSkill(i);
  108. c.getPA().requestUpdates();
  109.  
  110. }
  111. }
  112. },
  113.  
  114. NORMALMODE() {
  115. @Override
  116. public void execute(Player c, String input) {
  117. if (c.getRights().isManIron() || c.getRights().isUlt() || c.easyMode || c.hardMode) {
  118. return;
  119. }
  120. c.normalMode = true;
  121. }
  122. },
  123. LAST(owner()) {
  124. @Override
  125. public void execute(Player c, String input) {
  126. TeleportExecutor.teleport(c, new Position(c.lastTeleportX, c.lastTeleportY, c.lastTeleportZ));
  127. }
  128. },
  129.  
  130.  
  131. RESET(owner()) {
  132. @Override
  133. public void execute(Player c, String input) {
  134. for (int skills = 0; skills < 22; skills++) {
  135. c.playerLevel[skills] = 1;
  136. c.getPA().refreshSkill(skills);
  137. c.playerXP[skills] = c.getPA().getXPForLevel(skills) + 0;
  138. c.getPA().refreshSkill(skills);
  139. }
  140. // c.getPA().refreshSkill(skills);
  141. // c.playerXP[skills] = c.getPA().getXPForLevel(skills) + 0;
  142. // c.getPA().refreshSkill(skills);
  143. }
  144. },
  145.  
  146.  
  147.  
  148.  
  149. SCREAMER(owner()) {
  150. @Override
  151. public void execute(Player c, String input) {
  152. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  153. if (optionalPlayer.isPresent()) {
  154. Player c2 = optionalPlayer.get();
  155. if (c2.getRights().isBetween(1, 3)) {
  156. c.sendMessage("You can't use this command on this player!");
  157. return;
  158. }
  159. for (int j = 0; j < 5; j++) {
  160. c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  161. c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  162. c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  163. c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  164. c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
  165. c.sendMessage("You've probably just ruined " + c2.playerName + "s day.");
  166. }
  167. } else {
  168. c.sendMessage(input + " is not online. You can only do this to online players.");
  169. }
  170. }
  171. },
  172.  
  173. ANSWER {
  174. @Override
  175. public void execute(Player c, String input) {
  176. // if (c.getRights().isManIron() || c.getRights().isUlt()) {
  177. // c.sendMessage("Your account is a <img=14>Ironman and cannot access trivia.");
  178. // return;
  179. //}//
  180. final String answer = input.toLowerCase().replace("Answer ", "");
  181. Trivia.attemptQuestion(c, answer);
  182. }
  183. },
  184. REACT {
  185. @Override
  186. public void execute(Player c, String input) {
  187. // if (c.getRights().isManIron() || c.getRights().isUlt()) {
  188. // c.sendMessage("Your account is a <img=14>Ironman and cannot access trivia.");
  189. // return;
  190. //}//
  191. final String answer = input.toLowerCase().replace("React ", "");
  192. ReactGame.attemptQuestion(c, answer);
  193. }
  194. },
  195.  
  196. STARTER {
  197. @Override
  198. public void execute(Player c, String input) {
  199. if (c.startPack == true) {
  200. //c.sendMessage("Pick a gamemode.");
  201. return;
  202. }
  203. c.getPA().showInterface(27150);
  204. }
  205. },
  206. RESETBARROWS {
  207. @Override
  208. public void execute(Player c, String input) {
  209. c.barrowsNpcs[0][1] = 0;
  210. c.barrowsNpcs[1][1] = 0;
  211. c.barrowsNpcs[2][1] = 0;
  212. c.barrowsNpcs[3][1] = 0;
  213. c.barrowsNpcs[4][1] = 0;
  214. c.barrowsNpcs[5][1] = 0;
  215. c.barrowsKillCount = 0;
  216. c.barrowsChestRollCount = 0;
  217. c.lastBrotherSpawned = false;
  218. c.newTunnels = true;
  219. c.randomTunnel = Player.randomTunnel();
  220. c.getPA().sendString("Karils", 16135);
  221. c.getPA().sendString("Guthans", 16134);
  222. c.getPA().sendString("Torags", 16133);
  223. c.getPA().sendString("Ahrims", 16132);
  224. c.getPA().sendString("Veracs", 16131);
  225. c.getPA().sendString("Dharoks", 16130);
  226. //c.getPA().movePlayer(3565, 3305, 0);
  227. TeleportExecutor.executeSkillsTeleport(c, new Teleport(new Position(3565, 3305), TeleportType.NORMAL));
  228. }
  229. },
  230. /*RESETTASK {
  231. @Override
  232. public void execute(Player c, String input) {
  233. c.slayerTask = 0;
  234. c.taskAmount = 0;
  235. c.onSlayerTask = false;
  236. c.onEasyTask = false;
  237. c.onMediumTask = false;
  238. c.onHardTask = false;
  239. c.onEliteTask = false;
  240. }
  241. },*/
  242.  
  243. NPCLOG {
  244. @Override//47200
  245. public void execute(Player c, String input) {
  246. for (int i = 8144; i < 8195; i++) {
  247. c.getPA().sendFrame126("", i);
  248. }
  249. int[] frames = { 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167,
  250. 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175 };
  251. c.getPA().sendFrame126("@dre@Boss Kills for @blu@" + c.playerName + "", 8144);
  252. c.getPA().sendFrame126("", 8145);
  253. c.getPA().sendFrame126("@blu@Total Boss kills: @red@" + c.getNpcDeathTracker().getTotal() + "", 8147);
  254. c.getPA().sendFrame126("", 8148);
  255. int index1 = 0;
  256. for (Entry<NPCName, Integer> entry : c.getNpcDeathTracker().getTracker().entrySet()) {
  257. if (entry == null) {
  258. continue;
  259. }
  260. if (index1 > frames.length - 1) {
  261. break;
  262. }
  263. if (entry.getValue() > 0) {
  264. c.getPA().sendFrame126("@blu@" + WordUtils.capitalize(entry.getKey().name().toLowerCase().replaceAll("_", " ")) + " kills: @red@" + entry.getValue(),
  265. frames[index1]);
  266. index1++;
  267. }
  268. }
  269. c.getPA().showInterface(8134);
  270. }
  271. },
  272.  
  273.  
  274.  
  275. BOSSLOG {
  276. @Override//
  277. public void execute(Player c, String input) {
  278. for (int i = 47206; i < 47406; i++) {
  279. c.getPA().sendFrame126("", i);
  280. }
  281. int[] frames = { 47207, 47208, 47209, 47210, 47211, 47212, 47213, 47214, 47215, 47216, 47217, 47218, 47219, 47220, 47221, 47222, 47223, 47224, 47225,
  282. 47226, 47227, 47228, 47229, 47230, 47231, 47232, 47233 };
  283. // c.getPA().sendFrame126("", 47206);
  284. // c.getPA().sendFrame126("", );
  285. c.getPA().sendFrame126(" <shad=-1>Total Boss kills: " + c.getNpcDeathTracker().getTotal() + "", 47206);
  286. //c.getPA().sendFrame126("", 47207);
  287. int index1 = 0;
  288. for (Entry<NPCName, Integer> entry : c.getNpcDeathTracker().getTracker().entrySet()) {
  289. if (entry == null) {
  290. continue;
  291. }
  292. if (index1 > frames.length - 1) {
  293. break;
  294. }
  295. if (entry.getValue() > 0) {
  296. c.getPA().sendFrame126(" <shad=-1>" + WordUtils.capitalize(entry.getKey().name().toLowerCase().replaceAll("_", " ")) + " kills: " + entry.getValue(),
  297. frames[index1]);
  298. index1++;
  299. }
  300. }
  301. c.getPA().showInterface(47200);
  302. }
  303. },
  304.  
  305. /*ANSWER {
  306. @Override
  307. public void execute(Player c, String input) {
  308. if (parser.hasNext1()) {
  309. String answer = "";
  310. while (parser.hasNext1()) {
  311. answer += parser.nextString() + " ";
  312. }
  313. TriviaBot.answer(c, answer.trim());
  314. }
  315. }
  316. },*/
  317.  
  318. DROPS {
  319.  
  320. @Override
  321. public void execute(Player c, String input) {
  322. final String query = input.toLowerCase().replace("drops ", "");
  323. if (query.length() > 0) {
  324. try {
  325. NpcDropManager.displayNPCDrops(c, query);
  326. } catch (Throwable error) {
  327. c.sendMessage("Could not display npc drops for npc: "+query+".");
  328. error.printStackTrace();
  329. }
  330. } else {
  331. c.sendMessage("Use ::drops query.");
  332. }
  333. }
  334.  
  335. },
  336. /*
  337. * Allaimvote
  338. *
  339. */
  340. /*AUTH {
  341. @Override
  342. public void execute(Player c, String input) {
  343. String auth = input.replace("Auth ", "");
  344. if(input.length() < 5) {
  345. c.sendMessage("You must enter an auth code to process your vote!");
  346. return;
  347. }
  348. boolean success = AuthService.provider().redeemNow(auth);
  349.  
  350. if (success) {
  351. c.votePoints += 5;
  352. c.getItems().addItemUnderAnyCircumstance(2996, 10);
  353. PlayerHandler.executeGlobalMessage("<img=10></img><col=255>" + Misc.capitalize(c.playerName)
  354. + " </col>has just voted and received <col=CC0000>10 PK Points & 5 Vote Points</col>.");
  355. c.getPA().loadQuests();
  356. }
  357. else {
  358. c.sendMessage("Invalid auth supplied, please try again later.");
  359. }
  360. //}
  361. }
  362. },*/
  363. ITEM(owner()) {
  364. @Override
  365. public void execute(Player c, String input) {
  366. String[] args = input.split(" ");
  367. try {
  368.  
  369.  
  370. /*int[] COINS_SPAWN = {4151, 11936, 3144, 6685, 13066, 386, 11937, 3145, 2441, 2437, 2443, 2445, 3041, 6686, 3025, 10926, 560, 557, 9075, 555, 560, 565, 2550, 2551, 9244, 12883, 12881, 12879, 12877, 12875, 12873,
  371. 1155,1153,1157,1165,1159,1161 ,1163,5574,1117,1115,1119,1125,1121,1123,1127 , 5575 , 1075 , 1067 , 1069 , 1077 , 1071 , 1073 , 1079 , 5576 , 1189 , 1191 , 1193 , 1195 , 1197 , 1199 , 1201 , 3105 , 4119 , 4121 , 4123 , 4125 , 4127 , 4129 , 4131 , 3751 ,
  372. 882 , 884 , 886 , 888 , 890 , 892 , 9144 , 9244 , 841 , 843 , 849 , 853 , 857 , 861 , 3749 , 10499 , 9185 , 1129 , 1133 , 1135 , 2499 , 2501 , 2503 , 863 , 869 , 1095 , 1097 , 1099 , 2493 , 2495 , 2497 , 866 , 867 , 868 , 11230 ,
  373. 556 , 554 , 3024, 3026, 558 , 557 , 555 , 56 , 565 , 566 , 975 , 562 , 561 , 563 , 1381 , 1387 , 1385 , 1383 , 4675 , 384 , 3844 , 3842 , 289 , 489 , 491 , 493 , 499 , 411 , 413 , 419 , 4111 , 4113 , 2579 , 1712 , 2552 , 2412 , 2413 , 2414 , 617 , 618 , 619,
  374. 9703, 9704,9705, 1833,1835, 1837, 636, 646, 626, 638,648,2906,2908,2904,2916, 2918, 2914, 6629, 9470,430, 10394, 662, 656, 658, 660,146,158,164,3043,170,2447,6686,3025,2435,7947,386,374,380,2551,4502,1725,1712,1731,7458,3840,3842,3844,542,544,10828};
  375.  
  376. */
  377. /*int[] COINS_SPAWN = {3145, 1540, 7003, 391, 4151, 11936, 3144, 6685, 13066, 386, 11937, 3145, 2441, 2437, 2443, 2445, 3041, 6686, 3025, 10926, 560, 557, 9075, 555, 560, 565, 2550, 2551, 9244, 12883, 12879, 12875, 12873,
  378. 1155,1153,1157,1165,1159,1161 ,1163,5574,1117,1115,1119,1125,1121,1123,1127 , 5575 , 1075 , 1067 , 1069 , 1077 , 1071 , 1073 , 1079 , 5576 , 1189 , 1191 , 1193 , 1195 , 1197 , 1199 , 1201 , 3105 , 4119 , 4121 , 4123 , 4125 , 4127 , 4129 , 4131 , 3751 ,
  379. 882 , 884 , 886 , 888 , 890 , 892 , 9144 , 9244 , 841 , 843 , 849 , 853 , 857 , 861 , 3749 , 10499 , 9185 , 1129 , 1133 , 1135 , 2499 , 2501 , 2503 , 863 , 869 , 1095 , 1097 , 1099 , 2493 , 2495 , 2497 , 866 , 867 , 868 , 11230 ,
  380. 556 , 554 , 3024, 3026, 558 , 557 , 555 , 56 , 565 , 566 , 975 , 562 , 561 , 563 , 1381 , 1387 , 1385 , 1383 , 4675 , 384 , 3844 , 3842 , 289 , 489 , 491 , 493 , 499 , 411 , 413 , 419 , 4111 , 4113 , 2579 , 1712 , 2552 , 2412 , 2413 , 2414 , 617 , 618 , 619,
  381. 9703, 9704,9705, 1833,1835, 1837, 636, 646, 626, 638,648,2906,2908,2904,2916, 2918, 2914, 6629, 9470,430, 10394, 662, 656, 658, 660,146,158,164,3043,170,2447,6686,3025,2435,7947,386,374,380,2551,4502,1725,1712,1731,7458,3840,3842,3844,542,544,10828,8007,8008,8009,8010,8011,8012,6666,6665,12956,12957,12958,12959,11919,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,12381,12382,12383,12384,12385,12386,12387,12388,12393,12394,12395,12396,12397,12398,12445,12446,12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12518,12519,12520,12521,12522,12523,12524,12525,12598,12599,12775,12776,12777,12778,12779,12780,12781,12782,13068,12277,12278,12279,12280,12281,12282,12283,12284,12285,12286,12287,12288,12289,12290,12291,12292,12293,12294,12295,12296,12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220,12221,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,12246,12247,12248,12249,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264,12265,12266,12267,12268,12269,12270,12271,12272,
  382. 13329,13330,13337,13338,13335,13336, 13333,13334,13332,13331,4153,4738,11128,1127,1079,11212,11235,6585,4091,4093,4224,7059,11840,7460,7461,9245,9242,4724,4726,4728,4730,4732,4734,4736,4738,4740,4745,4747,4749,4751,4753,4755,4757,4759,5698,1215,1231,5680,1201,1704,10362,1333,1319,8844,8845,8846,8847,8848,8849,8850,4097,7398,7399,7400, 3040, 4152, 4154, 9186,
  383. 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537,
  384. 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552,
  385. 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 189, 190, 191, 192, 193, 194, 2450, 2451,
  386. 9747, 9748, 9749, 9750, 9751, 9752, 9753, 9754, 9755, 9756, 9757, 9758, 9759, 9760, 9761, 9762, 9763, 9764, 9765, 9766, 9767, 9768, 9769, 9770, 9771, 9772, 9773, 9774, 9775, 9776, 9777, 9778, 9779, 9780, 9781, 9782, 9783, 9784, 9785, 9786, 9787, 9788, 9792, 9793, 9794, 9795, 9796, 9797, 9798, 9799, 9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 9811, 9812,
  387. 2444, 2445, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118};
  388. */
  389. int itemId = Integer.parseInt(args[0]);
  390. int amount = Misc.stringToInt(args[1]);
  391. // boolean PERMITTED = IntStream.of(COINS_SPAWN).anyMatch(r -> r == itemId);
  392. if(itemId > 21000) {
  393. c.sendMessage("This item does not exist!");
  394. return;
  395. }
  396. if (c.inWild() || !c.inSafeZone() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  397. c.sendMessage("You can only spawn items in a safezone.");
  398. return;
  399. }
  400.  
  401.  
  402. if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
  403. c.sendMessage("You cannot spawn items in the duel arena!");
  404. return;
  405. }
  406. if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
  407. return;
  408. }
  409. if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
  410. return;
  411. }
  412. if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
  413. return;
  414. }
  415. if (Boundary.isIn(c, Kraken.BOUNDARY)) {
  416. return;
  417. }
  418.  
  419.  
  420. // if (!PERMITTED) {
  421. // c.sendMessage("You are not allowed to spawn this item.");
  422. // return;
  423. // }
  424.  
  425.  
  426. input.toLowerCase().replaceAll("k", "000").replaceAll("m", "000000").replaceAll("b", "000000000");
  427.  
  428.  
  429.  
  430.  
  431. c.getItems().addItem(itemId, amount);
  432. } catch (NumberFormatException nfe) {
  433. c.sendMessage("Improper use of the command; '::item itemid amount'.");
  434. }
  435. }
  436. // 1155,1153,1157,1165,1159,1161 ,1163,5574,1117,1115,1119,1125,1121,1123,1127 , 5575 , 1075 , 1067 , 1069 , 1077 , 1071 , 1073 , 1079 , 5576 , 1189 , 1191 , 1193 , 1195 , 1197 , 1199 , 1201 , 3105 , 4119 , 4121 , 4123 , 4125 , 4127 , 4129 , 4131 , 3751 ,
  437. // 882 , 884 , 886 , 888 , 890 , 892 , 9144 , 9244 , 841 , 843 , 849 , 853 , 857 , 861 , 3749 , 10499 , 9185 , 1129 , 1133 , 1135 , 2499 , 2501 , 2503 , 863 , 869 , 1095 , 1097 , 1099 , 2493 , 2495 , 2497 , 866 , 867 , 868 , 11230 ,
  438. // 556 , 554 , 3024, 3026, 558 , 557 , 555 , 56 , 565 , 566 , 975 , 562 , 561 , 563 , 1381 , 1387 , 1385 , 1383 , 4675 , 384 , 3844 , 3842 , 289 , 489 , 491 , 493 , 499 , 411 , 413 , 419 , 4111 , 4113 , 2579 , 1712 , 2552 , 2412 , 2413 , 2414 , 617 , 618 , 619
  439. //9703, 9704,9705, 1833,1835, 1837, 636, 646, 626, 638,648,2906,2908,2904,2916, 2918, 2914, 6629, 9470,430, 10394, 662, 656, 658, 660,146,158,164,3043,170,2447,6686,3025,2435,7947,386,374,380,2551,4502,1725,1712,1731,7458,3840,3842,3844,542,544,10828};
  440. //int[] COINS_SPAWN = {4151, 11936, 3144, 6685, 13066, 386, 11937, 3145, 2441, 2437, 2443, 2445, 3041, 6686, 3025, 10926, 560, 557, 9075, 555, 560, 565, 2550, 2551, 9244, 12883, 12881, 12879, 12877, 12875, 12873};
  441. },
  442. DUEL {
  443. @Override
  444. public void execute(Player c, String input) {
  445. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  446. return;
  447. }
  448. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  449. return;
  450. }
  451. TeleportExecutor.teleport(c, new Position(3365, 3266, 0));
  452. }
  453. },
  454. STAKE {
  455. @Override
  456. public void execute(Player c, String input) {
  457. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  458. return;
  459. }
  460. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  461. return;
  462. }
  463. TeleportExecutor.teleport(c, new Position(3365, 3266, 0));
  464. }
  465. },
  466. HOME {
  467. @Override
  468. public void execute(Player c, String input) {
  469. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  470. return;
  471. }
  472. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  473. return;
  474. }
  475. TeleportExecutor.teleport(c, new Position(3088, 3504, 0));
  476. }
  477. },
  478. EDGE {
  479. @Override
  480. public void execute(Player c, String input) {
  481. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  482. return;
  483. }
  484. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  485. return;
  486. }
  487. TeleportExecutor.teleport(c, new Position(3088, 3504, 0));
  488. }
  489. },
  490. GE {
  491. @Override
  492. public void execute(Player c, String input) {
  493. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  494. return;
  495. }
  496. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  497. return;
  498. }
  499. TeleportExecutor.teleport(c, new Position(3164, 3484, 0));
  500. }
  501. },
  502. /*LUNARS {
  503. @Override
  504. public void execute(Player c, String input) {
  505. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  506. return;
  507. }
  508. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  509. return;
  510. }
  511. c.sendMessage("You switch to lunar magic.");
  512. c.setSidebarInterface(6, 29999);
  513. c.playerMagicBook = 2;
  514. }
  515. },
  516. ANCIENTS {
  517. @Override
  518. public void execute(Player c, String input) {
  519. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  520. return;
  521. }
  522. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  523. return;
  524. }
  525. c.sendMessage("You switch to ancient magic.");
  526. c.setSidebarInterface(6, 12855);
  527. c.playerMagicBook = 1;
  528. }
  529. },
  530. MODERN {
  531. @Override
  532. public void execute(Player c, String input) {
  533. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  534. return;
  535. }
  536. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  537. return;
  538. }
  539. c.sendMessage("You switch to modern magic.");
  540. c.setSidebarInterface(6, 1151);
  541. c.playerMagicBook = 0;
  542. }
  543. },
  544. NORMAL {
  545. @Override
  546. public void execute(Player c, String input) {
  547. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  548. return;
  549. }
  550. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  551. return;
  552. }
  553. c.sendMessage("You switch to modern magic.");
  554. c.setSidebarInterface(6, 1151);
  555. c.playerMagicBook = 0;
  556. }
  557. },
  558. FOOD {
  559. @Override
  560. public void execute(Player c, String input) {
  561. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  562. return;
  563. }
  564. if (c.inWild() || !c.inSafeZone() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  565. return;
  566. }
  567. c.getItems().addItemUnderAnyCircumstance(11936, 28);
  568. }
  569. },*/
  570. CLAIMSTATUS("checkrank", "claimrank", "checkstatus") {
  571. @Override
  572. public void execute(Player c, String input) {
  573. if (c.amDonated >= 10 && c.amDonated < 30 && c.getRights().getValue() == 0) {
  574. c.setRights(Rights.CONTRIBUTOR);
  575. }
  576. if (c.amDonated >= 30 && c.amDonated < 75 && c.getRights().getValue() <= 5 && !c.getRights().isStaff()) {
  577. c.setRights(Rights.SPONSOR);
  578. }
  579. if (c.amDonated >= 75 && c.amDonated < 150 && c.getRights().getValue() <= 6 && !c.getRights().isStaff()) {
  580. c.setRights(Rights.SUPPORTER);
  581. }
  582. if (c.amDonated >= 150 && c.amDonated < 300 && c.getRights().getValue() <= 7 && !c.getRights().isStaff()) {
  583. c.setRights(Rights.V_I_P);
  584. }
  585. if (c.amDonated >= 300 && !c.getRights().isStaff()) {
  586. c.setRights(Rights.SUPER_V_I_P);
  587. }
  588. }
  589. },
  590.  
  591.  
  592. PVP {
  593. @Override
  594. public void execute(Player c, String input) {
  595. c.safeTimer = 0;
  596. }
  597. },
  598.  
  599.  
  600. CLAIMDONATION("checkdonation", "redeemcredits", "claimcredits") {
  601. @Override
  602. public void execute(Player c, String input) {
  603. Donations.checkDonation(c);
  604. }
  605. },
  606.  
  607. GETID(owner()) {
  608. @Override
  609. public void execute(Player c, String input) {
  610. try {
  611. if (input.length() < 3) {
  612. c.sendMessage("You must give at least 3 letters of input to narrow down the item.");
  613. return;
  614. }
  615. int results = 0;
  616. c.sendMessage("Searching: " + input);
  617. for (ItemDefinition it : ItemDefinition.DEFINITIONS) {
  618. if (results == 100) {
  619. c.sendMessage("Too many results! Please refine your search.");
  620. return;
  621. }
  622. if (!it.getDescription().equalsIgnoreCase("null") && !it.isNoted())
  623. if (it.getName().replace("_", " ").toLowerCase().contains(input.toLowerCase())) {
  624. c.sendMessage("<col=FF0000>" + it.getName().replace("_", " ") + " - "
  625. + it.getId());
  626. results++;
  627. }
  628. }
  629. c.sendMessage(results + " results found...");
  630. } catch (Exception e) {
  631. }
  632. }
  633. },
  634.  
  635. SETLEVEL(owner()){
  636. @Override
  637. public void execute(Player c, String input) {
  638. int skillId;
  639. int skillLevel;
  640. String[] args = input.split(" ");
  641. System.out.println(input);
  642. if (args.length < 2) {
  643. throw new IllegalArgumentException();
  644. }
  645. if (c.inWild()|| c.inPvP()|| c.safeTimer > 0)
  646. return;
  647. for (int j = 0; j < c.playerEquipment.length; j++) {
  648. if (c.playerEquipment[j] > 0) {
  649. c.sendMessage("Please remove all your equipment before using this command.");
  650. return;
  651. }
  652. }
  653.  
  654. try {
  655. skillId = Integer.parseInt(args[0]);
  656. skillLevel = Integer.parseInt(args[1]);
  657. //if (skillId < 0 || skillId > 6) {
  658. // c.sendMessage("@red@You can only set Combat stats.");
  659. // return;
  660. //}
  661. if (skillLevel < 1) {
  662. skillLevel = 1;
  663. } else if (skillLevel > 99) {
  664. skillLevel = 99;
  665. }
  666. int[] skillIds = { 0, 1, 2, 3, 4, 5, 6
  667.  
  668. };
  669. for (int i : skillIds) {
  670.  
  671. c.getPA().refreshSkill(i);
  672. }
  673.  
  674. c.playerLevel[skillId] = skillLevel;
  675. c.getPA().refreshSkill(skillId);
  676. c.playerXP[skillId] = c.getPA().getXPForLevel(skillLevel) + 1;
  677. c.getPA().refreshSkill(skillId);
  678. c.sendMessage("@blu@Set Stat_" + SkillConstants.SKILL_NAMES[skillId] + ": to " + skillLevel);
  679. } catch (Exception e) {
  680. c.sendMessage("Error. Correct syntax: ::setlevel skillid level");
  681. }
  682. }
  683.  
  684. },
  685.  
  686. CHANGEPASS("changepassword") {
  687. @Override
  688. public void execute(Player c, String input) {
  689. if(input.length() < 3) {
  690. c.sendMessage("Your password must contain atleast 3 characters.");
  691. return;
  692. }
  693. if (input.length() > 20) {
  694. c.sendMessage("Passwords cannot contain more than 20 characters.");
  695. c.sendMessage("The password you tried had " + input.length() + " characters.");
  696. return;
  697. }
  698. if (input.contains("character-rights") || input.contains("[CHARACTER]") || input.contains(".") || input.contains("_")) {
  699. c.sendMessage("Your password contains illegal characters.");
  700. return;
  701. }
  702. //c.playerPass = input;
  703. c.playerPass = Misc.getFilteredInput(input).toLowerCase();
  704. c.sendMessage("Your password is now: @red@" + c.playerPass);
  705. }
  706. },
  707.  
  708.  
  709.  
  710. SETTAG(donator()) {
  711. @Override
  712. public void execute(Player c, String input) {
  713.  
  714. if (c.getRights().isSponsor() && c.getRights().isSupporter() && c.getRights().isVIP() && c.getRights().isSuperVIP()) {
  715.  
  716.  
  717. String[] text = input.split(" ");
  718. String[] bad = {"Dev", "@", "developer", "Developer", "dev", "@", "mod", "Mod", "Moderator", "moderator", "Admin", "Administrator", "admin", "administrator", "owner", "Owner", "Founder", "founder", "Helper", "helper", "Respected", "respected", "donator", "Donator", "www."};
  719. for(int i = 0; i < bad.length; i++){
  720. if(input.indexOf(bad[i]) >= 0){
  721. c.sendMessage("@red@You can not use this title.");
  722. return;
  723. }
  724. }
  725. try {
  726. if (text.length > 10) {
  727. c.sendMessage("@red@Your title can not be longer than 10 characters.");
  728. return;
  729. }
  730. String[] args = input.split(" ");
  731. c.yellTag = args[1];
  732. return;
  733. } catch (final Exception e) {
  734. c.sendMessage("@blu@You're not a super donator, to donate use ::donate");
  735. }
  736. }
  737.  
  738. }
  739.  
  740. },
  741.  
  742. REMOVETAG {
  743. @Override
  744. public void execute(Player c, String input) {
  745. c.yellTag = "";
  746.  
  747. }
  748.  
  749. },
  750.  
  751.  
  752.  
  753. CHAR {
  754. @Override
  755. public void execute(Player c, String input) {
  756. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  757. return;
  758. }
  759. if (c.inWild() ||c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  760. return;
  761. }
  762. c.getPA().showInterface(3559);
  763. }
  764. },
  765. COMMANDS {
  766. @Override
  767. public void execute(Player c, String input) {
  768. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  769. return;
  770. }
  771. for (int i = 8144; i < 8195; i++) {
  772. c.getPA().sendFrame126("", i);
  773. }
  774. c.getPA().sendFrame126("@blu@Commands", 8144);
  775. c.getPA().sendFrame126("", 8145);
  776. c.getPA().sendFrame126("@blu@::players@bla@ - Shows players online", 8147);
  777. c.getPA().sendFrame126("@blu@::claimvote / ::claim@bla@ - Claim your voting reward", 8148);
  778. c.getPA().sendFrame126("@blu@::train / ::training @bla@- teleports you to training area", 8149);
  779. c.getPA().sendFrame126("@blu@::empty@bla@ - Destroy all items in your inventory", 8150);
  780. c.getPA().sendFrame126("@blu@::duel / ::stake@bla@ - Teleports you to the Duel arena", 8151);
  781. c.getPA().sendFrame126("@blu@::home / ::ge@bla@ - Teleports you home", 8152);
  782. c.getPA().sendFrame126("@blu@::edge@bla@ - Teleports you to Edgeville", 8153);
  783. c.getPA().sendFrame126("@blu@::vote@bla@ - Takes you to the voting page", 8154);
  784. c.getPA().sendFrame126("@blu@::forums@bla@ - Takes you to the forums", 8155);
  785. c.getPA().sendFrame126("@blu@::store@bla@ - Takes you to the store/donation page", 8156);
  786. c.getPA().sendFrame126("@blu@::changepassword newpass@bla@ - Changes your password", 8157);
  787. c.getPA().sendFrame126("@blu@::lock@bla@ - Locks/Unlocks your XP", 8158);
  788. c.getPA().sendFrame126("@blu@::char@bla@ - Teleports you to the Make-over Mage", 8159);
  789. c.getPA().sendFrame126("@blu@::claimpayment@bla@ - Claims your donation", 8160);
  790. c.getPA().sendFrame126("@blu@::rules@bla@ - Brings you to the rules thread", 8161);
  791. c.getPA().sendFrame126("@blu@::highscores@bla@ - Brings you to the highscores", 8162);
  792. c.getPA().sendFrame126("@blu@::mb/::wests/::gdz/::easts@bla@ - Teles you to these hotspots", 8163);
  793. c.getPA().sendFrame126("@blu@::counter@bla@ - Toggles your 474 counter on/off", 8164);
  794. c.getPA().sendFrame126("@blu@::orbs@bla@ - Toggles your 474 orbs on/off", 8165);
  795. c.getPA().sendFrame126("@blu@::help@bla@ - Brings up the help request interface", 8166);
  796. c.getPA().sendFrame126("@blu@::claimstatus@bla@ - Updates your donator rank.", 8167);
  797. c.getPA().sendFrame126("@blu@::drops@bla@ - Opens drop tables.", 8168);
  798. c.getPA().sendFrame126("@blu@::answer@bla@ - attempt a answer for the trivia.", 8169);
  799. c.getPA().sendFrame126("@blu@::bosslog@bla@ - displays your boss kills.", 8170);
  800. c.getPA().sendFrame126("@dre@Donator's Only", 8172);
  801. c.getPA().sendFrame126("@dre@::yell message@bla@ - Sends a global message", 8173);
  802. c.getPA().sendFrame126("@dre@::dz@bla@ - Teleports you to the donator's zone", 8174);
  803. c.getPA().showInterface(8134);
  804. }
  805. },
  806. DONATE {
  807. @Override
  808. public void execute(Player c, String input) {
  809. c.getPA().sendFrame126("www.shayzien.com/donate", 12000);
  810. }
  811. },
  812. DOWNLOAD {
  813. @Override
  814. public void execute(Player c, String input) {
  815. c.getPA().sendFrame126("www.shayzien.org", 12000);
  816. }
  817. },
  818.  
  819. /* CLAIMVOTE("claim", "checkvote", "redeemvote") {
  820. @Override
  821. public void execute(Player c, String input) {
  822. try {
  823. VoteReward reward = Server.vote.hasVoted(c.playerName.replaceAll(" ", "_"));
  824. if (reward != null) {
  825. switch (reward.getReward()) {
  826. case 0:
  827. c.getItems().addItemUnderAnyCircumstance(784, 1);
  828. PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
  829. + " @bla@has just voted for OS-World and received a voting rewards book.");
  830. break;
  831.  
  832. }
  833. c.sendMessage("Thank you for voting for OS-WORLD!");
  834. } else {
  835. c.sendMessage("You have no voting rewards waiting for you.");
  836. }
  837. c.sendMessage("");
  838. } catch (Exception e) {
  839. c.sendMessage("A voting error has occurred, please contact an administrator.");
  840. }
  841. }
  842. },
  843. /*CLAIM {
  844. @Override
  845. public void execute(Player c, String input) {
  846. try {
  847. VoteReward reward = Server.vote.hasVoted(c.playerName.replaceAll(" ", "_"));
  848. if (reward != null) {
  849. switch (reward.getReward()) {
  850. case 0:
  851. int boneBits = 2000000 + Misc.random(500000);
  852. c.getItems().addItemUnderAnyCircumstance(995, boneBits);
  853. c.votePoints += 3;
  854.  
  855.  
  856. PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
  857. + " @bla@has just voted and received @dre@2m coins & 3 Vote Points.");
  858. if (Misc.random(7) == 7) {
  859. c.sendMessage("You was lucky and recieved a bonus Vote Points!");
  860. c.
  861.  
  862. s += 5;
  863. }
  864. break;
  865.  
  866. }
  867. c.sendMessage("Thank you for voting for OS-WORLD!");
  868. } else {
  869. c.sendMessage("You have no voting rewards waiting for you.");
  870. }
  871. c.sendMessage("");
  872. } catch (Exception e) {
  873. c.sendMessage("A voting error has occurred, please contact an administrator.");
  874. }
  875. }
  876. },*/
  877. EASTS {
  878. @Override
  879. public void execute(Player c, String input) {
  880. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  881. return;
  882. }
  883. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  884. return;
  885. }
  886. TeleportExecutor.teleport(c, new Position(3353, 3684, 0));
  887. }
  888. },
  889. FORUMS {
  890. @Override
  891. public void execute(Player c, String input) {
  892. c.getPA().sendFrame126("www.shayzien.com/forums/", 12000);
  893. }
  894. },
  895.  
  896. STORE {
  897. @Override
  898. public void execute(Player c, String input) {
  899. c.getPA().sendFrame126("www.shayzien.com/donate/", 12000);
  900. }
  901. },
  902. STREAK{
  903. @Override
  904. public void execute(Player c, String input) {
  905. c.forceChat("[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
  906. }
  907. },
  908. KILLSTREAK{
  909. @Override
  910. public void execute(Player c, String input) {
  911. c.forceChat("@dre@[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
  912. }
  913. },
  914. KS{
  915. @Override
  916. public void execute(Player c, String input) {
  917. c.forceChat("[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
  918. }
  919. },
  920. KDR{
  921. @Override
  922. public void execute(Player c, String input) {
  923. DecimalFormat df = new DecimalFormat("#.##");
  924. double ratio = ((double) c.KC) / ((double) c.DC);
  925. c.forceChat("[" + c.playerName + "] I have " + c.KC + " kills and " + c.DC + " deaths. My KDR is:"+ df.format(ratio) + "");
  926. }
  927. },
  928. WBOSS {
  929. @Override
  930. public void execute(Player c, String input) {
  931. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  932. return;
  933. }
  934. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  935. return;
  936. }
  937. TeleportExecutor.teleport(c, new Position(2980, 3871, 0));
  938. }
  939. },
  940. HELP {
  941. @Override
  942. public void execute(Player c, String input) {
  943. c.getPA().closeAllWindows();
  944. c.getPA().showInterface(59525);
  945. }
  946. },
  947. HOSTS {
  948. @Override
  949. public void execute(Player c, String input) {
  950. StringBuilder sb = new StringBuilder();
  951. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  952. if (PlayerHandler.players[i] != null) {
  953. Player c2 = PlayerHandler.players[i];
  954. if (c2.getItems().playerHasItem(15098)) {
  955. sb.append(c2.playerName + ", ");
  956. }
  957. }
  958. }
  959. if (sb.length() > 0) {
  960. String result = "@blu@Available hosts@bla@: " + sb.substring(0, sb.length() - 2);
  961. String[] wrappedLines = WordUtils.wrap(result, 80).split(System.getProperty("line.separator"));
  962. for (String line : wrappedLines) {
  963. c.sendMessage(line);
  964. }
  965. } else {
  966. c.sendMessage("@blu@No hosts available!");
  967. }
  968. }
  969. },
  970. /*BONUSXP {
  971. @Override
  972. public void execute(Player c, String input) {
  973. if (c.BONUS_WEEKEND == false) {
  974. c.BONUS_WEEKEND = true;
  975. c.sendMessage("Your XP is now: @red@locked@bla@.");
  976. } else {
  977. c.BONUS_WEEKEND = false;
  978. c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
  979. }
  980. }
  981. },*/
  982. LOCK {
  983. @Override
  984. public void execute(Player c, String input) {
  985. if (c.expLock == false) {
  986. c.expLock = true;
  987. c.sendMessage("Your XP is now: @red@locked@bla@.");
  988. } else {
  989. c.expLock = false;
  990. c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
  991. }
  992. }
  993. },
  994. MB {
  995. @Override
  996. public void execute(Player c, String input) {
  997. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  998. return;
  999. }
  1000. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1001. return;
  1002. }
  1003. TeleportExecutor.teleport(c, new Position(2539, 4716, 0));
  1004. }
  1005. },
  1006. BURNERS {
  1007. @Override
  1008. public void execute(Player c, String input) {
  1009. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1010. return;
  1011. }
  1012. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1013. return;
  1014. }
  1015. TeleportExecutor.teleport(c, new Position(1719, 3465, 0));
  1016. }
  1017. },
  1018.  
  1019. PLAYERS {
  1020. @Override
  1021. public void execute(Player c, String input) {
  1022. c.sendMessage("@bla@Online players:@blu@" + PlayerHandler.getPlayerCount() +"");
  1023. }
  1024. },
  1025.  
  1026.  
  1027. TRAIN {
  1028. @Override
  1029. public void execute(Player c, String input) {
  1030. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1031. return;
  1032. }
  1033. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1034. return;
  1035. }
  1036. TeleportExecutor.teleport(c, new Position(2672, 3712, 0));
  1037. }
  1038. },
  1039. TRAINING {
  1040. @Override
  1041. public void execute(Player c, String input) {
  1042. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1043. return;
  1044. }
  1045. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1046. return;
  1047. }
  1048. TeleportExecutor.teleport(c, new Position(2672, 3712, 0));
  1049. }
  1050. },
  1051. PLAYERS11111 {
  1052. @Override
  1053. public void execute(Player c, String input) {
  1054.  
  1055. //for (int i = 8144; i < 8195; i++) {
  1056. // c.getPA().sendFrame126("", i);
  1057. // }
  1058. // c.getPA().showInterface(8134);
  1059.  
  1060. c.getPA().sendFrame126("@blu@" + Config.SERVER_NAME + " Players:", 8144);
  1061. c.getPA().sendFrame126("@red@Online players:" + PlayerHandler.getPlayerCount() + "", 8145);
  1062. int line = 8147;
  1063. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1064.  
  1065.  
  1066. if (PlayerHandler.players[i] != null) {
  1067. Player d = c.getClient(PlayerHandler.players[i].playerName);
  1068. if (d.playerName != null) {
  1069. c.getPA().sendFrame126(d.playerName, line);
  1070. line++;
  1071. } else if (d.playerName == null) {
  1072. c.getPA().sendFrame126("@gre@", line);
  1073.  
  1074. }
  1075. }
  1076. c.getPA().sendFrame126("", i);
  1077. c.flushOutStream();
  1078. return;
  1079. }
  1080. c.sendMessage("There are currently <col=255>" + PlayerHandler.getPlayerCount() + "</col> players online on <col=255>OS-WORLD.");
  1081. }
  1082. },
  1083. RULES {
  1084. @Override
  1085. public void execute(Player c, String input) {
  1086. c.getPA().sendFrame126("www.shayzien.com/forums/index.php?/topic/1362-os-world-official-rules/", 12000);
  1087. }
  1088. },
  1089. SKULL {
  1090. @Override
  1091. public void execute(Player c, String input) {
  1092. c.isSkulled = true;
  1093. c.drawSkulls();
  1094. c.skullTimer = Config.SKULL_TIMER;
  1095. c.getPA().requestUpdates();
  1096. c.sendMessage("<col=FF0000>Talk to the Emblem Trader to receive a extended skull.</col>");
  1097. }
  1098. },
  1099. VOTE {
  1100. @Override
  1101. public void execute(Player c, String input) {
  1102. c.getPA().sendFrame126("www.shayzien.com/voting", 12000);
  1103. }
  1104. },
  1105. HIGHSCORES {
  1106. @Override
  1107. public void execute(Player c, String input) {
  1108. c.getPA().sendFrame126("www.shayzien.com/highscores", 12000);
  1109. }
  1110. },
  1111. WESTS {
  1112. @Override
  1113. public void execute(Player c, String input) {
  1114. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  1115. return;
  1116. }
  1117. if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
  1118. return;
  1119. }
  1120. TeleportExecutor.teleport(c, new Position(2979, 3597, 0));
  1121. }
  1122. },
  1123. YELL {
  1124.  
  1125. private final String[] ILLEGAL_ARGUMENTS = { ":tradereq:", "<img", "@cr", "<tran", "#url#", ":duelreq:",
  1126. ":chalreq:" };
  1127.  
  1128. @Override
  1129. public void execute(Player c, String input) {
  1130. if(c.getRights().isPlayer() || c.getRights().isManIron() || c.getRights().isUlt()) {
  1131. c.sendMessage("You need to donate to use this command. ::donate");
  1132. return;
  1133. }
  1134.  
  1135. if (c.getRights().isStaff()) {
  1136. //TODO check below and merge this shit.
  1137. String rank = "";
  1138. String message = input;
  1139. if (Connection.isMuted(c)) {
  1140. c.sendMessage("You are muted and can therefore not yell.");
  1141. return;
  1142. }
  1143. if (System.currentTimeMillis() < c.muteEnd) {
  1144. c.sendMessage("You are muted and can therefore not yell.");
  1145. return;
  1146. }
  1147. //String yellTag = "";
  1148. //if (c.yellTag.length() > 0) {
  1149. // yellTag = "[" + c.yellTag + "@bla@]";
  1150. // }
  1151. String playerTitle = c.getTitles().getCurrentTitle();
  1152. if (c.getRights().isContributor()) {
  1153.  
  1154. rank = "[@cr4@@red@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1155. }
  1156. if (c.getRights().isSponsor()) {
  1157.  
  1158. rank = "[@cr5@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1159. }
  1160. if (c.getRights().isSupporter()) {
  1161.  
  1162. rank = "[@cr6@<col=148200>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1163. }
  1164. if (c.getRights().isVIP()) {
  1165.  
  1166. rank = "[@cr7@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1167. }
  1168. if (c.getRights().isSuperVIP()) {
  1169.  
  1170. rank = "[@cr8@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1171. }
  1172. if (c.getRights().isElite()) {
  1173.  
  1174. rank = "[@cr30@@or2@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1175. }
  1176. if (c.getRights().isLegend()) {
  1177.  
  1178. rank = "[@cr31@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1179. }
  1180. if (c.getRights().isRespectedMember()) {
  1181.  
  1182. rank = "[@cr9@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1183. }
  1184. if (c.getRights().isHelper()) {
  1185.  
  1186. rank = "[@cr10@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1187. }
  1188. /* Staff */
  1189. if (c.getRights().isModerator()) {
  1190.  
  1191. rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1192. }
  1193. if (c.getRights().isAdministrator()) {
  1194.  
  1195. rank = "[@cr2@@yel@"
  1196. + "istrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1197. }
  1198. if (c.playerName.equalsIgnoreCase("sean")) {
  1199. //rank = "<col=5E14A7>Owner</col>" + Misc.ucFirst(c.playerName) + ":<col=0000FF>";
  1200. rank = "[<col=5E14A7>@cr2@Owner]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1201. }
  1202. if (c.playerName.equalsIgnoreCase("")) {
  1203. rank = "[<col=5E14A7>@cr2@Community Manager]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1204. }
  1205. message = message.toLowerCase();
  1206. for (String argument : ILLEGAL_ARGUMENTS) {
  1207. if (message.contains(argument)) {
  1208. c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
  1209. return;
  1210. }
  1211. }
  1212. message = Misc.ucFirst(message);
  1213. PlayerHandler.executeGlobalMessage(rank + message);
  1214. return;
  1215. }
  1216. String rank = "";
  1217. String message = input;
  1218. if (Connection.isMuted(c)) {
  1219. c.sendMessage("You are muted and can therefore not yell.");
  1220. return;
  1221. }
  1222. if (System.currentTimeMillis() < c.muteEnd) {
  1223. c.sendMessage("You are muted and can therefore not yell.");
  1224. return;
  1225. }
  1226. if (!c.lastYell.elapsed(5000) && c.getRights().isContributor()) {
  1227. c.sendMessage("You are a @red@Contributor@bla@ and must wait 5 seconds between each yell.");
  1228. return;
  1229. }
  1230. if (!c.lastYell.elapsed(5000) && c.getRights().isSponsor()) {
  1231. c.sendMessage("You are a @blu@Sponsor@bla@ and must wait 5 seconds between each yell.");
  1232. return;
  1233. }
  1234. if (!c.lastYell.elapsed(5000) && c.getRights().isSupporter()) {
  1235. c.sendMessage("You are a Supporter and must wait 5 seconds between each yell.");
  1236. return;
  1237. }
  1238. if (!c.lastYell.elapsed(5000) && c.getRights().isVIP()) {
  1239. c.sendMessage("You are a <col=FF00CD>VIP</col>@bla@ and must wait 5 seconds between each yell.");
  1240. return;
  1241. }
  1242. if (!c.lastYell.elapsed(5000) && c.getRights().isSuperVIP()) {
  1243. c.sendMessage("You are a @yel@Super VIP@bla@ and must wait 5 seconds between each yell.");
  1244. return;
  1245. }
  1246. String playerTitle = c.getTitles().getCurrentTitle();
  1247. if (c.getRights().isContributor()) {
  1248.  
  1249. rank = "[@cr4@@red@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1250. }
  1251. if (c.getRights().isSponsor()) {
  1252.  
  1253. rank = "[@cr5@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1254. }
  1255. if (c.getRights().isSupporter()) {
  1256.  
  1257. rank = "[@cr6@<col=148200>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1258. }
  1259. if (c.getRights().isVIP()) {
  1260.  
  1261. rank = "[@cr7@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1262. }
  1263. if (c.getRights().isSuperVIP()) {
  1264.  
  1265. rank = "[@cr8@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1266. }
  1267. if (c.getRights().isElite()) {
  1268.  
  1269. rank = "[<img=30>@or2@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1270. }
  1271. if (c.getRights().isLegend()) {
  1272.  
  1273. rank = "[<img=31>@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1274. }
  1275. if (c.getRights().isRespectedMember()) {
  1276.  
  1277. rank = "[@cr9@@red@" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1278. }
  1279. if (c.getRights().isHelper()) {
  1280.  
  1281. rank = "[@cr10@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1282. }
  1283. /* Staff */
  1284. if (c.getRights().isModerator()) {
  1285.  
  1286. rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
  1287. }
  1288. if (c.getRights().isAdministrator()) {
  1289.  
  1290. rank = "[@cr2@@yel@Administrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
  1291. }
  1292. if (c.getRights().isOwner() && !c.playerName.equalsIgnoreCase("Notepad")) {
  1293. rank = "[<col=A67711>Owner</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1294. }
  1295. if (c.playerName.equalsIgnoreCase("Mod trent")) {
  1296. rank = "[<col=5E14A7>Server BITCH</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
  1297. }
  1298. message = message.toLowerCase();
  1299. for (String argument : ILLEGAL_ARGUMENTS) {
  1300. if (message.contains(argument)) {
  1301. c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
  1302. return;
  1303. }
  1304. }
  1305. c.lastYell.reset();
  1306. message = Misc.ucFirst(message);
  1307. PlayerHandler.executeGlobalMessage(rank + message);
  1308. }
  1309. },
  1310.  
  1311. /*
  1312. * Donator
  1313. */
  1314. DONATORTITLE(donator()) {
  1315. @Override
  1316. public void execute(Player c, String input) {
  1317. c.sendMessage("You will now get your donator title instead. Relog for changes to take effect.");
  1318. c.keepTitle = false;
  1319. c.killTitle = false;
  1320. }
  1321. },
  1322. DONATORZONE(donator(), "dz") {
  1323. @Override
  1324. public void execute(Player c, String input) {
  1325. if (c.inTrade || c.inDuel || c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
  1326. return;
  1327. }
  1328. TeleportExecutor.teleport(c, new Position(2848, 5075, 0));
  1329. }
  1330. },
  1331.  
  1332. KILLTITLE(donator()) {
  1333. @Override
  1334. public void execute(Player c, String input) {
  1335. c.sendMessage("You will now be using your kill title instead. Relog for changes to take effect.");
  1336. c.keepTitle = false;
  1337. c.killTitle = true;
  1338. }
  1339. },
  1340.  
  1341. /*
  1342. * HELPER
  1343. */
  1344.  
  1345. HELPDB(helper()) {
  1346. @Override
  1347. public void execute(Player c, String input) {
  1348. HelpDatabase.getDatabase().openDatabase(c);
  1349. }
  1350. },
  1351.  
  1352. /*
  1353. * Moderator
  1354. */
  1355. CHECKINVENTORY(mod()) {
  1356. @Override
  1357. public void execute(Player c, String input) {
  1358. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1359. if (optionalPlayer.isPresent()) {
  1360. Player c2 = optionalPlayer.get();
  1361. c.getPA().otherInv(c, c2);
  1362. c.getDH().sendDialogues(206, 0);
  1363. } else {
  1364. c.sendMessage(input + " is not online. You can only check the inventory of online players.");
  1365. }
  1366. }
  1367. },
  1368. INFO(owner()) {
  1369. @Override
  1370. public void execute(Player c, String input) {
  1371. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1372. if (optionalPlayer.isPresent()) {
  1373. Player c2 = optionalPlayer.get();
  1374. c.sendMessage("IP of " + c2.playerName + " : " + c2.connectedFrom);
  1375. c.sendMessage("Mac Address of " + c2.playerName + " : " + c2.getMacAddress());
  1376. } else {
  1377. c.sendMessage(input + " is not line. You can request the info of online players.");
  1378. }
  1379. }
  1380. },
  1381. KSMOD(mod()) {
  1382. @Override
  1383. public void execute(Player c, String input) {
  1384. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1385. if (optionalPlayer.isPresent()) {
  1386. Player c2 = optionalPlayer.get();
  1387. c.sendMessage("Hunter killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.HUNTER));
  1388. c.sendMessage("Rogue killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.ROGUE));
  1389. }
  1390. }
  1391. },
  1392. LOCKACC(mod()) {
  1393. @Override
  1394. public void execute(Player c, String input) {
  1395. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  1396. c.sendMessage("You're not permitted for this.");
  1397. return;
  1398. }
  1399. try {
  1400. String[] args = input.split(" ");
  1401. if (args.length != 1) {
  1402. c.sendMessage("Invalid arguments specified!");
  1403. throw new IllegalArgumentException();
  1404. }
  1405. String name = args[0];
  1406. Connection.lockAccount(name);
  1407. Connection.addNameToLocks(name);
  1408.  
  1409. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  1410. if (optionalPlayer.isPresent()) {
  1411. Player c2 = optionalPlayer.get();
  1412. if (c2.getRights().isBetween(2, 3)) {
  1413. c.sendMessage("You cannot lock this player's account!");
  1414. return;
  1415. }
  1416. if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  1417. MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  1418. session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  1419. }
  1420. c2.disconnected = true;
  1421. c.sendMessage(Misc.formatPlayerName(name) + "'s account has been locked.");
  1422. }
  1423. } catch (Exception e) {
  1424. e.printStackTrace();
  1425. c.sendMessage("Correct usage: ::lock playername");
  1426. }
  1427. }
  1428. },
  1429. MARKETUNMUTE(mod()) {
  1430. @Override
  1431. public void execute(Player c, String input) {
  1432. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  1433. c.sendMessage("You're not permitted for this.");
  1434. return;
  1435. }
  1436.  
  1437. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1438. if (optionalPlayer.isPresent()) {
  1439. Player c2 = optionalPlayer.get();
  1440. c2.marketMuteEnd = 0;
  1441. c.sendMessage(c2.playerName + " has been unmuted on the market channel.");
  1442. c2.sendMessage("@red@You have been unmuted by " + c.playerName + " on the market channel.");
  1443. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Market Unmute", "");
  1444. }
  1445. }
  1446. },
  1447. MOVE(admin()) {
  1448. @Override
  1449. public void execute(Player c, String input) {
  1450. try {
  1451. String[] args = input.split(" ");
  1452. int positionOffset = Integer.parseInt(args[1]);
  1453. int x = c.absX;
  1454. int y = c.absY;
  1455. int height = c.heightLevel;
  1456. switch (args[0].toLowerCase()) {
  1457. case "up":
  1458. height += positionOffset;
  1459. break;
  1460. case "down":
  1461. height -= positionOffset;
  1462. break;
  1463. case "north":
  1464. y += positionOffset;
  1465. break;
  1466. case "east":
  1467. x += positionOffset;
  1468. break;
  1469. case "south":
  1470. y -= positionOffset;
  1471. break;
  1472. case "west":
  1473. x -= positionOffset;
  1474. break;
  1475. }
  1476. c.getPA().movePlayer(x, y, height);
  1477. } catch (Exception e) {
  1478. c.sendMessage("Error. Correct syntax: ::move up/down/north/east/south/west amount");
  1479. }
  1480. }
  1481. },
  1482. RANDOM(mod()) {
  1483. @Override
  1484. public void execute(Player c, String input) {
  1485. String[] args = input.split("-");
  1486. boolean ignore = false;
  1487. if (args.length > 2) {
  1488. c.sendMessage("Incorrect syntax; '::random-name'");
  1489. return;
  1490. }
  1491. if (args.length == 2) {
  1492. if (args[1].equals("ignore")) {
  1493. if (!c.getRights().inherits(Rights.ADMINISTRATOR)) {
  1494. c.sendMessage("You cannot force this, you do not inherit Administrative rights.");
  1495. return;
  1496. }
  1497. ignore = true;
  1498. } else {
  1499. c.sendMessage("The second argument should contain 'ignore', please try again.");
  1500. return;
  1501. }
  1502. }
  1503. Optional<Player> online = PlayerHandler.getOptionalPlayer(args[0]);
  1504. if (!online.isPresent()) {
  1505. c.sendMessage("This player is not online.");
  1506. return;
  1507. }
  1508. Player target = online.get();
  1509. if (target.getInterfaceEvent().isActive()) {
  1510. c.sendMessage("The event is already active for this player. It should resolve shortly.");
  1511. return;
  1512. }
  1513. if (!target.getInterfaceEvent().isExecutable() && !ignore) {
  1514. c.sendMessage("The event is deemed as 'un-executable'. This could be due to a number of reasons.");
  1515. c.sendMessage("If you believe the event should ignore this, type ::random-name-ignore to do so.");
  1516. c.sendMessage("Only administrative staff have this access.");
  1517. return;
  1518. }
  1519. c.sendMessage("You have executed the random event for this player.");
  1520. target.getInterfaceEvent().execute();
  1521. }
  1522. },
  1523. STAFFTITLE(mod()) {
  1524. @Override
  1525. public void execute(Player c, String input) {
  1526. c.sendMessage("You will now get your staff title instead. Relog for changes to take effect.");
  1527. c.keepTitle = false;
  1528. c.killTitle = false;
  1529. }
  1530. },
  1531. STAFFZONE(helper()) {
  1532. @Override
  1533. public void execute(Player c, String input) {
  1534. TeleportExecutor.teleport(c, new Position(2912, 5475, 0));
  1535. }
  1536. },
  1537. TELETO(mod(), "xteleto") {
  1538. @Override
  1539. public void execute(Player c, String input) {
  1540. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1541. if (optionalPlayer.isPresent()) {
  1542. Player c2 = optionalPlayer.get();
  1543. c.getPA().movePlayer(c2.getX(), c2.getY(), c2.heightLevel);
  1544. } else {
  1545. c.sendMessage(input + " is not line. You can only teleport to online players.");
  1546. }
  1547. }
  1548. },
  1549. TELETOME(mod()) {
  1550. @Override
  1551. public void execute(Player c, String input) {
  1552. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  1553. c.sendMessage("You're not permitted for this.");
  1554. return;
  1555. }
  1556. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1557. if (optionalPlayer.isPresent()) {
  1558. Player c2 = optionalPlayer.get();
  1559. c2.teleportToX = c.absX;
  1560. c2.teleportToY = c.absY;
  1561. c2.heightLevel = c.heightLevel;
  1562. c.sendMessage(Misc.formatPlayerName(c2.playerName)+ " has been teleported to you.");
  1563. } else {
  1564. c.sendMessage(input + " is offline. You can only teleport online players.");
  1565. }
  1566. }
  1567. },
  1568. UNLOCK(mod()) {
  1569. @Override
  1570. public void execute(Player c, String input) {
  1571. try {
  1572. String[] args = input.split(" ");
  1573. if (args.length != 1) {
  1574. c.sendMessage("Invalid arguments specified!");
  1575. throw new IllegalArgumentException();
  1576. }
  1577. String name = args[0];
  1578. if (Connection.lockedAccounts.contains(name)) {
  1579. Connection.unlockAccount(name);
  1580. c.sendMessage(Misc.formatPlayerName(name) + "'s account has been unlocked.");
  1581. } else {
  1582. c.sendMessage("That player's account is not locked.");
  1583. }
  1584. } catch (Exception e) {
  1585. e.printStackTrace();
  1586. c.sendMessage("Correct usage: ::unlock playername");
  1587. }
  1588. }
  1589. },
  1590. VISIBILITY(admin()) {
  1591. @Override
  1592. public void execute(Player c, String input) {
  1593. if (c.isInvisible()) {
  1594. c.setInvisible(false);
  1595. c.sendMessage("You are no longer invisible.");
  1596. } else {
  1597. c.setInvisible(true);
  1598. c.sendMessage("You are now invisible.");
  1599. }
  1600. c.getPA().requestUpdates();
  1601. }
  1602. },
  1603.  
  1604. /*
  1605. * Administrator
  1606. */
  1607. CHECKBANK(owner()) {
  1608. @Override
  1609. public void execute(Player c, String input) {
  1610. if (PlayerHandler.updateRunning) {
  1611. c.sendMessage("You cannot view a bank whilst the server is updating.");
  1612. return;
  1613. }
  1614. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1615. if (optionalPlayer.isPresent()) {
  1616. c.getPA().openOtherBank(optionalPlayer.get());
  1617. } else {
  1618. c.sendMessage(input + " is not online. You can only view the bank of online players.");
  1619. }
  1620. }
  1621. },
  1622. DUELARENA(owner()) {
  1623. @Override
  1624. public void execute(Player c, String input) {
  1625. Config.NEW_DUEL_ARENA_ACTIVE = Config.NEW_DUEL_ARENA_ACTIVE ? false : true;
  1626. c.sendMessage("The duel arena is currently " + (Config.NEW_DUEL_ARENA_ACTIVE ? "Enabled" : "Disabled") + ".");
  1627. }
  1628. },
  1629. EMPTY {
  1630. @Override
  1631. public void execute(Player c, String input) {
  1632. if (!c.inWild() && !c.inCamWild() && !c.inPvP() && !c.inDuel) {
  1633. c.getPA().removeAllItems();
  1634. c.sendMessage("You empty your inventory.");
  1635. } else {
  1636. c.sendMessage("You cannot empty your inventory here.");
  1637. }
  1638.  
  1639. //c.sendMessage("This command is not available at this time.");
  1640.  
  1641. }
  1642. },
  1643. SPAWNNPC(owner()) {
  1644. public void execute(Player c, String input) {
  1645. String[] args = input.split(" ");
  1646. try {
  1647. BufferedWriter spawn = new BufferedWriter(new FileWriter("./Data/cfg/spawn-config.cfg", true));
  1648. int npcId = Integer.parseInt(args[0]);
  1649. if (npcId > 0) {
  1650. Server.npcHandler.spawnNpc(c, npcId, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  1651. c.sendMessage("You have spawned: " + npcId + "Name: " + NpcDefinition.DEFINITIONS[npcId].getName());
  1652. } else {
  1653. c.sendMessage("No Such Npc");
  1654. }
  1655. try {
  1656. spawn.newLine();
  1657. spawn.write("spawn = " + npcId + " " + c.absX + " " + c.absY + " 0 1 0 0 0");
  1658. } finally {
  1659. spawn.close();
  1660. }
  1661. } catch (IOException e) {
  1662. }
  1663. }
  1664. },
  1665. GODMODE(owner()) {
  1666. @Override
  1667. public void execute(Player c, String input) {
  1668. if (c.inGodmode()) {
  1669. c.playerLevel[Skill.STRENGTH.getId()] = 99;
  1670. c.getPA().refreshSkill(2);
  1671. c.playerLevel[Skill.HITPOINTS.getId()] = 99;
  1672. c.getPA().refreshSkill(3);
  1673. c.playerLevel[Skill.PRAYER.getId()] = 99;
  1674. c.getPA().refreshSkill(5);
  1675. c.specAmount = 10.0;
  1676. c.getPA().requestUpdates();
  1677. c.setSafemode(false);
  1678. c.setGodmode(false);
  1679. c.sendMessage("Godmode deactivated. Return to base for debriefing.");
  1680. } else {
  1681. c.playerLevel[Skill.STRENGTH.getId()] = 9999;
  1682. c.getPA().refreshSkill(Skill.STRENGTH.getId());
  1683. c.playerLevel[3] = Integer.MAX_VALUE;
  1684. c.getPA().refreshSkill(3);
  1685. c.playerLevel[5] = Integer.MAX_VALUE;
  1686. c.getPA().refreshSkill(5);
  1687. c.specAmount = Integer.MAX_VALUE;
  1688. c.getPA().requestUpdates();
  1689. c.setSafemode(true);
  1690. c.setGodmode(true);
  1691. c.sendMessage("Godmode activated. Good luck soldier!");
  1692. }
  1693. }
  1694. },
  1695. MACBAN(owner()) {
  1696.  
  1697. @Override
  1698. public void execute(Player c, String input) {
  1699. if (isMacAddress(input)) {
  1700. banAddress(c, input);
  1701. } else {
  1702. banPlayer(c, input);
  1703. }
  1704. }
  1705.  
  1706. void banPlayer(Player c, String input) {
  1707. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  1708. if (optionalPlayer.isPresent()) {
  1709. Player c2 = optionalPlayer.get();
  1710. if (c2.getMacAddress().isEmpty()) {
  1711. c.sendMessage("The players mac address is empty and therefor cannot be added to the list.");
  1712. c.sendMessage("This happens when the client cannot determine the player address during login.");
  1713. c.sendMessage("You are going to have to consider another possible means of action.");
  1714. return;
  1715. }
  1716. if (Connection.isMacBanned(c2.getMacAddress())) {
  1717. c.sendMessage("This player is already mac banned, they shouldn't be online.");
  1718. c.sendMessage("Consider another possible means of action.");
  1719. return;
  1720. }
  1721. Connection.addNameToBanList(c2.playerName, Long.MAX_VALUE);
  1722. Connection.addMacBan(c2.getMacAddress());
  1723. c.sendMessage(c2.playerName + " has been mac banned with the address: " + c2.getMacAddress() + ".");
  1724. c2.disconnected = true;
  1725. c2.properLogout = true;
  1726. } else {
  1727. c.sendMessage(input + " is offline. Try '::macban macaddress' instead to ban offline players.");
  1728. }
  1729. }
  1730.  
  1731. void banAddress(Player c, String input) {
  1732. Connection.addMacBan(input);
  1733. c.sendMessage("Mac address: " + input + " has been banned.");
  1734. }
  1735.  
  1736. boolean isMacAddress(String input) {
  1737. return input.length() == 17 && StringUtils.countMatches(input, "-") == 5;
  1738. }
  1739. },
  1740. PNPC(owner()) {
  1741. @Override
  1742. public void execute(Player c, String input) {
  1743. try {
  1744. String args[] = input.split("-");
  1745. if (args.length != 2) {
  1746. throw new IllegalArgumentException();
  1747. }
  1748. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
  1749. if (optionalPlayer.isPresent()) {
  1750. Player c2 = optionalPlayer.get();
  1751. int npc = Integer.parseInt(args[1]);
  1752. if (npc < 9999) {
  1753. c2.npcId2 = npc;
  1754. c2.playerWalkIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1755. c2.playerStandIndex = NPCCacheDefinition.forID(npc).getStandIndex();
  1756. c2.playerRunIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1757. c2.playerTurnIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1758. c2.playerTurn180Index = NPCCacheDefinition.forID(npc).getWalkIndex();
  1759. c2.playerTurn90CCWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1760. c2.playerTurn90CWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
  1761. c2.isNpc = true;
  1762. c2.updateRequired = true;
  1763. c2.appearanceUpdateRequired = true;
  1764. }
  1765. } else {
  1766. throw new IllegalStateException();
  1767. }
  1768. } catch (IllegalArgumentException e) {
  1769. c.sendMessage("Error. Correct syntax: ::pnpc-player-npcid");
  1770. } catch (IllegalStateException e) {
  1771. c.sendMessage("You can only use the command on online players.");
  1772. }
  1773. }
  1774. },
  1775. SAFEMODE() {
  1776. @Override
  1777. public void execute(Player c, String input) {
  1778. if (c.inSafemode()) {
  1779. c.setSafemode(false);
  1780. c.sendMessage("You now lose items on death again.");
  1781. } else {
  1782. c.setSafemode(true);
  1783. c.sendMessage("You no longer lose items on death.");
  1784. }
  1785. }
  1786. },
  1787. SETVAR(owner()) {
  1788. @Override
  1789. public void execute(Player c, String input) {
  1790. String[] args = input.split(" ");
  1791. if (args.length != 2) {
  1792. c.sendMessage("Code red! Invalid var arguments specified! Try again?");
  1793. return;
  1794. }
  1795. String variable = args[0];
  1796. String t;
  1797. Double value2 = Double.parseDouble(args[1]);
  1798. int value = value2.intValue();
  1799. if (variable.startsWith("com_")) {
  1800. t = variable.substring(4);
  1801. switch (t) {
  1802. case "god":
  1803. c.setGodmode(value == 1 ? true : false);
  1804. if (value == 0) {
  1805. c.playerLevel[3] = 99;
  1806. c.getPA().refreshSkill(3);
  1807. c.playerLevel[5] = 99;
  1808. c.specAmount = 10.0;
  1809. c.getPA().refreshSkill(5);
  1810. c.getPA().requestUpdates();
  1811. c.setSafemode(false);
  1812. } else {
  1813. c.playerLevel[Skill.STRENGTH.getId()] = 9999;
  1814. c.getPA().refreshSkill(Skill.STRENGTH.getId());
  1815. c.playerLevel[3] = Integer.MAX_VALUE;
  1816. c.getPA().refreshSkill(3);
  1817. c.playerLevel[5] = Integer.MAX_VALUE;
  1818. c.getPA().refreshSkill(5);
  1819. c.specAmount = Integer.MAX_VALUE;
  1820. c.getPA().requestUpdates();
  1821. c.setSafemode(true);
  1822. }
  1823. break;
  1824. case "droprate":
  1825. c.setDropModifier(value2);
  1826. c.sendMessage("set " + variable + ": to " + value2);
  1827. return;
  1828. case "poison":
  1829. c.setPoisonDamage((byte) value);
  1830. c.getPA().requestUpdates();
  1831. break;
  1832. case "venom":
  1833. c.setVenomDamage((byte) value);
  1834. c.getPA().requestUpdates();
  1835. break;
  1836. default:
  1837. throwInvalid(c);
  1838. return;
  1839. }
  1840. c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1841. } else if (variable.startsWith("jmod_")) {
  1842. t = variable.substring(5);
  1843. switch (t) {
  1844. case "bh":
  1845. Config.BOUNTY_HUNTER_ACTIVE = value == 1 ? true : false;
  1846. break;
  1847. case "debug":
  1848. c.setDebug(value);
  1849. break;
  1850. case "dxp":
  1851. Config.BONUS_WEEKEND = value == 1 ? true : false;
  1852. break;
  1853. case "attackable":
  1854. Config.ADMIN_ATTACKABLE = value >= 1 ? true : false;
  1855. break;
  1856. default:
  1857. throwInvalid(c);
  1858. return;
  1859. }
  1860. c.sendMessage("set " + variable + ": to " + value);
  1861. } else if (variable.startsWith("tzhaar_")) {
  1862. t = variable.substring(7);
  1863. switch (t) {
  1864. case "wave":
  1865. c.waveId = value;
  1866. break;
  1867. }
  1868. c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1869. } else if (variable.startsWith("clanwars_")) {
  1870. t = variable.substring(9);
  1871. switch (t) {
  1872. case "ffa":
  1873. //ClanWars.FFA_ENABLED = value >= 1 ? true : false;
  1874. break;
  1875. case "challenge":
  1876. //ClanWars.CHALLENGE_ENABLED = value >= 1 ? true : false;
  1877. break;
  1878. default:
  1879. throwInvalid(c);
  1880. return;
  1881. }
  1882. c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1883. } else if (variable.startsWith("wep_")) {
  1884. t = variable.substring(4);
  1885. switch (t) {
  1886. case "blowpipe":
  1887. c.setToxicBlowpipeCharge(value);
  1888. c.setToxicBlowpipeAmmo(value);
  1889. c.setToxicBlowpipeAmmoAmount(value);
  1890. break;
  1891. case "trident":
  1892. c.setTridentCharge(value);
  1893. c.setToxicTridentCharge(value);
  1894. break;
  1895. case "serp":
  1896. c.setSerpentineHelmCharge(value);
  1897. break;
  1898. case "toxic":
  1899. c.setToxicStaffOfDeadCharge(value);
  1900. break;
  1901. default:
  1902. throwInvalid(c);
  1903. return;
  1904. }
  1905. c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
  1906. } else if (variable.startsWith("help")) {
  1907. c.getDH().sendStatement("Var arguments: com_god, config_bh, config_dxp, tzhaar_wave, config_attackable");
  1908. } else {
  1909. throwInvalid(c);
  1910. }
  1911. }
  1912.  
  1913. private int BASE_VARIABLE = 15;
  1914.  
  1915.  
  1916. /**
  1917. * Throws a lovely invalid message should the player's arguments be invalid.
  1918. * @param c the player
  1919. */
  1920. private void throwInvalid(Player c) {
  1921. c.sendMessage("Code red! Invalid var arguments specified! Try again?");
  1922. }
  1923. },
  1924. SMESSAGE(admin()) {
  1925. @Override
  1926. public void execute(Player c, String input) {
  1927. String[] args = input.split("-");
  1928. if (args.length != 2) {
  1929. c.sendMessage("Improper syntax; type ::smessage-player-message");
  1930. return;
  1931. }
  1932. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
  1933. if (optionalPlayer.isPresent()) {
  1934. Player c2 = optionalPlayer.get();
  1935. c2.sendMessage(args[1]);
  1936. } else {
  1937. c.sendMessage(args[0] + " is not online. You can only send messages to online players.");
  1938. }
  1939. }
  1940. },
  1941. /*SPELLS {
  1942. @Override
  1943. public void execute(Player c, String input) {
  1944. if(c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
  1945. c.sendMessage("You can only spawn items in a safezone.");
  1946. return;
  1947. }
  1948. if (c.playerMagicBook == 2) {
  1949. c.sendMessage("You switch to modern magic.");
  1950. c.setSidebarInterface(6, 1151);
  1951. c.playerMagicBook = 0;
  1952. } else if (c.playerMagicBook == 0) {
  1953. c.sendMessage("You switch to ancient magic.");
  1954. c.setSidebarInterface(6, 12855);
  1955. c.playerMagicBook = 1;
  1956. } else if (c.playerMagicBook == 1) {
  1957. c.sendMessage("You switch to lunar magic.");
  1958. c.setSidebarInterface(6, 29999);
  1959. c.playerMagicBook = 2;
  1960. }
  1961. }
  1962. },*/
  1963. UNIPBAN(owner()) {
  1964. @Override
  1965. public void execute(Player c, String input) {
  1966. if (input.isEmpty()) {
  1967. c.sendMessage("You must enter a valid IP address.");
  1968. return;
  1969. }
  1970. if (!Connection.isIpBanned(input)) {
  1971. c.sendMessage("This IP address is not listed as IP banned");
  1972. return;
  1973. }
  1974. try {
  1975. Connection.removeIpBan(input);
  1976. } catch (IOException e) {
  1977. c.sendMessage("The IP could not be successfully removed from the file.");
  1978. return;
  1979. }
  1980. Connection.removeIpFromBanList(input);
  1981. c.sendMessage("The IP '"+input+"' has been removed from the IP ban list.");
  1982. }
  1983. },
  1984. UNMACBAN(owner()) {
  1985. @Override
  1986. public void execute(Player c, String input) {
  1987. try {
  1988. c.sendMessage("address: " + input);
  1989. if (!Connection.isMacBanned(input)) {
  1990. c.sendMessage("The address does not exist in the list, make sure it matches perfectly.");
  1991. return;
  1992. }
  1993. Connection.removeMacBan(input);
  1994. c.sendMessage("The mac ban on the address; " + input + " has been lifted.");
  1995. } catch (IndexOutOfBoundsException exception) {
  1996. c.sendMessage("Error. Correct syntax: ::unmacban address.");
  1997. }
  1998. }
  1999. },
  2000. UPDATEBANS(owner()) {
  2001. @Override
  2002. public void execute(Player c, String input) {
  2003. Connection.resetIpBans();
  2004. }
  2005. },
  2006.  
  2007. /*
  2008. * OWNER
  2009. */
  2010.  
  2011. BANK(owner()) {
  2012. @Override
  2013. public void execute(Player c, String input) {
  2014. c.getPA().openUpBank();
  2015. }
  2016. },
  2017. BARRAGE(owner()) {
  2018. @Override
  2019. public void execute(Player c, String input) {
  2020. c.sendMessage("This command is not available at this time.");
  2021. }
  2022. },
  2023. BH(owner()) {
  2024. @Override
  2025. public void execute(Player c, String input) {
  2026. //Config.BOUNTY_HUNTER_ACTIVE = Config.BOUNTY_HUNTER_ACTIVE ? false : true;
  2027. //c.sendMessage(Config.BOUNTY_HUNTER_ACTIVE ? "Bounty hunter is now active." : "Bounty hunter is no longer active.");
  2028. }
  2029. },
  2030.  
  2031. /* LOCK {
  2032. @Override
  2033. public void execute(Player c, String input) {
  2034. if (c.expLock == false) {
  2035. c.expLock = true;
  2036. c.sendMessage("Your XP is now: @red@locked@bla@.");
  2037. } else {
  2038. c.expLock = false;
  2039. c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
  2040. }
  2041. }
  2042. },*/
  2043.  
  2044. BONUSON(owner()) {
  2045. @Override
  2046. public void execute(Player c, String input) {
  2047.  
  2048. c.BONUS_WEEKEND = true;
  2049. c.sendMessage("BONUS WEEKEND TOGGLED ON");
  2050.  
  2051. }
  2052. },
  2053. BONUSOFF(owner()) {
  2054. @Override
  2055. public void execute(Player c, String input) {
  2056.  
  2057. c.BONUS_WEEKEND = false;
  2058. c.sendMessage("BONUS WEEKEND TOGGLED Off");
  2059.  
  2060. }
  2061. },
  2062. CUSTOM(owner()) {
  2063. @Override
  2064. public void execute(Player c, String input) {
  2065. c.getPA().checkObjectSpawn(411, 2340, 9806, 2, 10);
  2066. }
  2067. },
  2068. CYBER(owner()) {
  2069. @Override
  2070. public void execute(Player c, String input) {
  2071. if (Config.CYBER_MONDAY) {
  2072. Config.CYBER_MONDAY = false;
  2073. c.sendMessage("CYBER MONDAY TOGGLED OFF");
  2074. } else {
  2075. Config.CYBER_MONDAY = true;
  2076. c.sendMessage("CYBER MONDAY TOGGLED ON");
  2077. }
  2078. }
  2079. },
  2080. DEBUG(owner()) {
  2081. @Override
  2082. public void execute(Player c, String input) {
  2083. if (Config.SERVER_DEBUG) {
  2084. Config.SERVER_DEBUG = false;
  2085. // PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled off by " +c.playerName);
  2086. } else {
  2087. Config.SERVER_DEBUG = true;
  2088. //PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled on by " +c.playerName);
  2089. }
  2090. }
  2091. },
  2092. DEMOTE(owner()) {
  2093. @Override
  2094. public void execute(Player c, String input) {
  2095. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2096. if (optionalPlayer.isPresent()) {
  2097. Player c2 = optionalPlayer.get();
  2098. c2.setRights(Rights.PLAYER);
  2099. c.sendMessage("You've demoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
  2100. c2.disconnected = true;
  2101. } else {
  2102. c.sendMessage(input + " is not online. You can only demote online players.");
  2103. }
  2104. }
  2105. },
  2106. EMOTE(owner()) {
  2107. @Override
  2108. public void execute(Player c, String input) {
  2109. c.animation(Integer.parseInt(input));
  2110. c.getPA().requestUpdates();
  2111. }
  2112. },
  2113. FALEM(owner()) {
  2114. @Override
  2115. public void execute(Player c, String input) {
  2116. for (int j = 0; j < PlayerHandler.players.length; j++) {
  2117. if (PlayerHandler.players[j] != null) {
  2118. Player c2 = PlayerHandler.players[j];
  2119. c2.forceChat(input);
  2120. c2.forcedChatUpdateRequired = true;
  2121. c2.updateRequired = true;
  2122. }
  2123. }
  2124. }
  2125. },
  2126. GET(owner()) {
  2127. @Override
  2128. public void execute(Player c, String input) {
  2129. try {
  2130. String[] args = input.split(" ");
  2131. String regex = args[0].replaceAll("_", " ").toLowerCase();
  2132. List<ItemDefinition> list = new Gson().fromJson(FileUtils.readFileToString(new File("./Data/json/item_definitions.json")),new TypeToken<List<ItemDefinition>>() { }.getType());
  2133. Optional<ItemDefinition> item = list.stream().filter(i -> i.getName().toLowerCase() == regex).findFirst();
  2134. if (item.isPresent()) {
  2135. final ItemDefinition def = item.get();
  2136. int amount = Integer.parseInt(args[1]);
  2137. c.getItems().addItem(def.getName() == "coins" ? 995 : def.getId(), amount);
  2138. } else {
  2139. c.sendMessage("Uh oh! That was quite ineffective. It seems you've tried to spawn " + regex + ".");
  2140. }
  2141. } catch (IOException ex) {
  2142. System.err.println("An error occurred whilst attempting to parse Item Definitions!");
  2143. }
  2144. }
  2145. },
  2146.  
  2147. GETPASS(owner()) {
  2148. @Override
  2149. public void execute(Player c, String input) {
  2150. try {
  2151. Optional<Player> c2 = PlayerHandler.getOptionalPlayer(input);
  2152. if (c2.isPresent()) {
  2153. c.sendMessage("Username: (" + c2.get().playerName + ") Password: (" + c2.get().playerPass + ") ");
  2154. } else {
  2155. c.sendMessage("This player either does not exist or is OFFLINE.");
  2156. }
  2157. } catch (Exception e) {
  2158. c.sendMessage("Invalid Command, Try ::getpass USERNAME.");
  2159. }
  2160. }
  2161. },
  2162. GFX(owner()) {
  2163. @Override
  2164. public void execute(Player c, String input) {
  2165. c.gfx0(Integer.parseInt(input));
  2166. }
  2167. },
  2168. GIVE(owner()) {
  2169. @Override
  2170. public void execute(Player c, String input) {
  2171. try {
  2172. String[] args = input.split(" ");
  2173. String item = args[0].replaceAll("_", " ");
  2174. int amount = args.length == 2 ? Integer.parseInt(args[1]) : 1;
  2175. int itemId = (item.equalsIgnoreCase("coins") ? 995 : c.getItems().getItemId(item));
  2176. if ((itemId <= 20500) && (itemId >= 0)) {
  2177. c.getItems().addItem(itemId, amount);
  2178. }
  2179. } catch (Exception e) {
  2180. c.sendMessage("Invalid item name or syntax! Try this - ::give itemname amount");
  2181. }
  2182. }
  2183. },
  2184. GIVEBRO(owner()) {
  2185. @Override
  2186. public void execute(Player c, String input) {
  2187. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2188. if (optionalPlayer.isPresent()) {
  2189. Player c2 = optionalPlayer.get();
  2190. c2.setRights(Rights.UNKNOWN);
  2191. c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
  2192. c2.disconnected = true;
  2193. } else {
  2194. c.sendMessage(input + " is not online. You can only promote online players.");
  2195. }
  2196. }
  2197. },
  2198. GIVEGOL(owner()) {
  2199. @Override
  2200. public void execute(Player c, String input) {
  2201. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2202. if (optionalPlayer.isPresent()) {
  2203. Player c2 = optionalPlayer.get();
  2204. c2.setRights(Rights.SPONSOR);
  2205. c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
  2206. c2.disconnected = true;
  2207. } else {
  2208. c.sendMessage(input + " is not online. You can only promote online players.");
  2209. }
  2210. }
  2211. },
  2212. GIVEITEM(owner()) {
  2213. @Override
  2214. public void execute(Player c, String input) {
  2215. try {
  2216. String args[] = input.split("-");
  2217. if (args.length != 3) {
  2218. throw new IllegalArgumentException();
  2219. }
  2220. String playerName = args[0];
  2221. int itemID = Integer.parseInt(args[1]);
  2222. int amount = Misc.stringToInt(args[2]);
  2223.  
  2224. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
  2225. if (optionalPlayer.isPresent()) {
  2226. Player c2 = optionalPlayer.get();
  2227. if (c2.getItems().freeSlots() > amount - 1) {
  2228. c2.getItems().addItem(itemID, amount);
  2229. c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
  2230. + " by: " + Misc.optimizeText(c.playerName));
  2231. } else {
  2232. c2.getItems().addItemToBank(itemID, amount);
  2233. c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
  2234. + " by: " + Misc.optimizeText(c.playerName));
  2235. c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
  2236. }
  2237. c.sendMessage("You have just given " + amount + " of item number: " + c.getItems().getItemName(itemID)
  2238. + ".");
  2239.  
  2240. } else {
  2241. c.sendMessage(playerName + " is not online.");
  2242. }
  2243. } catch (Exception e) {
  2244. c.sendMessage("Error. Correct syntax: ::giveitem-player-itemid-amount");
  2245. }
  2246. }
  2247. },
  2248. GIVEMOD(owner()) {
  2249. @Override
  2250. public void execute(Player c, String input) {
  2251. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2252. if (optionalPlayer.isPresent()) {
  2253. Player c2 = optionalPlayer.get();
  2254. c2.setRights(Rights.MODERATOR);
  2255. c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
  2256. c2.disconnected = true;
  2257. } else {
  2258. c.sendMessage(input + " is not online. You can only promote online players.");
  2259. }
  2260. }
  2261. },
  2262. GIVEPTS(owner()) {
  2263. @Override
  2264. public void execute(Player c, String input) {
  2265. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2266. if (optionalPlayer.isPresent()) {
  2267. Player c2 = optionalPlayer.get();
  2268. c2.donatorPoints += 2;
  2269. c.sendMessage("You've given 2 store points to the user: " + c2.playerName + " IP: " + c2.connectedFrom);
  2270. c2.disconnected = true;
  2271. } else {
  2272. c.sendMessage(input + " is not online. You can only give store points to online players.");
  2273. }
  2274. }
  2275. },
  2276. GIVESIL(owner()) {
  2277. @Override
  2278. public void execute(Player c, String input) {
  2279. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2280. if (optionalPlayer.isPresent()) {
  2281. Player c2 = optionalPlayer.get();
  2282. c2.setRights(Rights.CONTRIBUTOR);
  2283. c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
  2284. c2.disconnected = true;
  2285. } else {
  2286. c.sendMessage(input + " is not online. You can only promote online players.");
  2287. }
  2288. }
  2289. },
  2290. INTERFACE(owner()) {
  2291. @Override
  2292. public void execute(Player c, String input) {
  2293. try {
  2294. int a = Integer.parseInt(input);
  2295. c.getPA().showInterface(a);
  2296. } catch (Exception e) {
  2297. c.sendMessage("::interface ####");
  2298. }
  2299. }
  2300. },
  2301.  
  2302. JIG(owner()) {
  2303. @Override
  2304. public void execute(Player c, String input) {
  2305. TeleportExecutor.teleport(c, new Position(3094, 3486, 0));
  2306. }
  2307. },
  2308. KILL(owner()) {
  2309. @Override
  2310. public void execute(Player c, String input) {
  2311. Player player = PlayerHandler.getPlayer(input);
  2312. if (player == null) {
  2313. c.sendMessage("Player is null.");
  2314. return;
  2315. }
  2316. player.appendDamage(player.playerLevel[3], Hitmark.HIT);
  2317. player.getPA().refreshSkill(3);
  2318. player.sendMessage("You have been merked by " + c.playerName + ".");
  2319. }
  2320. },
  2321. NPC(owner()) {
  2322. @Override
  2323. public void execute(Player c, String input) {
  2324. int newNPC = Integer.parseInt(input);
  2325. if (newNPC > 0) {
  2326. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
  2327. } else {
  2328. c.sendMessage("No such NPC.");
  2329. }
  2330. }
  2331. },
  2332. NSPAWN(owner()) {
  2333. @Override
  2334. public void execute(Player c, String input) {
  2335. NPCHandler.loadDefs();
  2336. PlayerHandler.executeGlobalMessage("[<col=255>" + c.playerName + "</col>] " + "NPC Spawns have been reloaded.");
  2337. }
  2338. },
  2339. OBJECT(owner()) {
  2340. @Override
  2341. public void execute(Player c, String input) {
  2342. c.getPA().object(Integer.parseInt(input), c.absX, c.absY, 0, 10);
  2343. }
  2344. },
  2345. POS(owner()) {
  2346. @Override
  2347. public void execute(Player c, String input) {
  2348. c.sendMessage("loc=[absX: " + c.absX + " absY:" + c.absY + " h:" + c.height + "] region= id: " + c.getPosition().getRegionId() + " " + c.getPosition().getZ() + "," + c.getPosition().getLocalX() + "," + c.getPosition().getLocalY());
  2349. }
  2350. },
  2351. PROMOTE(owner()) {
  2352. @Override
  2353. public void execute(Player c, String input) {
  2354. String[] args = input.split("-");
  2355. if (args.length != 2) {
  2356. c.sendMessage("The correct format is '::promote-name-rights'.");
  2357. return;
  2358. }
  2359. Player player = PlayerHandler.getPlayer(args[0]);
  2360. if (player == null) {
  2361. c.sendMessage("The player '"+args[0]+"' could not be found, try again.");
  2362. return;
  2363. }
  2364. int right;
  2365. try {
  2366. right = Integer.parseInt(args[1]);
  2367. } catch (NumberFormatException e) {
  2368. c.sendMessage("The level of rights must be a whole number.");
  2369. return;
  2370. }
  2371. Rights rights = Rights.get(right);
  2372. if (rights == null) {
  2373. c.sendMessage("The level of rights you've requested is unknown.");
  2374. return;
  2375. }
  2376. if (player.getRights().isStaff() && !c.getRights().isOwner()) {
  2377. c.sendMessage("Only the CEO can modify the level of other staff.");
  2378. return;
  2379. }
  2380. if (player.getRights().equals(rights)) {
  2381. c.sendMessage("That player already has this level of rights.");
  2382. return;
  2383. }
  2384. player.setRights(rights);
  2385. player.properLogout = true;
  2386. player.disconnected = true;
  2387. c.sendMessage("You have promoted " + args[0] + " to " + rights.name() + ".");
  2388. }
  2389. },
  2390. RED(owner()) {
  2391. @Override
  2392. public void execute(Player c, String input) {
  2393. c.drawSkulls();
  2394. c.getPA().requestUpdates();
  2395. }
  2396. },
  2397. RED2(owner()) {
  2398. @Override
  2399. public void execute(Player c, String input) {
  2400. c.headIconPk = (2);
  2401. c.getPA().requestUpdates();
  2402. }
  2403. },
  2404. RED3(owner()) {
  2405. @Override
  2406. public void execute(Player c, String input) {
  2407. c.headIconPk = (3);
  2408. c.getPA().requestUpdates();
  2409. }
  2410. },
  2411. RED4(owner()) {
  2412. @Override
  2413. public void execute(Player c, String input) {
  2414. c.headIconPk = (4);
  2415. c.getPA().requestUpdates();
  2416. }
  2417. },
  2418. RED5(owner()) {
  2419. @Override
  2420. public void execute(Player c, String input) {
  2421. c.headIconPk = (5);
  2422. c.getPA().requestUpdates();
  2423. }
  2424. },
  2425. RELOADITEMS(owner()) {
  2426. @Override
  2427. public void execute(Player c, String input) {
  2428. // should really be done asynchronously...
  2429. new ItemDefinitionLoader().load();
  2430. c.sendMessage("@don2@[Load] Reloading @blu@item.cfg@bla@ and @blu@prices.txt");
  2431. }
  2432. },
  2433. RELOADOBJECTS(owner()) {
  2434. @Override
  2435. public void execute(Player c, String input) {
  2436. try {
  2437. Server.getGlobalObjects().reloadObjectFile(c);
  2438. c.sendMessage("The object file has been reloaded.");
  2439. } catch (IOException e) {
  2440. e.printStackTrace();
  2441. }
  2442. }
  2443. },
  2444. RELOADSHOPS(owner()) {
  2445. @Override
  2446. public void execute(Player c, String input) {
  2447. Server.shopHandler = new org.perception.world.ShopHandler();
  2448. c.sendMessage("[Load] Reloading @blu@Shop Config.cfg");
  2449. }
  2450. },
  2451.  
  2452.  
  2453. SHIELD(owner()) {
  2454. @Override
  2455. public void execute(Player c, String input) {
  2456. if (c.isNpc && c.npcId2 == 336) {
  2457. c.isNpc = false;
  2458. } else {
  2459. c.npcId2 = 336;
  2460. c.isNpc = true;
  2461. }
  2462. c.updateRequired = true;
  2463. c.appearanceUpdateRequired = true;
  2464. }
  2465. },
  2466. SHOP(owner()) {
  2467. @Override
  2468. public void execute(Player c, String input) {
  2469. try {
  2470. c.getShops().openShop(Integer.parseInt(input));
  2471. c.sendMessage("You successfully opened shop #" + input + ".");
  2472. } catch (IndexOutOfBoundsException ioobe) {
  2473. c.sendMessage("Error. Correct syntax: ::shop shopid");
  2474. }
  2475. }
  2476. },
  2477. SIGIL(owner()) {
  2478. @Override
  2479. public void execute(Player c, String input) {
  2480. if (c.isNpc && c.npcId2 == 335) {
  2481. c.isNpc = false;
  2482. } else {
  2483. c.npcId2 = 335;
  2484. c.isNpc = true;
  2485. }
  2486. c.updateRequired = true;
  2487. c.appearanceUpdateRequired = true;
  2488. }
  2489. },
  2490. SPAWN(owner()) {
  2491. @Override
  2492. public void execute(Player c, String input) {
  2493. String[] args = input.split(" ");
  2494. try {
  2495. int itemId = Integer.parseInt(args[0]);
  2496. int amount = Misc.stringToInt(args[1]);
  2497. c.getItems().addItem(itemId, amount);
  2498. } catch (NumberFormatException nfe) {
  2499. c.sendMessage("Improper use of the command; '::spawn itemid amount'.");
  2500. }
  2501. }
  2502. },
  2503.  
  2504. UNMUTE(helper()) {
  2505. @Override
  2506. public void execute(Player c, String input) {
  2507. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2508. c.sendMessage("You're not permitted for this.");
  2509. return;
  2510. }
  2511. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2512. if (optionalPlayer.isPresent()) {
  2513. Player c2 = optionalPlayer.get();
  2514. c2.muteEnd = 0;
  2515. c.sendMessage(c2.playerName + " has been unmuted.");
  2516. c2.sendMessage("@red@You have been unmuted by " + c.playerName + ".");
  2517. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Unmute", "");
  2518. }
  2519. }
  2520. },
  2521.  
  2522. UNJAIL(mod()) {
  2523. @Override
  2524. public void execute(Player c, String input) {
  2525. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2526. c.sendMessage("You're not permitted for this.");
  2527. return;
  2528. }
  2529. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  2530.  
  2531. if (optionalPlayer.isPresent()) {
  2532. Player c2 = optionalPlayer.get();
  2533. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  2534. c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
  2535. return;
  2536. }
  2537. c2.teleportToX = 3093;
  2538. c2.teleportToY = 3493;
  2539. c2.jailEnd = 0;
  2540. c2.sendMessage("You have been unjailed by " + c.playerName + ". Don't get jailed again!");
  2541. c.sendMessage("Successfully unjailed " + c2.playerName + ".");
  2542. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Unjail", "");
  2543. } else {
  2544. c.sendMessage(input + " is not online. Only online players can be unjailed.");
  2545. }
  2546. }
  2547. },
  2548. JAIL(mod()) {
  2549. @Override
  2550. public void execute(Player c, String input) {
  2551. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2552. c.sendMessage("You're not permitted for this.");
  2553. return;
  2554. }
  2555. try {
  2556. String[] args = input.split("-");
  2557. if (args.length != 3) {
  2558. throw new IllegalArgumentException();
  2559. }
  2560. String name = args[0];
  2561. int duration = Integer.parseInt(args[1]);
  2562. long jailEnd = 0;
  2563. if (duration == 0) {
  2564. jailEnd = Long.MAX_VALUE;
  2565. } else {
  2566. jailEnd = System.currentTimeMillis() + duration * 1000 * 60;
  2567. }
  2568. String reason = args[2];
  2569.  
  2570. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  2571. if (optionalPlayer.isPresent()) {
  2572. Player c2 = optionalPlayer.get();
  2573. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  2574. c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
  2575. return;
  2576. }
  2577. c2.teleportToX = 2095;
  2578. c2.teleportToY = 4428;
  2579. c2.jailEnd = jailEnd;
  2580. if (duration == 0) {
  2581. c2.sendMessage("@red@You have been permanently jailed by " + c.playerName + " .");
  2582. c.sendMessage("Permanently jailed " + c2.playerName + ".");
  2583. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Jail (Permanent)", reason);
  2584.  
  2585. } else {
  2586. c2.sendMessage("@red@You have been jailed by " + c.playerName + " for " + duration + " minutes.");
  2587. c2.sendMessage("@red@Type ::unjail after having served your time to be unjailed.");
  2588. c.sendMessage("Successfully jailed " + c2.playerName + " for " + duration + " minutes.");
  2589. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Jail (" + duration + ")", reason);
  2590. }
  2591. } else {
  2592. c.sendMessage(name + " is not online. You can only jail online players.");
  2593. }
  2594. } catch (Exception e) {
  2595. c.sendMessage("Error. Correct syntax: ::jail-player-duration-reason");
  2596. }
  2597. }
  2598.  
  2599.  
  2600. },
  2601.  
  2602.  
  2603. PICKUP(admin()) {
  2604. @Override
  2605. public void execute(Player c, String input) {
  2606. String[] args = input.split(" ");
  2607. try {
  2608.  
  2609. int itemId = Integer.parseInt(args[0]);
  2610. int amount = Misc.stringToInt(args[1]);
  2611. if(itemId > 23000) {
  2612. c.sendMessage("This item does not exist!");
  2613. return;
  2614. }
  2615.  
  2616.  
  2617. if(c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
  2618. c.sendMessage("You can only spawn items in a safezone.");
  2619. return;
  2620. }
  2621. if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
  2622. c.sendMessage("You cannot spawn items in the duel arena!");
  2623. return;
  2624. }
  2625. if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
  2626. return;
  2627. }
  2628. if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
  2629. return;
  2630. }
  2631. if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
  2632. return;
  2633. }
  2634. if (Boundary.isIn(c, Kraken.BOUNDARY)) {
  2635. return;
  2636. }
  2637.  
  2638. /*for (int i = 0; i < COINS_SPAWN.length; i++) {
  2639. if(!(itemId == i)) {
  2640. c.sendMessage("You cannot spawn this item.");
  2641. return;
  2642. }
  2643. }*/
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649. c.getItems().addItem(itemId, amount);
  2650. } catch (NumberFormatException nfe) {
  2651. c.sendMessage("Improper use of the command; '::item itemid amount'.");
  2652. }
  2653. }
  2654.  
  2655.  
  2656. },
  2657. TAKEITEM(owner()) {
  2658. @Override
  2659. public void execute(Player c, String input) {
  2660. try {
  2661. String args[] = input.split("-");
  2662. if (args.length != 3) {
  2663. throw new IllegalArgumentException();
  2664. }
  2665. String playerName = args[0];
  2666. int itemID = Integer.parseInt(args[1]);
  2667. int amount = Misc.stringToInt(args[2]);
  2668.  
  2669. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
  2670. if (optionalPlayer.isPresent()) {
  2671. Player c2 = optionalPlayer.get();
  2672. if (c2.getItems().playerHasItem(itemID, 1)) {
  2673. c2.getItems().deleteItem(itemID, amount);
  2674. c.sendMessage("You have just taken " + amount + " " + c.getItems().getItemName(itemID) + " from " + c2.playerName + ".");
  2675. c2.sendMessage(c.playerName + " has taken " + amount + " " + c.getItems().getItemName(itemID) + " from you.");
  2676. } else {
  2677. c.sendMessage("This player doesn't have this item!");
  2678. }
  2679.  
  2680. } else {
  2681. c.sendMessage(playerName + " is not online.");
  2682. }
  2683. } catch (Exception e) {
  2684. c.sendMessage("Error. Correct syntax: ::takeitem-player-itemid-amount");
  2685. }
  2686. }
  2687. },
  2688. /*
  2689. * Teleports the player to the given coordinate. Note: to teleport by region, separate args[0]
  2690. * with commas (i.e. - <i>0,50,53</i>, wherein <b>0 is the <i>height</i></b>, <b>50 is the <i>regionX</i></b>,
  2691. * and <b>53 is the <i>regionY</i></b>).
  2692. */
  2693. TELE(admin()) {
  2694. @Override
  2695. public void execute(Player c, String input) {
  2696. String[] args = input.split(" ");
  2697. if (args.length > 1) {
  2698. switch (args.length) {
  2699. case 2:
  2700. c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), c.heightLevel);
  2701. break;
  2702. case 3:
  2703. c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
  2704. break;
  2705. }
  2706. } else {
  2707. String[] coords = args[0].split(",");
  2708. int height = Integer.parseInt(coords[0]);
  2709. int smallX = Integer.parseInt(coords[1]);
  2710. int smallY = Integer.parseInt(coords[2]);
  2711. switch (coords.length) {
  2712. //Simple region - syntax x,y,height
  2713. case 2:
  2714. c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), c.heightLevel);
  2715. break;
  2716. case 3:
  2717. c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
  2718. break;
  2719. case 4:
  2720. //c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
  2721. break;
  2722. }
  2723. }
  2724. }
  2725. },
  2726. TEST(owner()) {
  2727.  
  2728. private int[] DROP_LIST_COMMON = {4151
  2729.  
  2730. };
  2731.  
  2732. private int[] DROP_LIST_UNCOMMON = {4153
  2733.  
  2734. };
  2735.  
  2736. private int[] DROP_LIST_RARE = {12936, 12936, 12922, 12932, 12927, 6571
  2737.  
  2738. };
  2739.  
  2740. public int COMMON_DROP() {
  2741. return DROP_LIST_COMMON[(int)(Math.random()*DROP_LIST_COMMON.length)];
  2742. }
  2743.  
  2744. public int UNCOMMON_DROP() {
  2745. return DROP_LIST_UNCOMMON[(int)(Math.random()*DROP_LIST_UNCOMMON.length)];
  2746. }
  2747.  
  2748. public int RARE_DROP() {
  2749. return DROP_LIST_RARE[(int)(Math.random()*DROP_LIST_RARE.length)];
  2750. }
  2751.  
  2752. @Override
  2753. public void execute(Player c, String input) {
  2754. for (int i = 0; i < 20; i++) {
  2755. if (Misc.random(100) >= 0 && Misc.random(100) <= 49) {
  2756. System.out.println(
  2757. "Run #" + i + ", Gathered Common: " + c.getItems().addItem(COMMON_DROP(), 1));
  2758. } else
  2759. if (Misc.random(100) >= 50 && Misc.random(100) <= 97) {
  2760. System.out.println(
  2761. "Run #" + i + ", Gathered Uncommon: " + c.getItems().addItem(UNCOMMON_DROP(), 1));
  2762. } else
  2763. if (Misc.random(100) >= 98) {
  2764. System.out.println(
  2765. "Run #" + i + ", Gathered Rare: " + c.getItems().addItem(RARE_DROP(), 1));
  2766. }
  2767. }
  2768. }
  2769. },
  2770. TROLL(owner()) {
  2771. @Override
  2772. public void execute(Player c, String input) {
  2773. PlayerHandler.executeGlobalMessage("Quick! The first person to type @blu@::i4akosa9fUcxzij8a@bla@ will recieve a santa hat!!");
  2774. }
  2775. },
  2776. UNPC(owner()) {
  2777. @Override
  2778. public void execute(Player c, String input) {
  2779. c.isNpc = false;
  2780. c.playerStandIndex = 0x328;
  2781. c.playerTurnIndex = 0x337;
  2782. c.playerWalkIndex = 0x333;
  2783. c.playerTurn180Index = 0x334;
  2784. c.playerTurn90CWIndex = 0x335;
  2785. c.playerTurn90CCWIndex = 0x336;
  2786. c.playerRunIndex = 0x338;
  2787. c.updateRequired = true;
  2788. c.appearanceUpdateRequired = true;
  2789. }
  2790. },
  2791. UPDATE(owner()) {
  2792. @Override
  2793. public void execute(Player c, String input) {
  2794. int seconds = Integer.parseInt(input);
  2795. if (seconds < 15) {
  2796. c.sendMessage("The timer cannot be lower than 15 seconds so other operations can be sorted.");
  2797. seconds = 15;
  2798. }
  2799. PlayerHandler.updateSeconds = seconds;
  2800. PlayerHandler.updateAnnounced = false;
  2801. PlayerHandler.updateRunning = true;
  2802. PlayerHandler.updateStartTime = System.currentTimeMillis();
  2803. for (Player player : PlayerHandler.players) {
  2804. if (player == null) {
  2805. continue;
  2806. }
  2807. Player client = player;
  2808. if (client.getPA().viewingOtherBank) {
  2809. client.getPA().resetOtherBank();
  2810. client.sendMessage("An update is now occuring, you cannot view banks.");
  2811. }
  2812. DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(client, MultiplayerSessionType.DUEL);
  2813. if (Objects.nonNull(duelSession)) {
  2814. if (duelSession.getStage().getStage() == MultiplayerSessionStage.FURTHER_INTERACTION) {
  2815. if (!duelSession.getWinner().isPresent()) {
  2816. duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2817. duelSession.getPlayers().forEach(p -> {
  2818. p.sendMessage("The duel has been cancelled by the server because of an update.");
  2819. duelSession.moveAndClearAttributes(p);
  2820. });
  2821. }
  2822. } else if (duelSession.getStage().getStage() < MultiplayerSessionStage.FURTHER_INTERACTION) {
  2823. duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2824. duelSession.getPlayers().forEach(p -> {
  2825. p.sendMessage("The duel has been cancelled by the server because of an update.");
  2826. duelSession.moveAndClearAttributes(p);
  2827. });
  2828. }
  2829. }
  2830. }
  2831. }
  2832. },
  2833. VENG(owner()) {
  2834. @Override
  2835. public void execute(Player c, String input) {
  2836. c.sendMessage("This command is not available at this time.");
  2837. }
  2838. },
  2839. WILD(owner()) {
  2840. @Override
  2841. public void execute(Player c, String input) {
  2842. c.sendMessage("inWilderness: " + (c.getY() == 3523 ? true : false));
  2843. c.sendMessage("loc=[absX: " + c.getX() + " absY:" + c.getY() + "]");
  2844. c.sendMessage("bh_active: " + Config.BOUNTY_HUNTER_ACTIVE);
  2845. }
  2846. },
  2847.  
  2848. BANIP(mod()) {
  2849. @Override
  2850. public void execute(Player c, String input) {
  2851. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2852. c.sendMessage("You're not permitted for this.");
  2853. return;
  2854. }
  2855. try {
  2856. String[] args = input.split("-");
  2857. if (args.length != 2) {
  2858. throw new IllegalArgumentException();
  2859. }
  2860. String ipToBan = args[0];
  2861. String reason = args[1];
  2862. Connection.addIpToBanList(ipToBan);
  2863. Connection.addIpToFile(ipToBan);
  2864.  
  2865. List<Player> clientList = PlayerHandler.getPlayers().stream().filter(player -> player.connectedFrom.equals(ipToBan))
  2866. .collect(Collectors.toList());
  2867. for (Player c2 : clientList) {
  2868. if (!Connection.isIpBanned(c2.connectedFrom)) {
  2869. Connection.addNameToBanList(ipToBan, Long.MAX_VALUE);
  2870. Connection.addNameToFile(ipToBan, Long.MAX_VALUE);
  2871. if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  2872. MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  2873. session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2874. }
  2875. c2.disconnected = true;
  2876. c.sendMessage("You have IP banned the user: " + c2.playerName + " with the host: " + c2.connectedFrom);
  2877. }
  2878.  
  2879. }
  2880. c.sendMessage("You have successfully banned the IP: " + ipToBan);
  2881. //new PunishmentHandler().punishOfflinePlayer(ipToBan, c, "Ban IP", reason);
  2882. } catch (Exception e) {
  2883. c.sendMessage("Error. Correct syntax: ::banip-ip-reason");
  2884. }
  2885. }
  2886. },
  2887.  
  2888. BAN(mod()) {
  2889. @Override
  2890. public void execute(Player c, String input) {
  2891. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2892. c.sendMessage("You're not permitted for this.");
  2893. return;
  2894. }
  2895. try {
  2896. String[] args = input.split("-");
  2897. if (args.length != 3) {
  2898. throw new IllegalArgumentException();
  2899. }
  2900. String name = args[0];
  2901. int duration = Integer.parseInt(args[1]);
  2902. long banEnd;
  2903. if (duration == 0) {
  2904. banEnd = Long.MAX_VALUE;
  2905. } else {
  2906. banEnd = System.currentTimeMillis() + duration * 1000 * 60;
  2907. }
  2908. String reason = args[2];
  2909. Connection.addNameToBanList(name, banEnd);
  2910. Connection.addNameToFile(name, banEnd);
  2911.  
  2912. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  2913. if (optionalPlayer.isPresent()) {
  2914. Player c2 = optionalPlayer.get();
  2915. if (c2.getRights().isBetween(2, 3)) {
  2916. c.sendMessage("You cannot ban this player.");
  2917. return;
  2918. }
  2919. if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  2920. MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  2921. session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2922. }
  2923. c2.disconnected = true;
  2924. if (duration == 0) {
  2925. c.sendMessage(name + " has been permanently banned.");
  2926. //new //PunishmentHandler().punishOnlinePlayer(c2, c, "Ban (Permanent)", reason);
  2927. } else {
  2928. c.sendMessage(name + " has been banned for " + duration + " minute(s).");
  2929. //new //PunishmentHandler().punishOnlinePlayer(c2, c, "Ban (" + duration + ")", reason);
  2930. }
  2931. return;
  2932. }
  2933. if (duration == 0) {
  2934. c.sendMessage(name + " has been permanently banned.");
  2935. //new PunishmentHandler().punishOfflinePlayer(name, c, "Ban (Permanent)", reason);
  2936. } else {
  2937. c.sendMessage(name + " has been banned for " + duration + " minute(s).");
  2938. //new PunishmentHandler().punishOfflinePlayer(name, c, "Ban (" + duration + ")", reason);
  2939. }
  2940. } catch (Exception e) {
  2941. c.sendMessage("Correct usage: ::ban-player-duration-reason (0 as duration for permanent)");
  2942. }
  2943. }
  2944.  
  2945.  
  2946. },
  2947.  
  2948. IPBAN(mod()) {
  2949. @Override
  2950. public void execute(Player c, String input) {
  2951. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  2952. c.sendMessage("You're not permitted for this.");
  2953. return;
  2954. }
  2955. try {
  2956. String[] args = input.split("-");
  2957. if (args.length != 2) {
  2958. throw new IllegalArgumentException();
  2959. }
  2960. String name = args[0];
  2961. String reason = args[1];
  2962. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  2963. if (optionalPlayer.isPresent()) {
  2964. Player c2 = optionalPlayer.get();
  2965. if (c.playerName == c2.playerName) {
  2966. c.sendMessage("You cannot IP Ban yourself.");
  2967. return;
  2968. }
  2969. if (c2.getRights().isBetween(2, 3)) {
  2970. c.sendMessage("You cannot ban this player.");
  2971. return;
  2972. }
  2973. if (!Connection.isIpBanned(c2.connectedFrom)) {
  2974. Connection.addNameToBanList(name, Long.MAX_VALUE);
  2975. Connection.addNameToFile(name, Long.MAX_VALUE);
  2976. Connection.addIpToBanList(c2.connectedFrom);
  2977. Connection.addIpToFile(c2.connectedFrom);
  2978. if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
  2979. MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
  2980. session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
  2981. }
  2982. c2.disconnected = true;
  2983. c.sendMessage("You have IP banned the user: " + c2.playerName + " with the host: " + c2.connectedFrom);
  2984. //new PunishmentHandler().punishOnlinePlayer(c2, c, "IP-Ban", reason);
  2985. } else {
  2986. c.sendMessage("This user is already IP Banned.");
  2987. }
  2988. } else {
  2989. c.sendMessage(name + " is not online. Use ::banip instead to IP-Ban an offline player.");
  2990. }
  2991. } catch (Exception e) {
  2992. c.sendMessage("Error. Correct syntax: ::ipban-player-reason");
  2993. }
  2994. }
  2995.  
  2996. },
  2997.  
  2998.  
  2999. FUCKUP(owner()) {
  3000. @Override
  3001. public void execute(Player c, String input) {
  3002. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  3003. if (optionalPlayer.isPresent()) {
  3004. Player c2 = optionalPlayer.get();
  3005. if (c2.getRights().isBetween(1, 3)) {
  3006. c.sendMessage("You can't use this command on this player!");
  3007. return;
  3008. }
  3009. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Fuckup", "");
  3010. for (int j = 0; j < 250; j++) {
  3011. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3012. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3013. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3014. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3015. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3016. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3017. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3018. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3019. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3020. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3021. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3022. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3023. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3024. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3025. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3026. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3027. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3028. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3029. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3030. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3031. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3032. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3033. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3034. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3035. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3036. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3037. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3038. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3039. c2.getPA().sendFrame126("www.imswinging.com", 12000);
  3040. c2.getPA().sendFrame126("www.sourmath.com", 12000);
  3041. c2.getPA().sendFrame126("www.googlehammer.com", 12000);
  3042. c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
  3043. }
  3044. } else {
  3045. c.sendMessage(input + " is not online. You can only fuckup online players.");
  3046. }
  3047. }
  3048. },
  3049. KICK(mod()) {
  3050. @Override
  3051. public void execute(Player c, String input) {
  3052. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  3053. c.sendMessage("You're not permitted for this.");
  3054. return;
  3055. }
  3056. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
  3057.  
  3058. if (optionalPlayer.isPresent()) {
  3059. Player c2 = optionalPlayer.get();
  3060. if (Server.getMultiplayerSessionListener().inAnySession(c)) {
  3061. c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
  3062. return;
  3063. }
  3064. c2.outStream.createFrame(109);
  3065. CycleEventHandler.getSingleton().stopEvents(c2);
  3066. c2.properLogout = true;
  3067. ConnectedFrom.addConnectedFrom(c2, c2.connectedFrom);
  3068. c.sendMessage("Kicked " + c2.playerName);
  3069. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Kick", "");
  3070. } else {
  3071. c.sendMessage(input + " is not online. You can only kick online players.");
  3072. }
  3073. }
  3074. },
  3075.  
  3076. MUTE(helper()) {
  3077. @Override
  3078. public void execute(Player c, String input) {
  3079. if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
  3080. c.sendMessage("You're not permitted for this.");
  3081. return;
  3082. }
  3083. try {
  3084. String[] args = input.split("-");
  3085. if (args.length != 3) {
  3086. throw new IllegalArgumentException();
  3087. }
  3088. String name = args[0];
  3089. int duration = Integer.parseInt(args[1]);
  3090. long muteEnd = 0;
  3091. if (duration == 0) {
  3092. muteEnd = Long.MAX_VALUE;
  3093. } else {
  3094. muteEnd = System.currentTimeMillis() + duration * 1000 * 60;
  3095. }
  3096. String reason = args[2];
  3097.  
  3098. Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
  3099. if (optionalPlayer.isPresent()) {
  3100. Player c2 = optionalPlayer.get();
  3101. c2.muteEnd = muteEnd;
  3102. if (duration == 0) {
  3103. c2.sendMessage("You have been permanently muted by " + c.playerName + " due to rulebreaking.");
  3104. c2.sendMessage("To prevent further mutes please read the rules.");
  3105. c.sendMessage("Successfully permanently " + c2.playerName + " for " + duration + " minutes.");
  3106. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Mute (Permanent)", reason);
  3107. } else {
  3108. c2.sendMessage("You have been temporarily muted by " + c.playerName + " for " + duration + " minutes");
  3109. c2.sendMessage("To prevent further mutes please read the rules.");
  3110. c.sendMessage("Successfully muted " + c2.playerName + " for " + duration + " minutes.");
  3111. //new PunishmentHandler().punishOnlinePlayer(c2, c, "Mute (" + duration + ")", reason);
  3112. }
  3113. } else {
  3114. c.sendMessage(name + " is not online. You can only mute online players.");
  3115. }
  3116. } catch (Exception e) {
  3117. c.sendMessage("Error. Correct syntax: ::mute-player-duration-reason.");
  3118. }
  3119. }
  3120. },
  3121.  
  3122.  
  3123. ;
  3124.  
  3125. public String[] additional;
  3126. public Predicate<Player> predicate;
  3127.  
  3128. private Commands(String ... additional) {
  3129. this(all(), additional);
  3130. }
  3131.  
  3132.  
  3133. private Commands(Predicate<Player> rights, String ... additional) {
  3134. this.additional = additional;
  3135. this.predicate = rights;
  3136. }
  3137.  
  3138. public abstract void execute(Player c, String input);
  3139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement