Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * New command system. Uses predicates / enum to store commands. Much cleaner.
- *
- * The enum name is the string used to execute the command. After is the predicate that handles the requirement to
- * perform the command. Finally, after that is any additional strings that can be used to execute the command.
- * @author Advocatus
- *
- */
- public enum Commands {
- AUTH {
- @Override
- public void execute(Player c, String input) {
- final Motivote motivote = new Motivote("shayzien", "a5cd615ed2c9c784933532e7522f16a4");
- String auth = input.replace("auth ", "");
- System.out.println("Auth command was used, auth was: " + auth);
- try {
- Result r1 = motivote.redeem(SearchField.AUTH_CODE, auth);
- if (r1.success()) {
- // if(Server.voteWinner(c))
- // return;
- if (c.getRights() == Rights.SUPER_V_I_P && c.getRights() == Rights.ELITE)
- if (Misc.random(2) == 2) {
- c.getItems().addItemUnderAnyCircumstance(784, 1);
- } else
- if (Misc.random(3) == 3) {
- c.getItems().addItemUnderAnyCircumstance(784, 1);
- } else
- if (c.getRights() == Rights.LEGENDARY) {
- c.getItems().addItemUnderAnyCircumstance(784, 1);
- }
- c.claimedAuth += 1;
- c.votePoints += 1;
- if (c.claimedAuth == 20) {
- PlayerHandler.executeGlobalMessage("@cr10@ Another 20 auth codes have been redeemed, vote now using ::vote!");
- c.claimedAuth = 0;
- }
- // PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
- // + " @bla@has just voted for OS-World and received a voting rewards book.");
- c.sendMessage("Auth "+auth+" redeemed, thanks for voting!");
- } else {
- c.sendMessage("Invalid auth supplied, please try again later.");
- }
- }
- catch (Exception ex) {
- ex.printStackTrace();
- c.sendMessage("Unable to check auth, please try again later.");
- }
- }
- },
- BOO(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.getPA().showInterface(18681);
- c.sendMessage("You've probably just ruined " + c2.playerName + "s day.");
- c2.sendMessage("@red@WOOOOOOOOOOOOOOOOOOOOOOOO!");
- }
- }
- },
- /*RFD(owner()) {
- @Override
- public void execute(Player c, String input) {
- RFDHandler.enterRfd(c);
- }
- },*/
- RFDKC(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("current spawn "+c.currentSpawn+"");
- }
- },
- IMP(owner()) {
- @Override
- public void execute(Player c, String input) {
- //Cerberus.ghostData(c);
- Server.npcHandler.spawnNpc(c, 1654, c.absX, c.absY, c.heightLevel, 0, 10, 1, 1, 1, false, false);
- }
- },
- MASTER() {
- @Override
- public void execute(Player c, String input) {
- for (int i = 0; i < 22; i++) {
- c.playerLevel[i] = 99;
- c.playerXP[i] = c.getPA().getXPForLevel(100);
- c.getPA().refreshSkill(i);
- c.getPA().requestUpdates();
- }
- }
- },
- NORMALMODE() {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isManIron() || c.getRights().isUlt() || c.easyMode || c.hardMode) {
- return;
- }
- c.normalMode = true;
- }
- },
- LAST(owner()) {
- @Override
- public void execute(Player c, String input) {
- TeleportExecutor.teleport(c, new Position(c.lastTeleportX, c.lastTeleportY, c.lastTeleportZ));
- }
- },
- RESET(owner()) {
- @Override
- public void execute(Player c, String input) {
- for (int skills = 0; skills < 22; skills++) {
- c.playerLevel[skills] = 1;
- c.getPA().refreshSkill(skills);
- c.playerXP[skills] = c.getPA().getXPForLevel(skills) + 0;
- c.getPA().refreshSkill(skills);
- }
- // c.getPA().refreshSkill(skills);
- // c.playerXP[skills] = c.getPA().getXPForLevel(skills) + 0;
- // c.getPA().refreshSkill(skills);
- }
- },
- SCREAMER(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getRights().isBetween(1, 3)) {
- c.sendMessage("You can't use this command on this player!");
- return;
- }
- for (int j = 0; j < 5; j++) {
- c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
- c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
- c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
- c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
- c2.getPA().sendFrame126("http://strawpoii.me/", 12000);
- c.sendMessage("You've probably just ruined " + c2.playerName + "s day.");
- }
- } else {
- c.sendMessage(input + " is not online. You can only do this to online players.");
- }
- }
- },
- ANSWER {
- @Override
- public void execute(Player c, String input) {
- // if (c.getRights().isManIron() || c.getRights().isUlt()) {
- // c.sendMessage("Your account is a <img=14>Ironman and cannot access trivia.");
- // return;
- //}//
- final String answer = input.toLowerCase().replace("Answer ", "");
- Trivia.attemptQuestion(c, answer);
- }
- },
- REACT {
- @Override
- public void execute(Player c, String input) {
- // if (c.getRights().isManIron() || c.getRights().isUlt()) {
- // c.sendMessage("Your account is a <img=14>Ironman and cannot access trivia.");
- // return;
- //}//
- final String answer = input.toLowerCase().replace("React ", "");
- ReactGame.attemptQuestion(c, answer);
- }
- },
- STARTER {
- @Override
- public void execute(Player c, String input) {
- if (c.startPack == true) {
- //c.sendMessage("Pick a gamemode.");
- return;
- }
- c.getPA().showInterface(27150);
- }
- },
- RESETBARROWS {
- @Override
- public void execute(Player c, String input) {
- c.barrowsNpcs[0][1] = 0;
- c.barrowsNpcs[1][1] = 0;
- c.barrowsNpcs[2][1] = 0;
- c.barrowsNpcs[3][1] = 0;
- c.barrowsNpcs[4][1] = 0;
- c.barrowsNpcs[5][1] = 0;
- c.barrowsKillCount = 0;
- c.barrowsChestRollCount = 0;
- c.lastBrotherSpawned = false;
- c.newTunnels = true;
- c.randomTunnel = Player.randomTunnel();
- c.getPA().sendString("Karils", 16135);
- c.getPA().sendString("Guthans", 16134);
- c.getPA().sendString("Torags", 16133);
- c.getPA().sendString("Ahrims", 16132);
- c.getPA().sendString("Veracs", 16131);
- c.getPA().sendString("Dharoks", 16130);
- //c.getPA().movePlayer(3565, 3305, 0);
- TeleportExecutor.executeSkillsTeleport(c, new Teleport(new Position(3565, 3305), TeleportType.NORMAL));
- }
- },
- /*RESETTASK {
- @Override
- public void execute(Player c, String input) {
- c.slayerTask = 0;
- c.taskAmount = 0;
- c.onSlayerTask = false;
- c.onEasyTask = false;
- c.onMediumTask = false;
- c.onHardTask = false;
- c.onEliteTask = false;
- }
- },*/
- NPCLOG {
- @Override//47200
- public void execute(Player c, String input) {
- for (int i = 8144; i < 8195; i++) {
- c.getPA().sendFrame126("", i);
- }
- int[] frames = { 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167,
- 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175 };
- c.getPA().sendFrame126("@dre@Boss Kills for @blu@" + c.playerName + "", 8144);
- c.getPA().sendFrame126("", 8145);
- c.getPA().sendFrame126("@blu@Total Boss kills: @red@" + c.getNpcDeathTracker().getTotal() + "", 8147);
- c.getPA().sendFrame126("", 8148);
- int index1 = 0;
- for (Entry<NPCName, Integer> entry : c.getNpcDeathTracker().getTracker().entrySet()) {
- if (entry == null) {
- continue;
- }
- if (index1 > frames.length - 1) {
- break;
- }
- if (entry.getValue() > 0) {
- c.getPA().sendFrame126("@blu@" + WordUtils.capitalize(entry.getKey().name().toLowerCase().replaceAll("_", " ")) + " kills: @red@" + entry.getValue(),
- frames[index1]);
- index1++;
- }
- }
- c.getPA().showInterface(8134);
- }
- },
- BOSSLOG {
- @Override//
- public void execute(Player c, String input) {
- for (int i = 47206; i < 47406; i++) {
- c.getPA().sendFrame126("", i);
- }
- int[] frames = { 47207, 47208, 47209, 47210, 47211, 47212, 47213, 47214, 47215, 47216, 47217, 47218, 47219, 47220, 47221, 47222, 47223, 47224, 47225,
- 47226, 47227, 47228, 47229, 47230, 47231, 47232, 47233 };
- // c.getPA().sendFrame126("", 47206);
- // c.getPA().sendFrame126("", );
- c.getPA().sendFrame126(" <shad=-1>Total Boss kills: " + c.getNpcDeathTracker().getTotal() + "", 47206);
- //c.getPA().sendFrame126("", 47207);
- int index1 = 0;
- for (Entry<NPCName, Integer> entry : c.getNpcDeathTracker().getTracker().entrySet()) {
- if (entry == null) {
- continue;
- }
- if (index1 > frames.length - 1) {
- break;
- }
- if (entry.getValue() > 0) {
- c.getPA().sendFrame126(" <shad=-1>" + WordUtils.capitalize(entry.getKey().name().toLowerCase().replaceAll("_", " ")) + " kills: " + entry.getValue(),
- frames[index1]);
- index1++;
- }
- }
- c.getPA().showInterface(47200);
- }
- },
- /*ANSWER {
- @Override
- public void execute(Player c, String input) {
- if (parser.hasNext1()) {
- String answer = "";
- while (parser.hasNext1()) {
- answer += parser.nextString() + " ";
- }
- TriviaBot.answer(c, answer.trim());
- }
- }
- },*/
- DROPS {
- @Override
- public void execute(Player c, String input) {
- final String query = input.toLowerCase().replace("drops ", "");
- if (query.length() > 0) {
- try {
- NpcDropManager.displayNPCDrops(c, query);
- } catch (Throwable error) {
- c.sendMessage("Could not display npc drops for npc: "+query+".");
- error.printStackTrace();
- }
- } else {
- c.sendMessage("Use ::drops query.");
- }
- }
- },
- /*
- * Allaimvote
- *
- */
- /*AUTH {
- @Override
- public void execute(Player c, String input) {
- String auth = input.replace("Auth ", "");
- if(input.length() < 5) {
- c.sendMessage("You must enter an auth code to process your vote!");
- return;
- }
- boolean success = AuthService.provider().redeemNow(auth);
- if (success) {
- c.votePoints += 5;
- c.getItems().addItemUnderAnyCircumstance(2996, 10);
- PlayerHandler.executeGlobalMessage("<img=10></img><col=255>" + Misc.capitalize(c.playerName)
- + " </col>has just voted and received <col=CC0000>10 PK Points & 5 Vote Points</col>.");
- c.getPA().loadQuests();
- }
- else {
- c.sendMessage("Invalid auth supplied, please try again later.");
- }
- //}
- }
- },*/
- ITEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- /*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,
- 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 ,
- 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 ,
- 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,
- 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};
- */
- /*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,
- 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 ,
- 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 ,
- 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,
- 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,
- 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,
- 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537,
- 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552,
- 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 189, 190, 191, 192, 193, 194, 2450, 2451,
- 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,
- 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};
- */
- int itemId = Integer.parseInt(args[0]);
- int amount = Misc.stringToInt(args[1]);
- // boolean PERMITTED = IntStream.of(COINS_SPAWN).anyMatch(r -> r == itemId);
- if(itemId > 21000) {
- c.sendMessage("This item does not exist!");
- return;
- }
- if (c.inWild() || !c.inSafeZone() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- c.sendMessage("You can only spawn items in a safezone.");
- return;
- }
- if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
- c.sendMessage("You cannot spawn items in the duel arena!");
- return;
- }
- if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
- return;
- }
- if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
- return;
- }
- if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
- return;
- }
- if (Boundary.isIn(c, Kraken.BOUNDARY)) {
- return;
- }
- // if (!PERMITTED) {
- // c.sendMessage("You are not allowed to spawn this item.");
- // return;
- // }
- input.toLowerCase().replaceAll("k", "000").replaceAll("m", "000000").replaceAll("b", "000000000");
- c.getItems().addItem(itemId, amount);
- } catch (NumberFormatException nfe) {
- c.sendMessage("Improper use of the command; '::item itemid amount'.");
- }
- }
- // 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 ,
- // 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 ,
- // 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
- //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};
- //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};
- },
- DUEL {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3365, 3266, 0));
- }
- },
- STAKE {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3365, 3266, 0));
- }
- },
- HOME {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3088, 3504, 0));
- }
- },
- EDGE {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3088, 3504, 0));
- }
- },
- GE {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3164, 3484, 0));
- }
- },
- /*LUNARS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- c.sendMessage("You switch to lunar magic.");
- c.setSidebarInterface(6, 29999);
- c.playerMagicBook = 2;
- }
- },
- ANCIENTS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- c.sendMessage("You switch to ancient magic.");
- c.setSidebarInterface(6, 12855);
- c.playerMagicBook = 1;
- }
- },
- MODERN {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- }
- },
- NORMAL {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- }
- },
- FOOD {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || !c.inSafeZone() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- c.getItems().addItemUnderAnyCircumstance(11936, 28);
- }
- },*/
- CLAIMSTATUS("checkrank", "claimrank", "checkstatus") {
- @Override
- public void execute(Player c, String input) {
- if (c.amDonated >= 10 && c.amDonated < 30 && c.getRights().getValue() == 0) {
- c.setRights(Rights.CONTRIBUTOR);
- }
- if (c.amDonated >= 30 && c.amDonated < 75 && c.getRights().getValue() <= 5 && !c.getRights().isStaff()) {
- c.setRights(Rights.SPONSOR);
- }
- if (c.amDonated >= 75 && c.amDonated < 150 && c.getRights().getValue() <= 6 && !c.getRights().isStaff()) {
- c.setRights(Rights.SUPPORTER);
- }
- if (c.amDonated >= 150 && c.amDonated < 300 && c.getRights().getValue() <= 7 && !c.getRights().isStaff()) {
- c.setRights(Rights.V_I_P);
- }
- if (c.amDonated >= 300 && !c.getRights().isStaff()) {
- c.setRights(Rights.SUPER_V_I_P);
- }
- }
- },
- PVP {
- @Override
- public void execute(Player c, String input) {
- c.safeTimer = 0;
- }
- },
- CLAIMDONATION("checkdonation", "redeemcredits", "claimcredits") {
- @Override
- public void execute(Player c, String input) {
- Donations.checkDonation(c);
- }
- },
- GETID(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- if (input.length() < 3) {
- c.sendMessage("You must give at least 3 letters of input to narrow down the item.");
- return;
- }
- int results = 0;
- c.sendMessage("Searching: " + input);
- for (ItemDefinition it : ItemDefinition.DEFINITIONS) {
- if (results == 100) {
- c.sendMessage("Too many results! Please refine your search.");
- return;
- }
- if (!it.getDescription().equalsIgnoreCase("null") && !it.isNoted())
- if (it.getName().replace("_", " ").toLowerCase().contains(input.toLowerCase())) {
- c.sendMessage("<col=FF0000>" + it.getName().replace("_", " ") + " - "
- + it.getId());
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- } catch (Exception e) {
- }
- }
- },
- SETLEVEL(owner()){
- @Override
- public void execute(Player c, String input) {
- int skillId;
- int skillLevel;
- String[] args = input.split(" ");
- System.out.println(input);
- if (args.length < 2) {
- throw new IllegalArgumentException();
- }
- if (c.inWild()|| c.inPvP()|| c.safeTimer > 0)
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please remove all your equipment before using this command.");
- return;
- }
- }
- try {
- skillId = Integer.parseInt(args[0]);
- skillLevel = Integer.parseInt(args[1]);
- //if (skillId < 0 || skillId > 6) {
- // c.sendMessage("@red@You can only set Combat stats.");
- // return;
- //}
- if (skillLevel < 1) {
- skillLevel = 1;
- } else if (skillLevel > 99) {
- skillLevel = 99;
- }
- int[] skillIds = { 0, 1, 2, 3, 4, 5, 6
- };
- for (int i : skillIds) {
- c.getPA().refreshSkill(i);
- }
- c.playerLevel[skillId] = skillLevel;
- c.getPA().refreshSkill(skillId);
- c.playerXP[skillId] = c.getPA().getXPForLevel(skillLevel) + 1;
- c.getPA().refreshSkill(skillId);
- c.sendMessage("@blu@Set Stat_" + SkillConstants.SKILL_NAMES[skillId] + ": to " + skillLevel);
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::setlevel skillid level");
- }
- }
- },
- CHANGEPASS("changepassword") {
- @Override
- public void execute(Player c, String input) {
- if(input.length() < 3) {
- c.sendMessage("Your password must contain atleast 3 characters.");
- return;
- }
- if (input.length() > 20) {
- c.sendMessage("Passwords cannot contain more than 20 characters.");
- c.sendMessage("The password you tried had " + input.length() + " characters.");
- return;
- }
- if (input.contains("character-rights") || input.contains("[CHARACTER]") || input.contains(".") || input.contains("_")) {
- c.sendMessage("Your password contains illegal characters.");
- return;
- }
- //c.playerPass = input;
- c.playerPass = Misc.getFilteredInput(input).toLowerCase();
- c.sendMessage("Your password is now: @red@" + c.playerPass);
- }
- },
- SETTAG(donator()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isSponsor() && c.getRights().isSupporter() && c.getRights().isVIP() && c.getRights().isSuperVIP()) {
- String[] text = input.split(" ");
- 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."};
- for(int i = 0; i < bad.length; i++){
- if(input.indexOf(bad[i]) >= 0){
- c.sendMessage("@red@You can not use this title.");
- return;
- }
- }
- try {
- if (text.length > 10) {
- c.sendMessage("@red@Your title can not be longer than 10 characters.");
- return;
- }
- String[] args = input.split(" ");
- c.yellTag = args[1];
- return;
- } catch (final Exception e) {
- c.sendMessage("@blu@You're not a super donator, to donate use ::donate");
- }
- }
- }
- },
- REMOVETAG {
- @Override
- public void execute(Player c, String input) {
- c.yellTag = "";
- }
- },
- CHAR {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() ||c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- c.getPA().showInterface(3559);
- }
- },
- COMMANDS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- for (int i = 8144; i < 8195; i++) {
- c.getPA().sendFrame126("", i);
- }
- c.getPA().sendFrame126("@blu@Commands", 8144);
- c.getPA().sendFrame126("", 8145);
- c.getPA().sendFrame126("@blu@::players@bla@ - Shows players online", 8147);
- c.getPA().sendFrame126("@blu@::claimvote / ::claim@bla@ - Claim your voting reward", 8148);
- c.getPA().sendFrame126("@blu@::train / ::training @bla@- teleports you to training area", 8149);
- c.getPA().sendFrame126("@blu@::empty@bla@ - Destroy all items in your inventory", 8150);
- c.getPA().sendFrame126("@blu@::duel / ::stake@bla@ - Teleports you to the Duel arena", 8151);
- c.getPA().sendFrame126("@blu@::home / ::ge@bla@ - Teleports you home", 8152);
- c.getPA().sendFrame126("@blu@::edge@bla@ - Teleports you to Edgeville", 8153);
- c.getPA().sendFrame126("@blu@::vote@bla@ - Takes you to the voting page", 8154);
- c.getPA().sendFrame126("@blu@::forums@bla@ - Takes you to the forums", 8155);
- c.getPA().sendFrame126("@blu@::store@bla@ - Takes you to the store/donation page", 8156);
- c.getPA().sendFrame126("@blu@::changepassword newpass@bla@ - Changes your password", 8157);
- c.getPA().sendFrame126("@blu@::lock@bla@ - Locks/Unlocks your XP", 8158);
- c.getPA().sendFrame126("@blu@::char@bla@ - Teleports you to the Make-over Mage", 8159);
- c.getPA().sendFrame126("@blu@::claimpayment@bla@ - Claims your donation", 8160);
- c.getPA().sendFrame126("@blu@::rules@bla@ - Brings you to the rules thread", 8161);
- c.getPA().sendFrame126("@blu@::highscores@bla@ - Brings you to the highscores", 8162);
- c.getPA().sendFrame126("@blu@::mb/::wests/::gdz/::easts@bla@ - Teles you to these hotspots", 8163);
- c.getPA().sendFrame126("@blu@::counter@bla@ - Toggles your 474 counter on/off", 8164);
- c.getPA().sendFrame126("@blu@::orbs@bla@ - Toggles your 474 orbs on/off", 8165);
- c.getPA().sendFrame126("@blu@::help@bla@ - Brings up the help request interface", 8166);
- c.getPA().sendFrame126("@blu@::claimstatus@bla@ - Updates your donator rank.", 8167);
- c.getPA().sendFrame126("@blu@::drops@bla@ - Opens drop tables.", 8168);
- c.getPA().sendFrame126("@blu@::answer@bla@ - attempt a answer for the trivia.", 8169);
- c.getPA().sendFrame126("@blu@::bosslog@bla@ - displays your boss kills.", 8170);
- c.getPA().sendFrame126("@dre@Donator's Only", 8172);
- c.getPA().sendFrame126("@dre@::yell message@bla@ - Sends a global message", 8173);
- c.getPA().sendFrame126("@dre@::dz@bla@ - Teleports you to the donator's zone", 8174);
- c.getPA().showInterface(8134);
- }
- },
- DONATE {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.com/donate", 12000);
- }
- },
- DOWNLOAD {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.org", 12000);
- }
- },
- /* CLAIMVOTE("claim", "checkvote", "redeemvote") {
- @Override
- public void execute(Player c, String input) {
- try {
- VoteReward reward = Server.vote.hasVoted(c.playerName.replaceAll(" ", "_"));
- if (reward != null) {
- switch (reward.getReward()) {
- case 0:
- c.getItems().addItemUnderAnyCircumstance(784, 1);
- PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
- + " @bla@has just voted for OS-World and received a voting rewards book.");
- break;
- }
- c.sendMessage("Thank you for voting for OS-WORLD!");
- } else {
- c.sendMessage("You have no voting rewards waiting for you.");
- }
- c.sendMessage("");
- } catch (Exception e) {
- c.sendMessage("A voting error has occurred, please contact an administrator.");
- }
- }
- },
- /*CLAIM {
- @Override
- public void execute(Player c, String input) {
- try {
- VoteReward reward = Server.vote.hasVoted(c.playerName.replaceAll(" ", "_"));
- if (reward != null) {
- switch (reward.getReward()) {
- case 0:
- int boneBits = 2000000 + Misc.random(500000);
- c.getItems().addItemUnderAnyCircumstance(995, boneBits);
- c.votePoints += 3;
- PlayerHandler.executeGlobalMessage("@dre@<img=9>" + Misc.capitalize(c.playerName)
- + " @bla@has just voted and received @dre@2m coins & 3 Vote Points.");
- if (Misc.random(7) == 7) {
- c.sendMessage("You was lucky and recieved a bonus Vote Points!");
- c.
- s += 5;
- }
- break;
- }
- c.sendMessage("Thank you for voting for OS-WORLD!");
- } else {
- c.sendMessage("You have no voting rewards waiting for you.");
- }
- c.sendMessage("");
- } catch (Exception e) {
- c.sendMessage("A voting error has occurred, please contact an administrator.");
- }
- }
- },*/
- EASTS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3353, 3684, 0));
- }
- },
- FORUMS {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.com/forums/", 12000);
- }
- },
- STORE {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.com/donate/", 12000);
- }
- },
- STREAK{
- @Override
- public void execute(Player c, String input) {
- c.forceChat("[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
- }
- },
- KILLSTREAK{
- @Override
- public void execute(Player c, String input) {
- c.forceChat("@dre@[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
- }
- },
- KS{
- @Override
- public void execute(Player c, String input) {
- c.forceChat("[" + c.playerName + "] I am currently on a " + c.killStreak + " kill streak!");
- }
- },
- KDR{
- @Override
- public void execute(Player c, String input) {
- DecimalFormat df = new DecimalFormat("#.##");
- double ratio = ((double) c.KC) / ((double) c.DC);
- c.forceChat("[" + c.playerName + "] I have " + c.KC + " kills and " + c.DC + " deaths. My KDR is:"+ df.format(ratio) + "");
- }
- },
- WBOSS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2980, 3871, 0));
- }
- },
- HELP {
- @Override
- public void execute(Player c, String input) {
- c.getPA().closeAllWindows();
- c.getPA().showInterface(59525);
- }
- },
- HOSTS {
- @Override
- public void execute(Player c, String input) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- Player c2 = PlayerHandler.players[i];
- if (c2.getItems().playerHasItem(15098)) {
- sb.append(c2.playerName + ", ");
- }
- }
- }
- if (sb.length() > 0) {
- String result = "@blu@Available hosts@bla@: " + sb.substring(0, sb.length() - 2);
- String[] wrappedLines = WordUtils.wrap(result, 80).split(System.getProperty("line.separator"));
- for (String line : wrappedLines) {
- c.sendMessage(line);
- }
- } else {
- c.sendMessage("@blu@No hosts available!");
- }
- }
- },
- /*BONUSXP {
- @Override
- public void execute(Player c, String input) {
- if (c.BONUS_WEEKEND == false) {
- c.BONUS_WEEKEND = true;
- c.sendMessage("Your XP is now: @red@locked@bla@.");
- } else {
- c.BONUS_WEEKEND = false;
- c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
- }
- }
- },*/
- LOCK {
- @Override
- public void execute(Player c, String input) {
- if (c.expLock == false) {
- c.expLock = true;
- c.sendMessage("Your XP is now: @red@locked@bla@.");
- } else {
- c.expLock = false;
- c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
- }
- }
- },
- MB {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2539, 4716, 0));
- }
- },
- BURNERS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(1719, 3465, 0));
- }
- },
- PLAYERS {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("@bla@Online players:@blu@" + PlayerHandler.getPlayerCount() +"");
- }
- },
- TRAIN {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2672, 3712, 0));
- }
- },
- TRAINING {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2672, 3712, 0));
- }
- },
- PLAYERS11111 {
- @Override
- public void execute(Player c, String input) {
- //for (int i = 8144; i < 8195; i++) {
- // c.getPA().sendFrame126("", i);
- // }
- // c.getPA().showInterface(8134);
- c.getPA().sendFrame126("@blu@" + Config.SERVER_NAME + " Players:", 8144);
- c.getPA().sendFrame126("@red@Online players:" + PlayerHandler.getPlayerCount() + "", 8145);
- int line = 8147;
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- Player d = c.getClient(PlayerHandler.players[i].playerName);
- if (d.playerName != null) {
- c.getPA().sendFrame126(d.playerName, line);
- line++;
- } else if (d.playerName == null) {
- c.getPA().sendFrame126("@gre@", line);
- }
- }
- c.getPA().sendFrame126("", i);
- c.flushOutStream();
- return;
- }
- c.sendMessage("There are currently <col=255>" + PlayerHandler.getPlayerCount() + "</col> players online on <col=255>OS-WORLD.");
- }
- },
- RULES {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.com/forums/index.php?/topic/1362-os-world-official-rules/", 12000);
- }
- },
- SKULL {
- @Override
- public void execute(Player c, String input) {
- c.isSkulled = true;
- c.drawSkulls();
- c.skullTimer = Config.SKULL_TIMER;
- c.getPA().requestUpdates();
- c.sendMessage("<col=FF0000>Talk to the Emblem Trader to receive a extended skull.</col>");
- }
- },
- VOTE {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.com/voting", 12000);
- }
- },
- HIGHSCORES {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.shayzien.com/highscores", 12000);
- }
- },
- WESTS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2979, 3597, 0));
- }
- },
- YELL {
- private final String[] ILLEGAL_ARGUMENTS = { ":tradereq:", "<img", "@cr", "<tran", "#url#", ":duelreq:",
- ":chalreq:" };
- @Override
- public void execute(Player c, String input) {
- if(c.getRights().isPlayer() || c.getRights().isManIron() || c.getRights().isUlt()) {
- c.sendMessage("You need to donate to use this command. ::donate");
- return;
- }
- if (c.getRights().isStaff()) {
- //TODO check below and merge this shit.
- String rank = "";
- String message = input;
- if (Connection.isMuted(c)) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- if (System.currentTimeMillis() < c.muteEnd) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- //String yellTag = "";
- //if (c.yellTag.length() > 0) {
- // yellTag = "[" + c.yellTag + "@bla@]";
- // }
- String playerTitle = c.getTitles().getCurrentTitle();
- if (c.getRights().isContributor()) {
- rank = "[@cr4@@red@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isSponsor()) {
- rank = "[@cr5@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isSupporter()) {
- rank = "[@cr6@<col=148200>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isVIP()) {
- rank = "[@cr7@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isSuperVIP()) {
- rank = "[@cr8@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isElite()) {
- rank = "[@cr30@@or2@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isLegend()) {
- rank = "[@cr31@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isRespectedMember()) {
- rank = "[@cr9@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isHelper()) {
- rank = "[@cr10@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- /* Staff */
- if (c.getRights().isModerator()) {
- rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isAdministrator()) {
- rank = "[@cr2@@yel@"
- + "istrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
- }
- if (c.playerName.equalsIgnoreCase("sean")) {
- //rank = "<col=5E14A7>Owner</col>" + Misc.ucFirst(c.playerName) + ":<col=0000FF>";
- rank = "[<col=5E14A7>@cr2@Owner]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- }
- if (c.playerName.equalsIgnoreCase("")) {
- rank = "[<col=5E14A7>@cr2@Community Manager]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- }
- message = message.toLowerCase();
- for (String argument : ILLEGAL_ARGUMENTS) {
- if (message.contains(argument)) {
- c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
- return;
- }
- }
- message = Misc.ucFirst(message);
- PlayerHandler.executeGlobalMessage(rank + message);
- return;
- }
- String rank = "";
- String message = input;
- if (Connection.isMuted(c)) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- if (System.currentTimeMillis() < c.muteEnd) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isContributor()) {
- c.sendMessage("You are a @red@Contributor@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isSponsor()) {
- c.sendMessage("You are a @blu@Sponsor@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isSupporter()) {
- c.sendMessage("You are a Supporter and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isVIP()) {
- c.sendMessage("You are a <col=FF00CD>VIP</col>@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isSuperVIP()) {
- c.sendMessage("You are a @yel@Super VIP@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- String playerTitle = c.getTitles().getCurrentTitle();
- if (c.getRights().isContributor()) {
- rank = "[@cr4@@red@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isSponsor()) {
- rank = "[@cr5@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isSupporter()) {
- rank = "[@cr6@<col=148200>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isVIP()) {
- rank = "[@cr7@<col=FF00CD>" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isSuperVIP()) {
- rank = "[@cr8@@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isElite()) {
- rank = "[<img=30>@or2@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isLegend()) {
- rank = "[<img=31>@yel@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isRespectedMember()) {
- rank = "[@cr9@@red@" + playerTitle + "</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isHelper()) {
- rank = "[@cr10@@blu@" + playerTitle + "@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- /* Staff */
- if (c.getRights().isModerator()) {
- rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isAdministrator()) {
- rank = "[@cr2@@yel@Administrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
- }
- if (c.getRights().isOwner() && !c.playerName.equalsIgnoreCase("Notepad")) {
- rank = "[<col=A67711>Owner</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- }
- if (c.playerName.equalsIgnoreCase("Mod trent")) {
- rank = "[<col=5E14A7>Server BITCH</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- }
- message = message.toLowerCase();
- for (String argument : ILLEGAL_ARGUMENTS) {
- if (message.contains(argument)) {
- c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
- return;
- }
- }
- c.lastYell.reset();
- message = Misc.ucFirst(message);
- PlayerHandler.executeGlobalMessage(rank + message);
- }
- },
- /*
- * Donator
- */
- DONATORTITLE(donator()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("You will now get your donator title instead. Relog for changes to take effect.");
- c.keepTitle = false;
- c.killTitle = false;
- }
- },
- DONATORZONE(donator(), "dz") {
- @Override
- public void execute(Player c, String input) {
- if (c.inTrade || c.inDuel || c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2848, 5075, 0));
- }
- },
- KILLTITLE(donator()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("You will now be using your kill title instead. Relog for changes to take effect.");
- c.keepTitle = false;
- c.killTitle = true;
- }
- },
- /*
- * HELPER
- */
- HELPDB(helper()) {
- @Override
- public void execute(Player c, String input) {
- HelpDatabase.getDatabase().openDatabase(c);
- }
- },
- /*
- * Moderator
- */
- CHECKINVENTORY(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.getPA().otherInv(c, c2);
- c.getDH().sendDialogues(206, 0);
- } else {
- c.sendMessage(input + " is not online. You can only check the inventory of online players.");
- }
- }
- },
- INFO(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.sendMessage("IP of " + c2.playerName + " : " + c2.connectedFrom);
- c.sendMessage("Mac Address of " + c2.playerName + " : " + c2.getMacAddress());
- } else {
- c.sendMessage(input + " is not line. You can request the info of online players.");
- }
- }
- },
- KSMOD(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.sendMessage("Hunter killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.HUNTER));
- c.sendMessage("Rogue killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.ROGUE));
- }
- }
- },
- LOCKACC(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- try {
- String[] args = input.split(" ");
- if (args.length != 1) {
- c.sendMessage("Invalid arguments specified!");
- throw new IllegalArgumentException();
- }
- String name = args[0];
- Connection.lockAccount(name);
- Connection.addNameToLocks(name);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getRights().isBetween(2, 3)) {
- c.sendMessage("You cannot lock this player's account!");
- return;
- }
- if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
- MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
- session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- }
- c2.disconnected = true;
- c.sendMessage(Misc.formatPlayerName(name) + "'s account has been locked.");
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Correct usage: ::lock playername");
- }
- }
- },
- MARKETUNMUTE(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.marketMuteEnd = 0;
- c.sendMessage(c2.playerName + " has been unmuted on the market channel.");
- c2.sendMessage("@red@You have been unmuted by " + c.playerName + " on the market channel.");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Market Unmute", "");
- }
- }
- },
- MOVE(admin()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- int positionOffset = Integer.parseInt(args[1]);
- int x = c.absX;
- int y = c.absY;
- int height = c.heightLevel;
- switch (args[0].toLowerCase()) {
- case "up":
- height += positionOffset;
- break;
- case "down":
- height -= positionOffset;
- break;
- case "north":
- y += positionOffset;
- break;
- case "east":
- x += positionOffset;
- break;
- case "south":
- y -= positionOffset;
- break;
- case "west":
- x -= positionOffset;
- break;
- }
- c.getPA().movePlayer(x, y, height);
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::move up/down/north/east/south/west amount");
- }
- }
- },
- RANDOM(mod()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split("-");
- boolean ignore = false;
- if (args.length > 2) {
- c.sendMessage("Incorrect syntax; '::random-name'");
- return;
- }
- if (args.length == 2) {
- if (args[1].equals("ignore")) {
- if (!c.getRights().inherits(Rights.ADMINISTRATOR)) {
- c.sendMessage("You cannot force this, you do not inherit Administrative rights.");
- return;
- }
- ignore = true;
- } else {
- c.sendMessage("The second argument should contain 'ignore', please try again.");
- return;
- }
- }
- Optional<Player> online = PlayerHandler.getOptionalPlayer(args[0]);
- if (!online.isPresent()) {
- c.sendMessage("This player is not online.");
- return;
- }
- Player target = online.get();
- if (target.getInterfaceEvent().isActive()) {
- c.sendMessage("The event is already active for this player. It should resolve shortly.");
- return;
- }
- if (!target.getInterfaceEvent().isExecutable() && !ignore) {
- c.sendMessage("The event is deemed as 'un-executable'. This could be due to a number of reasons.");
- c.sendMessage("If you believe the event should ignore this, type ::random-name-ignore to do so.");
- c.sendMessage("Only administrative staff have this access.");
- return;
- }
- c.sendMessage("You have executed the random event for this player.");
- target.getInterfaceEvent().execute();
- }
- },
- STAFFTITLE(mod()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("You will now get your staff title instead. Relog for changes to take effect.");
- c.keepTitle = false;
- c.killTitle = false;
- }
- },
- STAFFZONE(helper()) {
- @Override
- public void execute(Player c, String input) {
- TeleportExecutor.teleport(c, new Position(2912, 5475, 0));
- }
- },
- TELETO(mod(), "xteleto") {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.getPA().movePlayer(c2.getX(), c2.getY(), c2.heightLevel);
- } else {
- c.sendMessage(input + " is not line. You can only teleport to online players.");
- }
- }
- },
- TELETOME(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.teleportToX = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage(Misc.formatPlayerName(c2.playerName)+ " has been teleported to you.");
- } else {
- c.sendMessage(input + " is offline. You can only teleport online players.");
- }
- }
- },
- UNLOCK(mod()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- if (args.length != 1) {
- c.sendMessage("Invalid arguments specified!");
- throw new IllegalArgumentException();
- }
- String name = args[0];
- if (Connection.lockedAccounts.contains(name)) {
- Connection.unlockAccount(name);
- c.sendMessage(Misc.formatPlayerName(name) + "'s account has been unlocked.");
- } else {
- c.sendMessage("That player's account is not locked.");
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Correct usage: ::unlock playername");
- }
- }
- },
- VISIBILITY(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (c.isInvisible()) {
- c.setInvisible(false);
- c.sendMessage("You are no longer invisible.");
- } else {
- c.setInvisible(true);
- c.sendMessage("You are now invisible.");
- }
- c.getPA().requestUpdates();
- }
- },
- /*
- * Administrator
- */
- CHECKBANK(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (PlayerHandler.updateRunning) {
- c.sendMessage("You cannot view a bank whilst the server is updating.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- c.getPA().openOtherBank(optionalPlayer.get());
- } else {
- c.sendMessage(input + " is not online. You can only view the bank of online players.");
- }
- }
- },
- DUELARENA(owner()) {
- @Override
- public void execute(Player c, String input) {
- Config.NEW_DUEL_ARENA_ACTIVE = Config.NEW_DUEL_ARENA_ACTIVE ? false : true;
- c.sendMessage("The duel arena is currently " + (Config.NEW_DUEL_ARENA_ACTIVE ? "Enabled" : "Disabled") + ".");
- }
- },
- EMPTY {
- @Override
- public void execute(Player c, String input) {
- if (!c.inWild() && !c.inCamWild() && !c.inPvP() && !c.inDuel) {
- c.getPA().removeAllItems();
- c.sendMessage("You empty your inventory.");
- } else {
- c.sendMessage("You cannot empty your inventory here.");
- }
- //c.sendMessage("This command is not available at this time.");
- }
- },
- SPAWNNPC(owner()) {
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- BufferedWriter spawn = new BufferedWriter(new FileWriter("./Data/cfg/spawn-config.cfg", true));
- int npcId = Integer.parseInt(args[0]);
- if (npcId > 0) {
- Server.npcHandler.spawnNpc(c, npcId, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
- c.sendMessage("You have spawned: " + npcId + "Name: " + NpcDefinition.DEFINITIONS[npcId].getName());
- } else {
- c.sendMessage("No Such Npc");
- }
- try {
- spawn.newLine();
- spawn.write("spawn = " + npcId + " " + c.absX + " " + c.absY + " 0 1 0 0 0");
- } finally {
- spawn.close();
- }
- } catch (IOException e) {
- }
- }
- },
- GODMODE(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (c.inGodmode()) {
- c.playerLevel[Skill.STRENGTH.getId()] = 99;
- c.getPA().refreshSkill(2);
- c.playerLevel[Skill.HITPOINTS.getId()] = 99;
- c.getPA().refreshSkill(3);
- c.playerLevel[Skill.PRAYER.getId()] = 99;
- c.getPA().refreshSkill(5);
- c.specAmount = 10.0;
- c.getPA().requestUpdates();
- c.setSafemode(false);
- c.setGodmode(false);
- c.sendMessage("Godmode deactivated. Return to base for debriefing.");
- } else {
- c.playerLevel[Skill.STRENGTH.getId()] = 9999;
- c.getPA().refreshSkill(Skill.STRENGTH.getId());
- c.playerLevel[3] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(3);
- c.playerLevel[5] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(5);
- c.specAmount = Integer.MAX_VALUE;
- c.getPA().requestUpdates();
- c.setSafemode(true);
- c.setGodmode(true);
- c.sendMessage("Godmode activated. Good luck soldier!");
- }
- }
- },
- MACBAN(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (isMacAddress(input)) {
- banAddress(c, input);
- } else {
- banPlayer(c, input);
- }
- }
- void banPlayer(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getMacAddress().isEmpty()) {
- c.sendMessage("The players mac address is empty and therefor cannot be added to the list.");
- c.sendMessage("This happens when the client cannot determine the player address during login.");
- c.sendMessage("You are going to have to consider another possible means of action.");
- return;
- }
- if (Connection.isMacBanned(c2.getMacAddress())) {
- c.sendMessage("This player is already mac banned, they shouldn't be online.");
- c.sendMessage("Consider another possible means of action.");
- return;
- }
- Connection.addNameToBanList(c2.playerName, Long.MAX_VALUE);
- Connection.addMacBan(c2.getMacAddress());
- c.sendMessage(c2.playerName + " has been mac banned with the address: " + c2.getMacAddress() + ".");
- c2.disconnected = true;
- c2.properLogout = true;
- } else {
- c.sendMessage(input + " is offline. Try '::macban macaddress' instead to ban offline players.");
- }
- }
- void banAddress(Player c, String input) {
- Connection.addMacBan(input);
- c.sendMessage("Mac address: " + input + " has been banned.");
- }
- boolean isMacAddress(String input) {
- return input.length() == 17 && StringUtils.countMatches(input, "-") == 5;
- }
- },
- PNPC(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String args[] = input.split("-");
- if (args.length != 2) {
- throw new IllegalArgumentException();
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- int npc = Integer.parseInt(args[1]);
- if (npc < 9999) {
- c2.npcId2 = npc;
- c2.playerWalkIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerStandIndex = NPCCacheDefinition.forID(npc).getStandIndex();
- c2.playerRunIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurnIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurn180Index = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurn90CCWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurn90CWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.isNpc = true;
- c2.updateRequired = true;
- c2.appearanceUpdateRequired = true;
- }
- } else {
- throw new IllegalStateException();
- }
- } catch (IllegalArgumentException e) {
- c.sendMessage("Error. Correct syntax: ::pnpc-player-npcid");
- } catch (IllegalStateException e) {
- c.sendMessage("You can only use the command on online players.");
- }
- }
- },
- SAFEMODE() {
- @Override
- public void execute(Player c, String input) {
- if (c.inSafemode()) {
- c.setSafemode(false);
- c.sendMessage("You now lose items on death again.");
- } else {
- c.setSafemode(true);
- c.sendMessage("You no longer lose items on death.");
- }
- }
- },
- SETVAR(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- if (args.length != 2) {
- c.sendMessage("Code red! Invalid var arguments specified! Try again?");
- return;
- }
- String variable = args[0];
- String t;
- Double value2 = Double.parseDouble(args[1]);
- int value = value2.intValue();
- if (variable.startsWith("com_")) {
- t = variable.substring(4);
- switch (t) {
- case "god":
- c.setGodmode(value == 1 ? true : false);
- if (value == 0) {
- c.playerLevel[3] = 99;
- c.getPA().refreshSkill(3);
- c.playerLevel[5] = 99;
- c.specAmount = 10.0;
- c.getPA().refreshSkill(5);
- c.getPA().requestUpdates();
- c.setSafemode(false);
- } else {
- c.playerLevel[Skill.STRENGTH.getId()] = 9999;
- c.getPA().refreshSkill(Skill.STRENGTH.getId());
- c.playerLevel[3] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(3);
- c.playerLevel[5] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(5);
- c.specAmount = Integer.MAX_VALUE;
- c.getPA().requestUpdates();
- c.setSafemode(true);
- }
- break;
- case "droprate":
- c.setDropModifier(value2);
- c.sendMessage("set " + variable + ": to " + value2);
- return;
- case "poison":
- c.setPoisonDamage((byte) value);
- c.getPA().requestUpdates();
- break;
- case "venom":
- c.setVenomDamage((byte) value);
- c.getPA().requestUpdates();
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("jmod_")) {
- t = variable.substring(5);
- switch (t) {
- case "bh":
- Config.BOUNTY_HUNTER_ACTIVE = value == 1 ? true : false;
- break;
- case "debug":
- c.setDebug(value);
- break;
- case "dxp":
- Config.BONUS_WEEKEND = value == 1 ? true : false;
- break;
- case "attackable":
- Config.ADMIN_ATTACKABLE = value >= 1 ? true : false;
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value);
- } else if (variable.startsWith("tzhaar_")) {
- t = variable.substring(7);
- switch (t) {
- case "wave":
- c.waveId = value;
- break;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("clanwars_")) {
- t = variable.substring(9);
- switch (t) {
- case "ffa":
- //ClanWars.FFA_ENABLED = value >= 1 ? true : false;
- break;
- case "challenge":
- //ClanWars.CHALLENGE_ENABLED = value >= 1 ? true : false;
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("wep_")) {
- t = variable.substring(4);
- switch (t) {
- case "blowpipe":
- c.setToxicBlowpipeCharge(value);
- c.setToxicBlowpipeAmmo(value);
- c.setToxicBlowpipeAmmoAmount(value);
- break;
- case "trident":
- c.setTridentCharge(value);
- c.setToxicTridentCharge(value);
- break;
- case "serp":
- c.setSerpentineHelmCharge(value);
- break;
- case "toxic":
- c.setToxicStaffOfDeadCharge(value);
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("help")) {
- c.getDH().sendStatement("Var arguments: com_god, config_bh, config_dxp, tzhaar_wave, config_attackable");
- } else {
- throwInvalid(c);
- }
- }
- private int BASE_VARIABLE = 15;
- /**
- * Throws a lovely invalid message should the player's arguments be invalid.
- * @param c the player
- */
- private void throwInvalid(Player c) {
- c.sendMessage("Code red! Invalid var arguments specified! Try again?");
- }
- },
- SMESSAGE(admin()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split("-");
- if (args.length != 2) {
- c.sendMessage("Improper syntax; type ::smessage-player-message");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.sendMessage(args[1]);
- } else {
- c.sendMessage(args[0] + " is not online. You can only send messages to online players.");
- }
- }
- },
- /*SPELLS {
- @Override
- public void execute(Player c, String input) {
- if(c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
- c.sendMessage("You can only spawn items in a safezone.");
- return;
- }
- if (c.playerMagicBook == 2) {
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- } else if (c.playerMagicBook == 0) {
- c.sendMessage("You switch to ancient magic.");
- c.setSidebarInterface(6, 12855);
- c.playerMagicBook = 1;
- } else if (c.playerMagicBook == 1) {
- c.sendMessage("You switch to lunar magic.");
- c.setSidebarInterface(6, 29999);
- c.playerMagicBook = 2;
- }
- }
- },*/
- UNIPBAN(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (input.isEmpty()) {
- c.sendMessage("You must enter a valid IP address.");
- return;
- }
- if (!Connection.isIpBanned(input)) {
- c.sendMessage("This IP address is not listed as IP banned");
- return;
- }
- try {
- Connection.removeIpBan(input);
- } catch (IOException e) {
- c.sendMessage("The IP could not be successfully removed from the file.");
- return;
- }
- Connection.removeIpFromBanList(input);
- c.sendMessage("The IP '"+input+"' has been removed from the IP ban list.");
- }
- },
- UNMACBAN(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- c.sendMessage("address: " + input);
- if (!Connection.isMacBanned(input)) {
- c.sendMessage("The address does not exist in the list, make sure it matches perfectly.");
- return;
- }
- Connection.removeMacBan(input);
- c.sendMessage("The mac ban on the address; " + input + " has been lifted.");
- } catch (IndexOutOfBoundsException exception) {
- c.sendMessage("Error. Correct syntax: ::unmacban address.");
- }
- }
- },
- UPDATEBANS(owner()) {
- @Override
- public void execute(Player c, String input) {
- Connection.resetIpBans();
- }
- },
- /*
- * OWNER
- */
- BANK(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.getPA().openUpBank();
- }
- },
- BARRAGE(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("This command is not available at this time.");
- }
- },
- BH(owner()) {
- @Override
- public void execute(Player c, String input) {
- //Config.BOUNTY_HUNTER_ACTIVE = Config.BOUNTY_HUNTER_ACTIVE ? false : true;
- //c.sendMessage(Config.BOUNTY_HUNTER_ACTIVE ? "Bounty hunter is now active." : "Bounty hunter is no longer active.");
- }
- },
- /* LOCK {
- @Override
- public void execute(Player c, String input) {
- if (c.expLock == false) {
- c.expLock = true;
- c.sendMessage("Your XP is now: @red@locked@bla@.");
- } else {
- c.expLock = false;
- c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
- }
- }
- },*/
- BONUSON(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.BONUS_WEEKEND = true;
- c.sendMessage("BONUS WEEKEND TOGGLED ON");
- }
- },
- BONUSOFF(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.BONUS_WEEKEND = false;
- c.sendMessage("BONUS WEEKEND TOGGLED Off");
- }
- },
- CUSTOM(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.getPA().checkObjectSpawn(411, 2340, 9806, 2, 10);
- }
- },
- CYBER(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (Config.CYBER_MONDAY) {
- Config.CYBER_MONDAY = false;
- c.sendMessage("CYBER MONDAY TOGGLED OFF");
- } else {
- Config.CYBER_MONDAY = true;
- c.sendMessage("CYBER MONDAY TOGGLED ON");
- }
- }
- },
- DEBUG(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (Config.SERVER_DEBUG) {
- Config.SERVER_DEBUG = false;
- // PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled off by " +c.playerName);
- } else {
- Config.SERVER_DEBUG = true;
- //PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled on by " +c.playerName);
- }
- }
- },
- DEMOTE(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.PLAYER);
- c.sendMessage("You've demoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only demote online players.");
- }
- }
- },
- EMOTE(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.animation(Integer.parseInt(input));
- c.getPA().requestUpdates();
- }
- },
- FALEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Player c2 = PlayerHandler.players[j];
- c2.forceChat(input);
- c2.forcedChatUpdateRequired = true;
- c2.updateRequired = true;
- }
- }
- }
- },
- GET(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- String regex = args[0].replaceAll("_", " ").toLowerCase();
- List<ItemDefinition> list = new Gson().fromJson(FileUtils.readFileToString(new File("./Data/json/item_definitions.json")),new TypeToken<List<ItemDefinition>>() { }.getType());
- Optional<ItemDefinition> item = list.stream().filter(i -> i.getName().toLowerCase() == regex).findFirst();
- if (item.isPresent()) {
- final ItemDefinition def = item.get();
- int amount = Integer.parseInt(args[1]);
- c.getItems().addItem(def.getName() == "coins" ? 995 : def.getId(), amount);
- } else {
- c.sendMessage("Uh oh! That was quite ineffective. It seems you've tried to spawn " + regex + ".");
- }
- } catch (IOException ex) {
- System.err.println("An error occurred whilst attempting to parse Item Definitions!");
- }
- }
- },
- GETPASS(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- Optional<Player> c2 = PlayerHandler.getOptionalPlayer(input);
- if (c2.isPresent()) {
- c.sendMessage("Username: (" + c2.get().playerName + ") Password: (" + c2.get().playerPass + ") ");
- } else {
- c.sendMessage("This player either does not exist or is OFFLINE.");
- }
- } catch (Exception e) {
- c.sendMessage("Invalid Command, Try ::getpass USERNAME.");
- }
- }
- },
- GFX(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.gfx0(Integer.parseInt(input));
- }
- },
- GIVE(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- String item = args[0].replaceAll("_", " ");
- int amount = args.length == 2 ? Integer.parseInt(args[1]) : 1;
- int itemId = (item.equalsIgnoreCase("coins") ? 995 : c.getItems().getItemId(item));
- if ((itemId <= 20500) && (itemId >= 0)) {
- c.getItems().addItem(itemId, amount);
- }
- } catch (Exception e) {
- c.sendMessage("Invalid item name or syntax! Try this - ::give itemname amount");
- }
- }
- },
- GIVEBRO(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.UNKNOWN);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- GIVEGOL(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.SPONSOR);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- GIVEITEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String args[] = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String playerName = args[0];
- int itemID = Integer.parseInt(args[1]);
- int amount = Misc.stringToInt(args[2]);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getItems().freeSlots() > amount - 1) {
- c2.getItems().addItem(itemID, amount);
- c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
- + " by: " + Misc.optimizeText(c.playerName));
- } else {
- c2.getItems().addItemToBank(itemID, amount);
- c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
- + " by: " + Misc.optimizeText(c.playerName));
- c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
- }
- c.sendMessage("You have just given " + amount + " of item number: " + c.getItems().getItemName(itemID)
- + ".");
- } else {
- c.sendMessage(playerName + " is not online.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::giveitem-player-itemid-amount");
- }
- }
- },
- GIVEMOD(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.MODERATOR);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- GIVEPTS(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.donatorPoints += 2;
- c.sendMessage("You've given 2 store points to the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only give store points to online players.");
- }
- }
- },
- GIVESIL(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.CONTRIBUTOR);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- INTERFACE(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- int a = Integer.parseInt(input);
- c.getPA().showInterface(a);
- } catch (Exception e) {
- c.sendMessage("::interface ####");
- }
- }
- },
- JIG(owner()) {
- @Override
- public void execute(Player c, String input) {
- TeleportExecutor.teleport(c, new Position(3094, 3486, 0));
- }
- },
- KILL(owner()) {
- @Override
- public void execute(Player c, String input) {
- Player player = PlayerHandler.getPlayer(input);
- if (player == null) {
- c.sendMessage("Player is null.");
- return;
- }
- player.appendDamage(player.playerLevel[3], Hitmark.HIT);
- player.getPA().refreshSkill(3);
- player.sendMessage("You have been merked by " + c.playerName + ".");
- }
- },
- NPC(owner()) {
- @Override
- public void execute(Player c, String input) {
- int newNPC = Integer.parseInt(input);
- if (newNPC > 0) {
- Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
- } else {
- c.sendMessage("No such NPC.");
- }
- }
- },
- NSPAWN(owner()) {
- @Override
- public void execute(Player c, String input) {
- NPCHandler.loadDefs();
- PlayerHandler.executeGlobalMessage("[<col=255>" + c.playerName + "</col>] " + "NPC Spawns have been reloaded.");
- }
- },
- OBJECT(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.getPA().object(Integer.parseInt(input), c.absX, c.absY, 0, 10);
- }
- },
- POS(owner()) {
- @Override
- public void execute(Player c, String input) {
- 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());
- }
- },
- PROMOTE(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split("-");
- if (args.length != 2) {
- c.sendMessage("The correct format is '::promote-name-rights'.");
- return;
- }
- Player player = PlayerHandler.getPlayer(args[0]);
- if (player == null) {
- c.sendMessage("The player '"+args[0]+"' could not be found, try again.");
- return;
- }
- int right;
- try {
- right = Integer.parseInt(args[1]);
- } catch (NumberFormatException e) {
- c.sendMessage("The level of rights must be a whole number.");
- return;
- }
- Rights rights = Rights.get(right);
- if (rights == null) {
- c.sendMessage("The level of rights you've requested is unknown.");
- return;
- }
- if (player.getRights().isStaff() && !c.getRights().isOwner()) {
- c.sendMessage("Only the CEO can modify the level of other staff.");
- return;
- }
- if (player.getRights().equals(rights)) {
- c.sendMessage("That player already has this level of rights.");
- return;
- }
- player.setRights(rights);
- player.properLogout = true;
- player.disconnected = true;
- c.sendMessage("You have promoted " + args[0] + " to " + rights.name() + ".");
- }
- },
- RED(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.drawSkulls();
- c.getPA().requestUpdates();
- }
- },
- RED2(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.headIconPk = (2);
- c.getPA().requestUpdates();
- }
- },
- RED3(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.headIconPk = (3);
- c.getPA().requestUpdates();
- }
- },
- RED4(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.headIconPk = (4);
- c.getPA().requestUpdates();
- }
- },
- RED5(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.headIconPk = (5);
- c.getPA().requestUpdates();
- }
- },
- RELOADITEMS(owner()) {
- @Override
- public void execute(Player c, String input) {
- // should really be done asynchronously...
- new ItemDefinitionLoader().load();
- c.sendMessage("@don2@[Load] Reloading @blu@item.cfg@bla@ and @blu@prices.txt");
- }
- },
- RELOADOBJECTS(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- Server.getGlobalObjects().reloadObjectFile(c);
- c.sendMessage("The object file has been reloaded.");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- },
- RELOADSHOPS(owner()) {
- @Override
- public void execute(Player c, String input) {
- Server.shopHandler = new org.perception.world.ShopHandler();
- c.sendMessage("[Load] Reloading @blu@Shop Config.cfg");
- }
- },
- SHIELD(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (c.isNpc && c.npcId2 == 336) {
- c.isNpc = false;
- } else {
- c.npcId2 = 336;
- c.isNpc = true;
- }
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- },
- SHOP(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- c.getShops().openShop(Integer.parseInt(input));
- c.sendMessage("You successfully opened shop #" + input + ".");
- } catch (IndexOutOfBoundsException ioobe) {
- c.sendMessage("Error. Correct syntax: ::shop shopid");
- }
- }
- },
- SIGIL(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (c.isNpc && c.npcId2 == 335) {
- c.isNpc = false;
- } else {
- c.npcId2 = 335;
- c.isNpc = true;
- }
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- },
- SPAWN(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- int itemId = Integer.parseInt(args[0]);
- int amount = Misc.stringToInt(args[1]);
- c.getItems().addItem(itemId, amount);
- } catch (NumberFormatException nfe) {
- c.sendMessage("Improper use of the command; '::spawn itemid amount'.");
- }
- }
- },
- UNMUTE(helper()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.muteEnd = 0;
- c.sendMessage(c2.playerName + " has been unmuted.");
- c2.sendMessage("@red@You have been unmuted by " + c.playerName + ".");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Unmute", "");
- }
- }
- },
- UNJAIL(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
- return;
- }
- c2.teleportToX = 3093;
- c2.teleportToY = 3493;
- c2.jailEnd = 0;
- c2.sendMessage("You have been unjailed by " + c.playerName + ". Don't get jailed again!");
- c.sendMessage("Successfully unjailed " + c2.playerName + ".");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Unjail", "");
- } else {
- c.sendMessage(input + " is not online. Only online players can be unjailed.");
- }
- }
- },
- JAIL(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- try {
- String[] args = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String name = args[0];
- int duration = Integer.parseInt(args[1]);
- long jailEnd = 0;
- if (duration == 0) {
- jailEnd = Long.MAX_VALUE;
- } else {
- jailEnd = System.currentTimeMillis() + duration * 1000 * 60;
- }
- String reason = args[2];
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
- return;
- }
- c2.teleportToX = 2095;
- c2.teleportToY = 4428;
- c2.jailEnd = jailEnd;
- if (duration == 0) {
- c2.sendMessage("@red@You have been permanently jailed by " + c.playerName + " .");
- c.sendMessage("Permanently jailed " + c2.playerName + ".");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Jail (Permanent)", reason);
- } else {
- c2.sendMessage("@red@You have been jailed by " + c.playerName + " for " + duration + " minutes.");
- c2.sendMessage("@red@Type ::unjail after having served your time to be unjailed.");
- c.sendMessage("Successfully jailed " + c2.playerName + " for " + duration + " minutes.");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Jail (" + duration + ")", reason);
- }
- } else {
- c.sendMessage(name + " is not online. You can only jail online players.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::jail-player-duration-reason");
- }
- }
- },
- PICKUP(admin()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- int itemId = Integer.parseInt(args[0]);
- int amount = Misc.stringToInt(args[1]);
- if(itemId > 23000) {
- c.sendMessage("This item does not exist!");
- return;
- }
- if(c.inWild()|| c.inPvP()|| c.safeTimer > 0) {
- c.sendMessage("You can only spawn items in a safezone.");
- return;
- }
- if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
- c.sendMessage("You cannot spawn items in the duel arena!");
- return;
- }
- if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
- return;
- }
- if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
- return;
- }
- if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
- return;
- }
- if (Boundary.isIn(c, Kraken.BOUNDARY)) {
- return;
- }
- /*for (int i = 0; i < COINS_SPAWN.length; i++) {
- if(!(itemId == i)) {
- c.sendMessage("You cannot spawn this item.");
- return;
- }
- }*/
- c.getItems().addItem(itemId, amount);
- } catch (NumberFormatException nfe) {
- c.sendMessage("Improper use of the command; '::item itemid amount'.");
- }
- }
- },
- TAKEITEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String args[] = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String playerName = args[0];
- int itemID = Integer.parseInt(args[1]);
- int amount = Misc.stringToInt(args[2]);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getItems().playerHasItem(itemID, 1)) {
- c2.getItems().deleteItem(itemID, amount);
- c.sendMessage("You have just taken " + amount + " " + c.getItems().getItemName(itemID) + " from " + c2.playerName + ".");
- c2.sendMessage(c.playerName + " has taken " + amount + " " + c.getItems().getItemName(itemID) + " from you.");
- } else {
- c.sendMessage("This player doesn't have this item!");
- }
- } else {
- c.sendMessage(playerName + " is not online.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::takeitem-player-itemid-amount");
- }
- }
- },
- /*
- * Teleports the player to the given coordinate. Note: to teleport by region, separate args[0]
- * 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>,
- * and <b>53 is the <i>regionY</i></b>).
- */
- TELE(admin()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- if (args.length > 1) {
- switch (args.length) {
- case 2:
- c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), c.heightLevel);
- break;
- case 3:
- c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
- break;
- }
- } else {
- String[] coords = args[0].split(",");
- int height = Integer.parseInt(coords[0]);
- int smallX = Integer.parseInt(coords[1]);
- int smallY = Integer.parseInt(coords[2]);
- switch (coords.length) {
- //Simple region - syntax x,y,height
- case 2:
- c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), c.heightLevel);
- break;
- case 3:
- c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
- break;
- case 4:
- //c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
- break;
- }
- }
- }
- },
- TEST(owner()) {
- private int[] DROP_LIST_COMMON = {4151
- };
- private int[] DROP_LIST_UNCOMMON = {4153
- };
- private int[] DROP_LIST_RARE = {12936, 12936, 12922, 12932, 12927, 6571
- };
- public int COMMON_DROP() {
- return DROP_LIST_COMMON[(int)(Math.random()*DROP_LIST_COMMON.length)];
- }
- public int UNCOMMON_DROP() {
- return DROP_LIST_UNCOMMON[(int)(Math.random()*DROP_LIST_UNCOMMON.length)];
- }
- public int RARE_DROP() {
- return DROP_LIST_RARE[(int)(Math.random()*DROP_LIST_RARE.length)];
- }
- @Override
- public void execute(Player c, String input) {
- for (int i = 0; i < 20; i++) {
- if (Misc.random(100) >= 0 && Misc.random(100) <= 49) {
- System.out.println(
- "Run #" + i + ", Gathered Common: " + c.getItems().addItem(COMMON_DROP(), 1));
- } else
- if (Misc.random(100) >= 50 && Misc.random(100) <= 97) {
- System.out.println(
- "Run #" + i + ", Gathered Uncommon: " + c.getItems().addItem(UNCOMMON_DROP(), 1));
- } else
- if (Misc.random(100) >= 98) {
- System.out.println(
- "Run #" + i + ", Gathered Rare: " + c.getItems().addItem(RARE_DROP(), 1));
- }
- }
- }
- },
- TROLL(owner()) {
- @Override
- public void execute(Player c, String input) {
- PlayerHandler.executeGlobalMessage("Quick! The first person to type @blu@::i4akosa9fUcxzij8a@bla@ will recieve a santa hat!!");
- }
- },
- UNPC(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.isNpc = false;
- c.playerStandIndex = 0x328;
- c.playerTurnIndex = 0x337;
- c.playerWalkIndex = 0x333;
- c.playerTurn180Index = 0x334;
- c.playerTurn90CWIndex = 0x335;
- c.playerTurn90CCWIndex = 0x336;
- c.playerRunIndex = 0x338;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- },
- UPDATE(owner()) {
- @Override
- public void execute(Player c, String input) {
- int seconds = Integer.parseInt(input);
- if (seconds < 15) {
- c.sendMessage("The timer cannot be lower than 15 seconds so other operations can be sorted.");
- seconds = 15;
- }
- PlayerHandler.updateSeconds = seconds;
- PlayerHandler.updateAnnounced = false;
- PlayerHandler.updateRunning = true;
- PlayerHandler.updateStartTime = System.currentTimeMillis();
- for (Player player : PlayerHandler.players) {
- if (player == null) {
- continue;
- }
- Player client = player;
- if (client.getPA().viewingOtherBank) {
- client.getPA().resetOtherBank();
- client.sendMessage("An update is now occuring, you cannot view banks.");
- }
- DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(client, MultiplayerSessionType.DUEL);
- if (Objects.nonNull(duelSession)) {
- if (duelSession.getStage().getStage() == MultiplayerSessionStage.FURTHER_INTERACTION) {
- if (!duelSession.getWinner().isPresent()) {
- duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- duelSession.getPlayers().forEach(p -> {
- p.sendMessage("The duel has been cancelled by the server because of an update.");
- duelSession.moveAndClearAttributes(p);
- });
- }
- } else if (duelSession.getStage().getStage() < MultiplayerSessionStage.FURTHER_INTERACTION) {
- duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- duelSession.getPlayers().forEach(p -> {
- p.sendMessage("The duel has been cancelled by the server because of an update.");
- duelSession.moveAndClearAttributes(p);
- });
- }
- }
- }
- }
- },
- VENG(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("This command is not available at this time.");
- }
- },
- WILD(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("inWilderness: " + (c.getY() == 3523 ? true : false));
- c.sendMessage("loc=[absX: " + c.getX() + " absY:" + c.getY() + "]");
- c.sendMessage("bh_active: " + Config.BOUNTY_HUNTER_ACTIVE);
- }
- },
- BANIP(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- try {
- String[] args = input.split("-");
- if (args.length != 2) {
- throw new IllegalArgumentException();
- }
- String ipToBan = args[0];
- String reason = args[1];
- Connection.addIpToBanList(ipToBan);
- Connection.addIpToFile(ipToBan);
- List<Player> clientList = PlayerHandler.getPlayers().stream().filter(player -> player.connectedFrom.equals(ipToBan))
- .collect(Collectors.toList());
- for (Player c2 : clientList) {
- if (!Connection.isIpBanned(c2.connectedFrom)) {
- Connection.addNameToBanList(ipToBan, Long.MAX_VALUE);
- Connection.addNameToFile(ipToBan, Long.MAX_VALUE);
- if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
- MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
- session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- }
- c2.disconnected = true;
- c.sendMessage("You have IP banned the user: " + c2.playerName + " with the host: " + c2.connectedFrom);
- }
- }
- c.sendMessage("You have successfully banned the IP: " + ipToBan);
- //new PunishmentHandler().punishOfflinePlayer(ipToBan, c, "Ban IP", reason);
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::banip-ip-reason");
- }
- }
- },
- BAN(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- try {
- String[] args = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String name = args[0];
- int duration = Integer.parseInt(args[1]);
- long banEnd;
- if (duration == 0) {
- banEnd = Long.MAX_VALUE;
- } else {
- banEnd = System.currentTimeMillis() + duration * 1000 * 60;
- }
- String reason = args[2];
- Connection.addNameToBanList(name, banEnd);
- Connection.addNameToFile(name, banEnd);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getRights().isBetween(2, 3)) {
- c.sendMessage("You cannot ban this player.");
- return;
- }
- if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
- MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
- session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- }
- c2.disconnected = true;
- if (duration == 0) {
- c.sendMessage(name + " has been permanently banned.");
- //new //PunishmentHandler().punishOnlinePlayer(c2, c, "Ban (Permanent)", reason);
- } else {
- c.sendMessage(name + " has been banned for " + duration + " minute(s).");
- //new //PunishmentHandler().punishOnlinePlayer(c2, c, "Ban (" + duration + ")", reason);
- }
- return;
- }
- if (duration == 0) {
- c.sendMessage(name + " has been permanently banned.");
- //new PunishmentHandler().punishOfflinePlayer(name, c, "Ban (Permanent)", reason);
- } else {
- c.sendMessage(name + " has been banned for " + duration + " minute(s).");
- //new PunishmentHandler().punishOfflinePlayer(name, c, "Ban (" + duration + ")", reason);
- }
- } catch (Exception e) {
- c.sendMessage("Correct usage: ::ban-player-duration-reason (0 as duration for permanent)");
- }
- }
- },
- IPBAN(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- try {
- String[] args = input.split("-");
- if (args.length != 2) {
- throw new IllegalArgumentException();
- }
- String name = args[0];
- String reason = args[1];
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c.playerName == c2.playerName) {
- c.sendMessage("You cannot IP Ban yourself.");
- return;
- }
- if (c2.getRights().isBetween(2, 3)) {
- c.sendMessage("You cannot ban this player.");
- return;
- }
- if (!Connection.isIpBanned(c2.connectedFrom)) {
- Connection.addNameToBanList(name, Long.MAX_VALUE);
- Connection.addNameToFile(name, Long.MAX_VALUE);
- Connection.addIpToBanList(c2.connectedFrom);
- Connection.addIpToFile(c2.connectedFrom);
- if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
- MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
- session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- }
- c2.disconnected = true;
- c.sendMessage("You have IP banned the user: " + c2.playerName + " with the host: " + c2.connectedFrom);
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "IP-Ban", reason);
- } else {
- c.sendMessage("This user is already IP Banned.");
- }
- } else {
- c.sendMessage(name + " is not online. Use ::banip instead to IP-Ban an offline player.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::ipban-player-reason");
- }
- }
- },
- FUCKUP(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getRights().isBetween(1, 3)) {
- c.sendMessage("You can't use this command on this player!");
- return;
- }
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Fuckup", "");
- for (int j = 0; j < 250; j++) {
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- c2.getPA().sendFrame126("www.imswinging.com", 12000);
- c2.getPA().sendFrame126("www.sourmath.com", 12000);
- c2.getPA().sendFrame126("www.googlehammer.com", 12000);
- c2.getPA().sendFrame126("www.bmepainolympics2.com", 12000);
- }
- } else {
- c.sendMessage(input + " is not online. You can only fuckup online players.");
- }
- }
- },
- KICK(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- c.sendMessage("The player is in a trade, or duel. You cannot do this at this time.");
- return;
- }
- c2.outStream.createFrame(109);
- CycleEventHandler.getSingleton().stopEvents(c2);
- c2.properLogout = true;
- ConnectedFrom.addConnectedFrom(c2, c2.connectedFrom);
- c.sendMessage("Kicked " + c2.playerName);
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Kick", "");
- } else {
- c.sendMessage(input + " is not online. You can only kick online players.");
- }
- }
- },
- MUTE(helper()) {
- @Override
- public void execute(Player c, String input) {
- if (c.getRights().isAdministrator() && !Config.ADMIN_DROP_ITEMS) {
- c.sendMessage("You're not permitted for this.");
- return;
- }
- try {
- String[] args = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String name = args[0];
- int duration = Integer.parseInt(args[1]);
- long muteEnd = 0;
- if (duration == 0) {
- muteEnd = Long.MAX_VALUE;
- } else {
- muteEnd = System.currentTimeMillis() + duration * 1000 * 60;
- }
- String reason = args[2];
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.muteEnd = muteEnd;
- if (duration == 0) {
- c2.sendMessage("You have been permanently muted by " + c.playerName + " due to rulebreaking.");
- c2.sendMessage("To prevent further mutes please read the rules.");
- c.sendMessage("Successfully permanently " + c2.playerName + " for " + duration + " minutes.");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Mute (Permanent)", reason);
- } else {
- c2.sendMessage("You have been temporarily muted by " + c.playerName + " for " + duration + " minutes");
- c2.sendMessage("To prevent further mutes please read the rules.");
- c.sendMessage("Successfully muted " + c2.playerName + " for " + duration + " minutes.");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Mute (" + duration + ")", reason);
- }
- } else {
- c.sendMessage(name + " is not online. You can only mute online players.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::mute-player-duration-reason.");
- }
- }
- },
- ;
- public String[] additional;
- public Predicate<Player> predicate;
- private Commands(String ... additional) {
- this(all(), additional);
- }
- private Commands(Predicate<Player> rights, String ... additional) {
- this.additional = additional;
- this.predicate = rights;
- }
- public abstract void execute(Player c, String input);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement