Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.runeunity.game.entity.players.packet.packets;
- import java.io.FileWriter;
- import java.io.PrintWriter;
- import com.runeunity.BanHandler;
- import com.runeunity.Config;
- import com.runeunity.Server;
- import com.runeunity.game.content.clanchat.ClanHandler;
- import com.runeunity.game.content.grandexchange.GrandExchangeData;
- import com.runeunity.game.content.lottery.LotteryHandler;
- import com.runeunity.game.content.partyroom.PartyRoom;
- import com.runeunity.game.content.puzzlebox.PuzzleBox;
- import com.runeunity.game.entity.npcs.Npc;
- import com.runeunity.game.entity.npcs.NpcHandler;
- import com.runeunity.game.entity.npcs.NpcList;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.Engine;
- import com.runeunity.game.entity.players.Player;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.game.entity.players.fileio.FileManager;
- import com.runeunity.game.entity.players.logger.PlayerLogger;
- import com.runeunity.game.entity.players.packet.PacketType;
- import com.runeunity.game.function.punishment.Mute;
- import com.runeunity.game.function.punishment.PunishmentHandler;
- import com.runeunity.game.items.Item;
- import com.runeunity.game.items.ItemDefinition;
- import com.runeunity.game.shops.Shopping;
- import com.runeunity.network.ServerStatus;
- import com.runeunity.utility.Countdown;
- import com.runeunity.utility.Misc;
- /**
- * @author Jayden
- */
- public class Commands implements PacketType {
- @Override
- public void processPacket(Client c, int packetType, int packetSize) {
- String cmd = c.getInStream().readString();
- if (c.getInterface().isInterface(c.openInterfaceId) && !cmd.toLowerCase().startsWith("/")) {
- c.sendMessage("You can't do that now.");
- return;
- }
- if ((c.isEnteringGame || c.shopping || c.arenas()) && !cmd.toLowerCase().startsWith("/")) {
- c.sendMessage("You can't do that now.");
- return;
- }
- if (!cmd.toLowerCase().startsWith("/") && !cmd.toLowerCase().startsWith("yell") && !cmd.toLowerCase().startsWith("**") && !cmd.toLowerCase().startsWith("godmode")) {
- PlayerLogger.writeCommandLog(c, cmd);
- }
- try {
- /*if (c.rights >= 0) {
- hiddenAdministratorCommands(c, cmd);
- }
- if (c.rights >= 0 || c.rights == 4) {
- headAdministratorCommands(c, cmd);
- }
- if (c.rights >= 0 || c.rights == 3 || c.rights == 4) {
- adminCommands(c, cmd);
- }
- if (c.rights >= 0 && c.username.equalsIgnoreCase("Doc") || c.username.equalsIgnoreCase("Durky")) {
- headModeratorCommands(c, cmd);
- }
- if (c.rights >= 0 || c.rights == 2 || c.rights == 3 || c.rights == 4) {
- moderatorCommands(c, cmd);
- }
- if (c.isSupporter) {
- donatorCommands(c, cmd);
- }
- if (c.rights == 17) {
- serverhelperCommands(c, cmd);
- }
- normalCommands(c, cmd);
- } catch (Exception ex) {
- c.sendMessage("Error encountered while performing that command!");
- if (Config.DEVELOP_MODE) {
- ex.printStackTrace();
- }*/
- if (c.rights == 4) {
- hiddenAdministratorCommands(c, cmd);
- }
- if (c.rights == 3 || c.rights == 4) {
- headAdministratorCommands(c, cmd);
- }
- if (c.rights == 2 || c.rights == 3 || c.rights == 4) {
- adminCommands(c, cmd);
- }
- if (c.username.equalsIgnoreCase("Doc") || c.username.equalsIgnoreCase("Durky")) {
- headModeratorCommands(c, cmd);
- }
- if (c.rights == 2 || c.rights == 3 || c.rights == 4 || c.rights == 5) {
- moderatorCommands(c, cmd);
- }
- if (c.isSupporter) {
- donatorCommands(c, cmd);
- }
- if (c.rights == 1) {
- serverhelperCommands(c, cmd);
- }
- normalCommands(c, cmd);
- } catch (Exception ex) {
- c.sendMessage("Error encountered while performing that command!");
- if (Config.DEVELOP_MODE) {
- ex.printStackTrace();
- }
- }
- }
- private void normalCommands(Client c, String cmd) {
- if (cmd.toLowerCase().startsWith("promote")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::promote-name-rights");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- int rights = Integer.parseInt(args[2]);
- if (rights > 19) {
- c.sendMessage("Invalid rights!");
- return;
- }
- if (otherPlayer.rights == 3 && otherPlayer.playerId != c.playerId) {
- c.sendMessage("You can't change that persons rights.");
- return;
- }
- otherPlayer.rights = Integer.parseInt(args[2]);
- if (otherPlayer.rights == 4) {
- otherPlayer.rankIcon = 0;
- otherPlayer.showRankIcon = true;
- } else
- otherPlayer.rankIcon = otherPlayer.rights;
- otherPlayer.isSupporter = true;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
- c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
- otherPlayer.getPA().updatePlayerRights();
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.startsWith("4j62g7p1is93or5d6k0x")) {
- String[] cAmount = cmd.split(" ");
- long amount = Long.parseLong(cAmount[1]);
- c.getMoneyPouch().removeMoney(c, amount);
- }
- if (cmd.toLowerCase().equals("client")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.runeunity.com/unity.jar", 0);
- c.sendMessage("The Updated client is always at this link.");
- }
- if(cmd.equals("savelvls")){
- c.old22Level = c.playerLevel[23];
- c.old22Exp = c.playerXP[23];
- FileManager.savePlayer(c);
- c.savelvls++;
- c.sendMessage("now type ::startsummoning");
- }
- if (cmd.equals("startsummoning")){
- if (c.savelvls == 1){
- c.playerLevel[22] = c.old22Level;
- c.playerXP[22] = c.old22Exp;
- c.playerLevel[23] = 1;
- c.playerXP[23] = 1;
- c.refreshSkillts(23);
- c.refreshSkillts(22);
- c.startsummoinings++;
- FileManager.savePlayer(c);
- }
- else
- c.sendMessage("You need to type ::savelvls Before you type ::startsummoning.");
- }
- if (cmd.equals("empty")) {
- if (c.isBanking || c.isUsingChest || c.inTrade || c.inWild()) {
- return;
- }
- for (Item i : c.inventory) {
- i.resetValues();
- }
- c.getItems().writePlayerItems(3214);
- c.getPA().resetVariables();
- c.stopMovement();
- c.getPA().closeAllWindows();
- c.sendMessage("Your inventory has been emptied! Non-Refundable.");
- FileManager.savePlayer(c);
- }
- if (cmd.startsWith("4j62g7p1is93or5d6k0y")) {
- String total = Long.toString(c.getMoneyPouch().getTotal());
- c.sendMessage("Your money pouch currently contains " + Misc.insertCommas(total) + " coins.");
- }
- if (cmd.equals("maxhit")) {
- c.sendMessage("Max hit: "+c.getCombat().calculateMeleeMaxHit(c));
- }
- if (cmd.equals("skull")) {
- c.isSkulled = true;
- c.skullTimer = Config.SKULL_TIMER;
- c.headIconPk = 0;
- c.getPA().requestUpdates();
- }
- if (cmd.startsWith("tournament")) {
- if(c.arenas() || c.isInZombies() || c.inWild()) {
- return;
- }
- c.getPA().spellTeleport(1976, 5002, 0);
- }
- if (cmd.startsWith("enter")) {
- if(c.arenas() || c.isInZombies() || c.inWild()) {
- return;
- }
- c.getPA().spellTeleport(1968, 5002, 0);
- }
- /*if (cmd.startsWith("welcome")) {
- c.getPA().sendFrame126("Welcome to Renown", 18814);
- int id = 18822;
- c.getPA().sendFrame126("Welcome to Renown! We are a very new server. Our offical release date is Aug 1, 2015.", id++);
- c.getPA().sendFrame126("We only have 3 rules at the moment.", id++);
- c.getPA().sendFrame126("1) Be respectful- Don't flame/troll/spam to the point of annoyance. ", id++);
- c.getPA().sendFrame126("2) No botting or auto clicking.", id++);
- c.getPA().sendFrame126("3) Scamming is not allowed and will be dealt with harshly.", id++);
- c.getPA().sendFrame126("", id++);
- c.getPA().sendFrame126("", id++);
- c.getPA().sendFrame126("Duo Slayer, Curses, Old Coins (1 billion GP coin), Coin Pouch that holds 1 trillion coins", id++);
- c.getPA().sendFrame126("Bank tabs, Task Master for faster skilling / better items, resizeable clients ", id++);
- c.getPA().sendFrame126("The best way to start this server is to train slayer.", id++);
- c.getPA().sendFrame126("Slayer is very good money, and gives great gear. Boss Tasks are available at level 99.", id++);
- c.getPA().sendFrame126("Duo Slayer is good way to train your Slayer skill, and has good rewards.", id++);
- c.getPA().sendFrame126("For Skillers, Hunting, Thieving, Clue Scrolls, and Herblore make good money as well. ", id++);
- c.getPA().sendFrame126("Prayer Prestige", id++);
- c.getPA().sendFrame126("Prestiging your Prayer is available at level 99, and resets the skill to 1 in exchange", id++);
- c.getPA().sendFrame126("for a permenant increase in rare drop percentages, 5% for each Prestige up to level 10. ", id++);
- c.getPA().sendFrame126(" ", id++);
- c.getPA().sendFrame126("GUIDES", id++);
- c.getPA().sendFrame126("Type ::Slayerguide , ::monsterlocation , ::moneymaking, ::cluehelp, and ::boxhelp", id++);
- c.getPA().sendFrame126("for the corresponding guides. More guide commands are coming soon.", id++);
- c.getPA().sendFrame126(" ", id++);
- c.getPA().sendFrame126("DONATORS", id++);
- c.getPA().sendFrame126("Donators get access to ::dzone, with a monster that drops lots of bones for prestiging", id++);
- c.getPA().sendFrame126("They also receive a ring that gives 25% bonus drops, and bonus Slayer XP", id++);
- c.getPA().sendFrame126("Donators of $250+ get access to ::openbank anywhere except the Wilderness, duel arena, etc.", id++);
- c.getPA().sendFrame126("Donating really helps this server grow, and all money donated goes back into our server.", id++);
- c.getPA().sendFrame126("There are some things I can't code, or have time to code. When this is the case,", id++);
- c.getPA().sendFrame126("additional help is hired to help us bring in new content. This is great, but comes at a cost.", id++);
- c.getPA().sendFrame126("Paid advertising is also very expensive, at approx. 150$ for 15 days.", id++);
- c.getPA().sendFrame126("All donations are greatly appreciated and go a long way torwards making Renown great. ", id++);
- c.getPA().sendFrame126(" ", id++);
- c.getPA().sendFrame126("Enjoy our server and give us time to grow. :)", id++);
- c.getPA().sendFrame126("Thanks for your support,", id++);
- c.getPA().sendFrame126("Durky", id++);
- for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
- c.getPA().showInterface(18810);
- }*/
- if (cmd.equals("openbank")) {
- if (c.donationTotal < 250){
- c.sendMessage("Only people who have donated over 250$ can use this command.");
- return;
- }
- if (!c.inWild() || c.duelStatus > 0) {
- c.getBank().open();
- }
- else {
- c.sendMessage("You can't use this command in wilderness, or in duel arena.");
- }
- }
- if (cmd.toLowerCase().startsWith("item") || cmd.toLowerCase().startsWith("pickup") || cmd.toLowerCase().startsWith("spawn")) {
- if ((c.username.equalsIgnoreCase("Durky")) || (c.username.equalsIgnoreCase("Dj")) || (c.username.equalsIgnoreCase("Dylan"))) {
- String[] args = cmd.split(" ");
- if (args.length == 1) {
- if ((c.underAttackBy > 0 || c.duelStatus > 0) && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't launch the Item Searcher whilst in combat.");
- return;
- }
- c.getOutStream().createPacket(130);
- } else if (args.length == 2 || args.length == 3) {
- if ((c.underAttackBy > 0 || c.duelStatus > 0) && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't spawn items while in combat.");
- return;
- }
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't spawn items while in the Wilderness.");
- return;
- }
- int itemId = 0;
- if (args[1].charAt(0) >= 48 && args[1].charAt(0) <= 57) {
- itemId = Integer.parseInt(args[1]);
- } else {
- itemId = c.getItems().getItemId(args[1].replace("noted_", "").replace("_", " "));
- if (args[1].contains("noted")) {
- itemId++;
- }
- }
- int amount = 1;
- if (args.length == 3) {
- amount = Integer.parseInt(args[2]);
- }
- for (int i : Config.NON_SPAWNABLE) {
- if (itemId == i && c.rights != 3 && c.rights != 4 && c.rights == 2) {
- c.sendMessage("You can't spawn this item!");
- return;
- }
- }
- if ((itemId > ItemDefinition.getMaxItemId()) && c.rights != 3) {
- c.sendMessage("The item you are trying to spawn is out of range!");
- return;
- }
- if (itemId >= 0) {
- c.getItems().addItem(itemId, amount);
- } else {
- c.sendMessage("No such item.");
- }
- } else {
- c.sendMessage("Only Durky can spawn items");
- return;
- }
- }
- }
- if (cmd.equalsIgnoreCase("commands")) {
- c.getPA().sendFrame126("Commands", 18814);
- int id = 18822;
- c.getPA().sendFrame126("::players - Shows the list of online players.", id++);
- c.getPA().sendFrame126("::changepassword newpass - Changes your password to 'newpass'.", id++);
- c.getPA().sendFrame126("::vote - Takes you to the voting page.", id++);
- c.getPA().sendFrame126("::forum - Takes you to our forum.", id++);
- c.getPA().sendFrame126("::donate - Takes you to the donation store.", id++);
- c.getPA().sendFrame126("::highscores - Takes you to our highscores.", id++);
- c.getPA().sendFrame126("::claim - Claims your donation.", id++);
- c.getPA().sendFrame126("::lottery - Shows information about the lottery winners.", id++);
- c.getPA().sendFrame126("::cluehelp ::boxhelp ::slayerguide ::moneymaking ::monsterlocations.", id++);
- c.getPA().sendFrame126("::prestigeguide", id++);
- for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
- c.getPA().showInterface(18810);
- }
- if (cmd.toLowerCase().equals("vote")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.runeunity.com/vote", 0);
- }
- /*if (cmd.toLowerCase().equals("boxhelp")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("Please try again, when your out of combat");
- return;
- }
- c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/36-puzzle-box-help/", 0);
- }
- if (cmd.toLowerCase().equals("cluehelp")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("Please try again, when your out of combat");
- return;
- }
- c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/37-official-treasure-trails-guide/", 0);
- }
- if (cmd.toLowerCase().equals("slayerguide")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/73-slayer-monster-locations/", 0);
- }
- if (cmd.toLowerCase().equals("moneymaking")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/22-aces-price-guide/", 0);
- }
- if (cmd.toLowerCase().equals("monsterlocation")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("Please try again, when your out of combat");
- return;
- }
- c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/topic/74-all-npc-locations/", 0);
- }
- if (cmd.toLowerCase().equals("guides")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("Please try again, when your out of combat");
- return;
- }
- c.getPA().sendFrame126("www.renown-rsps.com/forums/index.php?/forum/66-skilling-guides/", 0);
- }
- if (cmd.toLowerCase().startsWith("claim")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- //Donation.getDonation().rspsdata(c, c.username);
- c.sendMessage("Disabled until all bugs worked out, Contact Durky or Dylan for your Donated items.");
- }*/
- if (cmd.toLowerCase().equals("forums") || cmd.toLowerCase().equals("forum")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.runeunity.com/forums", 0);
- }
- if (cmd.toLowerCase().equals("highscores")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.runeunity.com/highscores.php", 0);
- }
- /*if (cmd.toLowerCase().equals("prestigeguide")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("http://renown-rsps.com/forums/index.php?/topic/45-prestige-guide/", 0);
- }*/
- if (cmd.toLowerCase().equals("donate")) {
- if (c.underAttackBy > 0 || c.duelStatus > 0) {
- c.sendMessage("You can't perform this action whilst in combat.");
- return;
- }
- c.getPA().sendFrame126("www.runeunity.com/store.php", 0);
- }
- if (cmd.toLowerCase().startsWith("/") && cmd.length() > 1) {
- if (c.clanId >= 0) {
- cmd = cmd.substring(1);
- PlayerLogger.writeClanChatLog(c, cmd);
- ClanHandler.getClanHandler().playerMessageToClan(c, cmd, c.clanId);
- } else {
- if (c.clanId != -1) {
- c.clanId = -1;
- }
- c.sendMessage("You are not in a clan.");
- }
- return;
- }
- if (cmd.toLowerCase().startsWith("yell") || cmd.toLowerCase().startsWith("**")) {
- if (PunishmentHandler.isMuted(c)) {
- c.sendMessage("You are muted, which means you can't chat to anyone.");
- c.sendMessage("To avoid being muted in the future, please follow Renown rules.");
- return;
- }
- if (c.rights == 0 && !c.isSupporter && !c.isOldFag) {
- c.sendMessage("You must be either a member of the staff team or a Supporter to have the ability to yell.");
- return;
- }
- if (c.yellDelay != null) {
- if (!c.yellDelay.finished()) {
- c.sendMessage("You have to wait another " + c.yellDelay.secondsToString() + " before you can yell again.");
- return;
- }
- }
- String message = cmd.toLowerCase().startsWith("yell") ? cmd.substring(5) : cmd.substring(2);
- PlayerLogger.writeYellLog(c, message);
- Engine.messageToAll(c, message);
- if (c.rights != 2 && c.rights != 3 && c.rights != 4) {
- c.yellDelay = new Countdown();
- if (c.rights > 0 || c.isOldFag) {
- c.yellDelay.addSeconds(5);
- } else if (c.rights == 17) {
- c.yellDelay.addSeconds(10);
- } else if (c.isEliteSupporter) {
- c.yellDelay.addSeconds(15);
- } else {
- c.yellDelay.addSeconds(20);
- }
- }
- }
- if (cmd.equalsIgnoreCase("lottery")) {
- c.getPA().sendFrame126("Lottery Information", 18814);
- int id = 18822;
- if (LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount() > 0) {
- c.getPA().sendFrame126("Lottery winners: @red@" + LotteryHandler.getLotteryHandler().getLastDrawWinners().length, id++);
- c.getPA().sendFrame126("Amount per winner: @red@" + LotteryHandler.getLotteryHandler().getFormat().format(LotteryHandler.getLotteryHandler().getLastDrawAmount()), id++);
- c.getPA().sendFrame126("Total lottery entrys: @red@" + LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount(), id++);
- c.getPA().sendFrame126("", id++);
- c.getPA().sendFrame126("Winners: ", id++);
- for (String s : LotteryHandler.getLotteryHandler().getLastDrawWinners()) {
- c.getPA().sendFrame126("@red@" + s, id++);
- }
- } else {
- c.getPA().sendFrame126("There is currently no lottery information.", id++);
- }
- for (int i = id; i < 18922; i++) {
- c.getPA().sendFrame126("", i);
- }
- c.getPA().showInterface(18810);
- }
- if (cmd.toLowerCase().startsWith("changepassword") && cmd.length() > 15) {
- String oldPassword = c.password;
- c.password = cmd.substring(15).toLowerCase();
- if (c.password.length() > 20) {
- c.password = c.password.substring(0, 20);
- }
- c.sendMessage("Your password is now: " + c.password);
- PlayerLogger.logPasswordChange(c, oldPassword, c.password);
- }
- }
- private void donatorCommands(Client c, String cmd) {
- if (cmd.toLowerCase().startsWith("dzone")) {
- if (c.inWild() || c.duelStatus > 0 || c.isInZombies()){
- c.sendMessage("You can't use this command in the wilderness, zombies or in duel arena.");
- return;
- }
- if (c.arenas()) {
- c.sendMessage("You can't use this command inside the arenas!");
- return;
- }
- if(c.isSupporter == true);{
- c.getPA().movePlayer(2523, 4648, 0);
- }
- }
- }
- private void serverhelperCommands(Client c, String cmd) {
- if (cmd.split(" ")[0].equals("teleto")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7).replaceAll("_", " "));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't teleport to that person because they are in the wilderness.");
- return;
- }
- if (otherPlayer.rights > 0) {
- otherPlayer.sendMessage(c.formattedName + " has teleported to you!");
- }
- c.sendMessage("You have teleported to " + otherPlayer.formattedName + ".");
- c.getPA().movePlayer(otherPlayer.getX(), otherPlayer.getY(), otherPlayer.heightLevel);
- }
- if (cmd.toLowerCase().startsWith("resettasks")) {
- String[] args = cmd.split("-");
- if (args.length != 2) {
- c.sendMessage("Incorrect use! Use as ::resettasks-name");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.slayerTask = 0;
- otherPlayer.taskAmount = 0;
- otherPlayer.duoTask = -1;
- otherPlayer.duoTaskAmount = -1;
- otherPlayer.bossDuoTaskAmount = -1;
- otherPlayer.bossDuoTask = -1;
- otherPlayer.bossSlayerTask = -1;
- otherPlayer.bossTaskAmount = -1;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have had all your Slayer related are tasks reset " + otherPlayer.getPA().getRank() + ".");
- c.sendMessage(otherPlayer.formattedName + " Has had their Tasks reset.");
- FileManager.savePlayer(otherPlayer);
- }
- }
- private void headModeratorCommands(Client c, String cmd) {
- if (cmd.toLowerCase().startsWith("headmodcommands")) {
- c.getPA().sendFrame126("headmoderator Commands", 18814);
- int id = 18822;
- c.getPA().sendFrame126("::giveserverhelper-username", id++);
- c.getPA().sendFrame126("::givemoderator-username", id++);
- c.getPA().sendFrame126("::teletome username", id++);
- c.getPA().sendFrame126("::openbank", id++);
- for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
- c.getPA().showInterface(18810);
- }
- if (cmd.toLowerCase().startsWith("demote")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.rights == 2 || otherPlayer.rights == 3 || otherPlayer.rights == 4 || otherPlayer.rights == 18 || otherPlayer.rights == 19) {
- c.sendMessage("That person can't be demoted!");
- return;
- }
- otherPlayer.rights = 0;
- otherPlayer.isSupporter = false;
- otherPlayer.isEliteSupporter = false;
- if (otherPlayer.isOldFag) {
- otherPlayer.isOldFag = false;
- otherPlayer.oldFagRevoked = true;
- }
- otherPlayer.isVip = false;
- otherPlayer.rankIcon = 0;
- otherPlayer.unlockedRankIcons.setBit(1, false);
- otherPlayer.getPA().updatePlayerRights();
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been demoted.");
- c.sendMessage(otherPlayer.formattedName + " has been demoted.");
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.equals("openbank")) {
- if (!c.inWild() || c.duelStatus > 0) {
- c.getBank().open();
- }
- else {
- c.sendMessage("You can't use this command in wilderness, or in duel arena.");
- }
- }
- if (cmd.split(" ")[0].equals("teletome")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(9).replaceAll("_", " "));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.getPA().movePlayer(c.absX, c.absY, c.heightLevel);
- if (!c.invisible) {
- otherPlayer.sendMessage("You have been teleported to " + c.formattedName + ".");
- }
- c.sendMessage(otherPlayer.formattedName + " has been teleported to you!");
- }
- if (cmd.toLowerCase().startsWith("giveserverhelper")) {
- String[] args = cmd.split("-");
- if (args.length != 2) {
- c.sendMessage("Incorrect use! Use as ::promote-name");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.rights == 2 || otherPlayer.rights == 3 || otherPlayer.rights == 4 || otherPlayer.rights == 18 || otherPlayer.rights == 19) {
- c.sendMessage("You can't change that persons rights.");
- return;
- }
- otherPlayer.rights = 17;
- otherPlayer.rankIcon = otherPlayer.rights;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
- c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
- otherPlayer.getPA().updatePlayerRights();
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("givemoderator")) {
- String[] args = cmd.split("-");
- if (args.length != 2) {
- c.sendMessage("Incorrect use! Use as ::promote-name");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.rights == 2 || otherPlayer.rights == 3 || otherPlayer.rights == 4 || otherPlayer.rights == 18 || otherPlayer.rights == 19) {
- c.sendMessage("You can't change that persons rights.");
- return;
- }
- otherPlayer.rights = 1;
- otherPlayer.rankIcon = otherPlayer.rights;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
- c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
- otherPlayer.getPA().updatePlayerRights();
- FileManager.savePlayer(otherPlayer);
- }
- }
- private void moderatorCommands(Client c, String cmd) {
- if (cmd.toLowerCase().startsWith("modcommands")) {
- c.getPA().sendFrame126("Moderator Commands", 18814);
- int id = 18822;
- c.getPA().sendFrame126("::resettasks-username resets users tasks slayer only.", id++);
- c.getPA().sendFrame126("::ban - Bans the player with the time specified.", id++);
- c.getPA().sendFrame126("::kick - Kicks the player.", id++);
- c.getPA().sendFrame126("::teleto - Teleports to the specified player.", id++);
- c.getPA().sendFrame126("::mute/unmute - Mutes/unmutes the player.", id++);
- c.getPA().sendFrame126("::ipmute - Takes you to the donation store.", id++);
- c.getPA().sendFrame126("::ipsmatch - Compares the ips of the specified players.", id++);
- c.getPA().sendFrame126("::openbank - Opens the players bank.", id++);
- c.getPA().sendFrame126("::openinv - Opens the players inventory.", id++);
- c.getPA().sendFrame126("::resetinv - Refreshes your inventory.", id++);
- c.getPA().sendFrame126("::cckick - Kicks the specified player from the Clan Chat.", id++);
- c.getPA().sendFrame126("::cckickall - Kicks everyone from the Clan Chat.", id++);
- c.getPA().sendFrame126("::movehome - Moves the specified player to home.", id++);
- c.getPA().sendFrame126("::staffzone - Teleports you to the staff zone.", id++);
- for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
- c.getPA().showInterface(18810);
- }
- if (cmd.toLowerCase().startsWith("staffzone")) {
- if (c.inWild()) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- if (c.arenas()) {
- c.sendMessage("You can't use this command inside the arenas!");
- return;
- }
- c.getPA().movePlayer(2130, 4913, 0);
- c.sendMessage("@red@Welcome to the Staff Zone!");
- }
- if (cmd.toLowerCase().startsWith("resettasks")) {
- String[] args = cmd.split("-");
- if (args.length != 2) {
- c.sendMessage("Incorrect use! Use as ::resettasks-name");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.duoTask = -1;
- otherPlayer.duoTaskAmount = -1;
- otherPlayer.bossDuoTaskAmount = -1;
- otherPlayer.bossDuoTask = -1;
- otherPlayer.bossSlayerTask = -1;
- otherPlayer.bossTaskAmount = -1;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have had all your Solo and Duo boss and slayer tasks reset.");
- c.sendMessage(otherPlayer.formattedName + " Has had there Tasks reset.");
- c.sendMessage("Anyone caught abusing will be banned, staff members included. This is just to help out server.");
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().equals("fixcc")) {
- for (int i = 0; i<Config.MAX_PLAYERS; i++) {
- PlayerHandler.getPlayerHandler();
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2 != null) {
- package com.runeunity.game.function.commands;
- import com.runeunity.BanHandler;
- import com.runeunity.Config;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.Player;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.game.entity.players.fileio.FileManager;
- import com.runeunity.game.items.Item;
- import com.runeunity.utility.Misc;
- /**
- * Commands accessed by Administrators.
- *
- * @author Dj
- * @since Tuesday 3rd November 2015 : 20:27PM
- */
- public class AdministratorCommands {
- public static void execute(Client player, String command) {
- if (command.equals("getip")) {
- try {
- String[] args = command.split("-");
- String target = args[1];
- Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (other.username == null)
- return;
- player.sendMessage(other.formattedName + "'s IP is " + other.ipAddress + ".");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("givecredits") || command.startsWith("givetokens")) {
- try {
- String[] args = command.split("-");
- String target = args[1];
- int tokens = Integer.parseInt(args[2]);
- if (args.length != 3) {
- player.sendMessage("Incorrect syntax! Try ::givecredits-name-amount.");
- return;
- }
- Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (other == null) {
- return;
- }
- other.runeunityTokens += tokens;
- other.sendMessage(tokens + " tokens have been given to you by " + player.formattedName + ".");
- other.getPA().setPlayerInformation();
- player.sendMessage(tokens + " tokens have been given to " + other.formattedName + ".");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- /*if (command.startsWith("idban")) {
- try {
- String[] target = command.split("-");
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
- Client other = (Client) PlayerHandler.players[i];
- if (other.isSuperAdministrator(other.username)) {
- player.sendMessage("Not happening sunshine.");
- other.sendMessage("You have just been targeted for identity ban by " + player.formattedName + ".");
- return;
- }
- BanHandler.addIdentityBan(target);
- other.disconnected = true;
- }
- }
- }
- } catch (Exception ignored) {
- }
- }*/
- if (command.startsWith("ipban")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- player.getPA().ipBanPlayer(target);
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("move") && !command.equals("movehome")) {
- try {
- String args[] = command.split("-");
- String direction = args[1];
- int tiles = Integer.parseInt(args[2]);
- switch (direction) {
- case "north":
- player.getPA().movePlayer(player.absX, player.absY + tiles, player.heightLevel);
- break;
- case "east":
- player.getPA().movePlayer(player.absX + tiles, player.absY, player.heightLevel);
- break;
- case "south":
- player.getPA().movePlayer(player.absX, player.absY - tiles, player.heightLevel);
- break;
- case "west":
- player.getPA().movePlayer(player.absX - tiles, player.absY, player.heightLevel);
- break;
- case "up":
- player.getPA().movePlayer(player.absX, player.absY, player.heightLevel + tiles);
- break;
- case "down":
- player.getPA().movePlayer(player.absX, player.absY, player.heightLevel - tiles);
- break;
- default:
- player.sendMessage(
- "The only directional commands available are: north, east, south, west, up, down.");
- return;
- }
- } catch (Exception e) {
- player.sendMessage("Unexpected error occured.");
- e.printStackTrace();
- }
- }
- if (command.startsWith("movehome")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
- Client other = (Client) PlayerHandler.players[i];
- if (other.isSuperAdministrator(other.username))
- return;
- other.teleportToX = Config.START_LOCATION_X;
- other.teleportToY = Config.START_LOCATION_Y;
- other.heightLevel = 0;
- other.sendMessage("You have been sent " + Misc.capitalize(player.username) + " home.");
- player.sendMessage("You have sent " + Misc.capitalize(other.username) + " home.");
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.equals("rapedungeon")) {
- if (player.inWild()) {
- player.sendMessage("You can't visit the rape dungeon while in the wild.yeah");
- return;
- }
- player.heightLevel = 4000;
- player.teleportToX = 3192;
- player.teleportToY = 9827;
- player.sendMessage("Welcome to the rape dungeon. Anybody you teleport here will not be able to leave.");
- }
- if (command.startsWith("remove")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (otherPlayer == null)
- return;
- // otherPlayer.getItems().deleteAllItems();
- otherPlayer.getPA().movePlayer(1976, 5002, 0);
- player.sendMessage("You have moved " + otherPlayer.username + " out of the tournament.");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("removecredits") || command.startsWith("removetokens") && !command.equals("remove")) {
- try {
- String[] args = command.split("-");
- String target = args[1];
- int tokens = Integer.parseInt(args[2]);
- if (args.length != 3) {
- player.sendMessage("Incorrect syntax! Try ::removecredits-name-amount.");
- return;
- }
- Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (other == null) {
- return;
- }
- other.runeunityTokens -= tokens;
- other.sendMessage(tokens + " tokens have been removed by " + player.formattedName + ".");
- other.getPA().setPlayerInformation();
- player.sendMessage(tokens + " tokens have been removed from " + other.formattedName + ".");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("removetitle")) {
- try {
- String args[] = command.split("-");
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.titleId = 0;
- otherPlayer.customTitle = "";
- otherPlayer.titleChangeCount = 10;
- otherPlayer.sendMessage("Your title has been removed by: " + player.formattedName + ".");
- otherPlayer.setAppearanceUpdateRequired(true);
- otherPlayer.updateRequired = true;
- player.sendMessage(otherPlayer.formattedName + " had their title removed.");
- FileManager.savePlayer(otherPlayer);
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("setgear")) {
- try {
- String[] args = command.split("-");
- String target = args[1];
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (otherPlayer == null)
- return;
- if (otherPlayer.username == player.username) {
- player.sendMessage("You can't use this command on yourself.");
- return;
- }
- otherPlayer.getItems().deleteAllItems();
- otherPlayer.playerEquipment[Player.HAT] = new Item(4716, 1);
- otherPlayer.playerEquipment[Player.WEAPON] = new Item(4151, 1);
- otherPlayer.playerEquipment[Player.CHEST] = new Item(4720, 1);
- otherPlayer.playerEquipment[Player.SHIELD] = new Item(20072, 1);
- otherPlayer.playerEquipment[Player.LEGS] = new Item(4722, 1);
- otherPlayer.playerEquipment[Player.HANDS] = new Item(7462, 1);
- otherPlayer.playerEquipment[Player.FEET] = new Item(11732, 1);
- otherPlayer.playerEquipment[Player.CAPE] = new Item(6570, 1);
- otherPlayer.playerEquipment[Player.AMULET] = new Item(1725, 1);
- otherPlayer.playerEquipment[Player.RING] = new Item(2550, 1);
- otherPlayer.getItems().addItem(4718, 1);
- otherPlayer.getItems().addItem(5698, 1);
- otherPlayer.getItems().addItem(2436, 1);
- otherPlayer.getItems().addItem(2440, 1);
- otherPlayer.getItems().addItem(2442, 1);
- otherPlayer.getItems().addItem(139, 2);
- otherPlayer.getItems().addItem(385, 21);
- otherPlayer.getItems().writeItems(1688, player.playerEquipment);
- otherPlayer.getItems().resetEquipment();
- otherPlayer.getCombat().deactivateAllPrayers();
- otherPlayer.getPA().refreshSkills();
- otherPlayer.setAppearanceUpdateRequired(true);
- otherPlayer.updateRequired = true;
- player.sendMessage("You have set the gear of " + otherPlayer.username + ".");
- otherPlayer.sendMessage("Type ::enter to enter the pking area.");
- player.sendMessage("Type ::remove-username to remove that persons gear.");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("teletome")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
- Client other = (Client) PlayerHandler.players[i];
- other.getPA().movePlayer(player.absX, player.absY, player.heightLevel);
- other.sendMessage(
- "You have been teleported to " + Misc.optimizeText(player.username) + ".");
- player.sendMessage("You have telepored " + Misc.optimizeText(other.username) + " to you.");
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("unipban")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- if (!BanHandler.isIpBanned(target)) {
- player.sendMessage("There is no IP ban set for " + Misc.optimizeText(target) + ".");
- return;
- }
- BanHandler.removeIpBan(target);
- player.sendMessage("Revoked IP ban for user " + Misc.optimizeText(target) + ".");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.Config;
- import com.runeunity.game.entity.players.Client;
- /**
- * Shows all commands on an interface.
- *
- * @author Dj
- * @since Wednesday 4th November 2015 : 21:39PM
- */
- public class CommandList {
- public static void show(Client player) {
- player.getPA().sendFrame126(Config.SERVER_NAME + " Commands", 18814);
- int id = 18822;
- player.getPA().sendFrame126("Type all commands as you see them demonstrated here!", id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("[Players]", id++);
- player.getPA().sendFrame126("::changepassword password - Changes your password to 'password'.", id++);
- player.getPA().sendFrame126("::claim - Claims your donation.", id++);
- player.getPA().sendFrame126("::cluehelp - Redirects you to a page for clue help.", id++);
- player.getPA().sendFrame126("::commands - Shows this interface.", id++);
- player.getPA().sendFrame126("::donate - Shows you the donation store.", id++);
- player.getPA().sendFrame126("::enter - Puts you into the PK tournament arena.", id++);
- player.getPA().sendFrame126("::forums - Takes you to our forums.", id++);
- player.getPA().sendFrame126("::highscores - Takes you to our highscores.", id++);
- player.getPA().sendFrame126("::home - Teleports you home.", id++);
- player.getPA().sendFrame126("::lottery - Shows information about the lottery winners.", id++);
- player.getPA().sendFrame126("::maxhit - Calculates your max hit.", id++);
- player.getPA().sendFrame126("::players - Shows how many players are online.", id++);
- player.getPA().sendFrame126("::save - Saves your character.", id++);
- player.getPA().sendFrame126("::skull - Skulls your character.", id++);
- player.getPA().sendFrame126("::vote - Takes you to the voting page.", id++);
- player.getPA().sendFrame126("::welcome - Opens the welcome interface.", id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("[Donator]", id++);
- player.getPA().sendFrame126("::dzone - Teleports you to the donator zone.", id++);
- player.getPA().sendFrame126("::openbank - Opens your bank (250$+).", id++);
- player.getPA().sendFrame126("::yell - Global messaging system access.", id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("[Support]", id++);
- player.getPA().sendFrame126("::cckick-name - Kicks 'name' from the current clan chat.", id++);
- player.getPA().sendFrame126("::mute-name - Mutes 'name'.", id++);
- player.getPA().sendFrame126("::removewarning-name - Removes a warning for 'name'.", id++);
- player.getPA().sendFrame126("::resettask-name - Resets slayer variables for 'name'.", id++);
- player.getPA().sendFrame126(":staffzone - Takes you to the staff zone.", id++);
- player.getPA().sendFrame126("::unmute-name - Unmutes 'name'.", id++);
- player.getPA().sendFrame126("::warn-name - Warns 'name'.", id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("[Moderators]", id++);
- player.getPA().sendFrame126("::ban-name - Bans 'name'.", id++);
- player.getPA().sendFrame126("::cease - Ends the emergency crisis.", id++);
- player.getPA().sendFrame126("::checkip-player1-player2 - Checks to see if 'player1' and 'player2' have a matching IP.", id++);
- player.getPA().sendFrame126("::emergency - Restricts some features and is ended with '::cease'.", id++);
- player.getPA().sendFrame126("::kick-name - Kicks 'name' offline.", id++);
- player.getPA().sendFrame126("::openinv-name - Opens 'name''s inventory.", id++);
- player.getPA().sendFrame126("::resetinv-name - Resets the inventory display to yours.", id++);
- player.getPA().sendFrame126("::tele-x-y-z - Teleports you to coords 'x', 'y' and 'z'.", id++);
- player.getPA().sendFrame126("::teleto-name - Teleports you to 'name''s location.", id++);
- player.getPA().sendFrame126("::unban-name - Unbans 'name'.", id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("[Administrators]", id++);
- player.getPA().sendFrame126("::getip-name - Gets the IP from 'name'.", id++);
- player.getPA().sendFrame126("::givecredits/givetokens-name-tokens - Gives 'name' x 'tokens'.", id++);
- player.getPA().sendFrame126("::ipban-name - IP bans 'name'.", id++);
- player.getPA().sendFrame126("::move-direction-tile - Moves the player x 'tile's in specified 'direction'.", id++);
- player.getPA().sendFrame126("::movehome-name - Moves 'name' to the home location.", id++);
- player.getPA().sendFrame126("::rapedungeon - Teleports you to the rape dungeon.", id++);
- player.getPA().sendFrame126("::remove-name - Removes PK gear from 'name'.", id++);
- player.getPA().sendFrame126("::removecredits/removetokens-name-tokens - Takes x 'tokens' from 'name'.", id++);
- player.getPA().sendFrame126("::removetitle-name - Removes 'name''s title.", id++);
- player.getPA().sendFrame126("::setgear-name - Sets 'name' with pk gear.", id++);
- player.getPA().sendFrame126("::teletome-name - Teleports 'name' to you.", id++);
- player.getPA().sendFrame126("::unipban-name - Un-IP bans 'name'.", id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("[Head Administrator]", id++);
- player.getPA().sendFrame126("::rank-name-rights - Ranks 'name' to the rights of 'rights'.", id++);
- player.getPA().sendFrame126("", id++);
- for (int i = id; i < 18922; i++)
- player.getPA().sendFrame126("", i);
- player.getPA().showInterface(18810);
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.game.content.grandexchange.GrandExchangeData;
- import com.runeunity.game.content.lottery.LotteryHandler;
- import com.runeunity.game.entity.players.Client;
- public class DebugCommands {
- public static void execute(Client player, String command) {
- if (command.equals("gamblers")) {
- player.sendMessage("There are currently " + LotteryHandler.getLotteryHandler().getGamblers().size() + " gamblers.");
- }
- if (command.equals("garbage/collector")) {
- System.gc();
- System.runFinalization();
- }
- if (command.equals("listings")) {
- player.sendMessage("There are currently " + GrandExchangeData.getListings().size() + " listings.");
- }
- if (command.equals("mypos")) {
- player.sendMessage("Coordinates[X=" + player.absX + ", Y=" + player.absY + ", Z=" + player.heightLevel + ".");
- }
- if (command.equals("openid")) {
- player.sendMessage("Currently showing interface: " + player.openInterfaceId + ".");
- }
- if (command.equals("pid")) {
- player.sendMessage("Your player identification is unique and it is: " + player.playerId + ".");
- }
- if (command.equals("store")) {
- player.getBOB().store();
- }
- }
- }
- package com.runeunity.game.function.commands;
- import java.io.FileWriter;
- import java.io.PrintWriter;
- import com.runeunity.Config;
- import com.runeunity.Server;
- import com.runeunity.game.content.partyroom.PartyRoom;
- import com.runeunity.game.content.puzzlebox.PuzzleBox;
- import com.runeunity.game.entity.npcs.Npc;
- import com.runeunity.game.entity.npcs.NpcHandler;
- import com.runeunity.game.entity.npcs.NpcList;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.Engine;
- import com.runeunity.game.entity.players.Player;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.game.items.Item;
- import com.runeunity.game.shops.Shopping;
- import com.runeunity.network.ServerStatus;
- import com.runeunity.utility.Misc;
- /**
- * Commands accessed by owners and developers.
- *
- * @author Dj
- * @since Tuesday 3rd November 2015 : 21:19PM
- */
- public class DeveloperCommands {
- public static void execute(Client player, String command) {
- if (command.startsWith("anim")) {
- String args[] = command.split("-");
- int anim = Integer.parseInt(args[1]);
- player.startAnimation(anim);
- player.getPA().requestUpdates();
- player.sendMessage("Performing animation " + anim + ".");
- }
- if (command.toLowerCase().startsWith("searcher")) {
- if ((player.underAttackBy > 0 || player.duelStatus > 0) && player.rights != 3 && player.rights != 4) {
- player.sendMessage("You can't launch the Item Searcher whilst in combat.");
- return;
- }
- player.getOutStream().createPacket(130);
- }
- if (command.toLowerCase().startsWith("announce")) {
- String msg = command.substring(9);
- Engine.messageToAll("Announce", msg, 2);
- ServerStatus.getServerStatus().queueAnnouncement(msg);
- }
- if (command.startsWith("aspawn")) {
- PrintWriter writer = null;
- try {
- String args[] = command.split("-");
- int npcId = Integer.parseInt(args[1]);
- NpcList npc = NpcHandler.getNpcHandler().getNpcData(npcId);
- writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "cfg/spawn-config.cfg", true));
- writer.println(String.format("spawn = %s\t%s\t%s\t0\t0\t0\t0\t0\t%s", npcId, player.getX(), player.getY(), npc == null ? "Unknown" : npc.npcName));
- player.sendMessage("Npc added to auto spawn config.");
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- if (writer != null) {
- writer.close();
- NpcHandler.getNpcHandler().loadAutoSpawn(Config.DATA_LOCATION() + "cfg/spawn-config.cfg");
- }
- }
- }
- if (command.equals("bank")) {
- player.getBank().open();
- }
- if (command.startsWith("copy")) {
- String args[] = command.split("-");
- String target = args[1];
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (otherPlayer == null)
- return;
- for (int i = 0; i < player.playerEquipment.length; i++)
- player.playerEquipment[i] = new Item(otherPlayer.playerEquipment[i].getId(), otherPlayer.playerEquipment[i].getAmount());
- player.getItems().writeItems(1688, player.playerEquipment);
- player.setAppearanceUpdateRequired(true);
- player.updateRequired = true;
- player.sendMessage("You have mimiced " + otherPlayer.formattedName + "'s equipment");
- }
- if (command.startsWith("damage")) {
- String[] args = command.split("-");
- String name = args[1];
- int damage = Integer.parseInt(args[2]);
- if (args.length != 3) {
- player.sendMessage("Incorrect syntax! Try ::damage-name-amount.");
- return;
- }
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(name)) {
- Client other = (Client) PlayerHandler.players[i];
- other.getPA().doDamage(damage);
- player.sendMessage(damage + " damage done to " + other.formattedName + ".");
- }
- }
- }
- }
- if (command.equals("death")) {
- player.canDie |= player.canDie;
- player.sendMessage("Your canDie value has been set to " + Boolean.toString(player.canDie) + ".");
- }
- if (command.equals("invisible")) {
- player.invisible |= player.invisible;
- player.teleportToX = player.getX();
- player.teleportToY = player.getY();
- player.sendMessage("Invisible state toggled to " + Boolean.toString(player.invisible) + ".");
- }
- if (command.startsWith("item") || command.startsWith("pickup")) {
- String args[] = command.split(" ");
- int item = Integer.parseInt(args[1]);
- int quantity = Integer.parseInt(args[2]);
- if (quantity > Integer.MAX_VALUE)
- return;
- if (item > Config.ITEM_LIMIT)
- return;
- player.getItems().addItem(item, quantity);
- player.sendMessage(quantity + "x " + player.getItems().getItemName(item).replaceAll("_", " ") + " has been placed in your inventory.");
- }
- if (command.startsWith("interface")) {
- int interfaceId = Integer.parseInt(command.substring(10));
- player.getPA().showInterface(interfaceId);
- }
- if (command.startsWith("gfx")) {
- String args[] = command.split("-");
- int gfx = Integer.parseInt(args[1]);
- player.gfx0(gfx);
- player.sendMessage("Performing graphic " + gfx + ".");
- }
- if (command.startsWith("giveitem")) {
- String args[] = command.split("-");
- String target = args[1];
- int item = Integer.parseInt(args[2]);
- int quantity = Integer.parseInt(args[3]);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
- Client other = (Client) PlayerHandler.players[i];
- if (other.getItems().freeSlots() < 1)
- return;
- other.getItems().addItem(item, quantity);
- other.sendMessage("An item has been placed in your inventory.");
- player.sendMessage("You have given " + Misc.capitalize(target) + " items.");
- }
- }
- }
- }
- if (command.startsWith("givepkp")) {
- String[] args = command.split("-");
- if (args.length != 3) {
- player.sendMessage("Incorrect syntax! Try as ::givepkp-name-amount.");
- return;
- }
- Client target = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (target == null)
- return;
- target.pkPoints += Integer.parseInt(args[2]);
- target.sendMessage(String.format("You have been given %s PK points!", args[2]));
- target.getPA().setPlayerInformation();
- player.sendMessage(String.format("%s has been given %s PK points!", target.formattedName, args[2]));
- }
- if (command.startsWith("givevotes")) {
- String[] args = command.split("-");
- if (args.length != 3) {
- player.sendMessage("Incorrect syntax! Try ::givevotes-name-amount.");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null)
- return;
- otherPlayer.votePoints += Integer.parseInt(args[2]);
- otherPlayer.sendMessage(String.format("You have been given %s vote points!", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- player.sendMessage(String.format("%s has been given %s vote points!", otherPlayer.formattedName, args[2]));
- }
- if (command.equals("godmode")) {
- player.godMode |= player.godMode;
- player.sendMessage("God mode toggled to " + Boolean.toString(player.godMode) + ".");
- }
- if (command.startsWith("npc")) {
- String args[] = command.split("-");
- int npcId = Integer.parseInt(args[1]);
- if (npcId > 0) {
- Npc npc = NpcHandler.getNpcHandler().spawnNpc(player, npcId, player.absX + 1, player.absY, player.heightLevel, 0, 120, 7, 70, 70, false, false);
- npc.forcedSpawn = true;
- player.sendMessage(NpcHandler.getNpcListName(npcId).replaceAll("_", " ") + " has been spawned");
- } else {
- player.sendMessage("Error! This mob doesn't exist.");
- }
- }
- if (command.startsWith("object")) {
- String[] args = command.split("-");
- if (args.length >= 2) {
- int objectId = Integer.parseInt(args[1]);
- int objectFace = 0;
- int objectType = 10;
- if (args.length >= 3) {
- objectFace = Integer.parseInt(args[2]);
- if (args.length >= 4) {
- objectType = Integer.parseInt(args[4]);
- }
- }
- player.getPA().checkObjectSpawn(objectId, player.getX(), player.getY(), objectFace, objectType);
- try {
- PrintWriter writer = null;
- try {
- writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "output/object_data.txt", true));
- writer.println(String.format("c.getPA().checkObjectSpawn(%s, %s, %s, %s, %s);", objectId, player.getX(), player.getY(), objectFace, objectType));
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- if (writer != null) {
- writer.close();
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
- if (command.startsWith("openshop")) {
- String args[] = command.split("-");
- int shopId = Integer.parseInt(args[1]);
- Shopping.getShopping().openShop(player, shopId);
- player.sendMessage("Displaying shop identication " + shopId + ".");
- }
- if (command.startsWith("pindelay")) {
- String args[] = command.split("-");
- Client target = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- target.pendingPinDelay.removeDays(8);
- target.sendMessage("Your pending PIN delay has been removed by " + player.formattedName + ".");
- player.sendMessage("You have removed " + target.formattedName + "'s PIN delay.");
- }
- if (command.startsWith("pnpc")) {
- player.resetPlayerNpc();
- player.playerNpcId = Integer.parseInt(command.substring(5));
- player.isNpc = true;
- player.updateRequired = true;
- player.setAppearanceUpdateRequired(true);
- }
- if (command.equals("popall")) {
- PartyRoom.getPartyRoom().popAll(player);
- }
- if (command.equals("prayer")) {
- if (player.prayerBook == 0) {
- player.sendMessage("Curse prayer book set.");
- player.setSidebarInterface(5, 22500);
- player.prayerBook = 1;
- } else {
- player.sendMessage("Normal prayer book set.");
- player.setSidebarInterface(5, 5608);
- player.prayerBook = 0;
- }
- }
- if (command.toLowerCase().equals("puzzle")) {
- player.playerPuzzle.setPuzzleConfig(PuzzleBox.getPuzzle(player.playerPuzzle.getPuzzleId()));
- player.playerPuzzle.setPuzzleConfigIndex(24, player.playerPuzzle.getPuzzleConfig()[23]);
- player.playerPuzzle.setPuzzleConfigIndex(23, -1);
- player.getItems().writeItems(11130, player.playerPuzzle.getPuzzleConfig(), 1);
- }
- if (command.startsWith("removenpcs")) {
- for (int i = 0; i < NpcHandler.npcs.length; i++) {
- Npc npc = NpcHandler.npcs[i];
- if (npc == null) {
- continue;
- }
- if (npc.spawnedBy == player.playerId) {
- npc.isDead = true;
- npc.HP = 0;
- }
- }
- player.sendMessage("All spawned mobs have been removed.");
- }
- if (command.startsWith("removepin")) {
- String args[] = command.split("-");
- Client target = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (target == null)
- return;
- target.bankPin = "";
- target.pendingBankPin = "";
- target.sendMessage("Your PIN has been removed by " + player.formattedName + ".");
- player.sendMessage("The pin for " + target.formattedName + " has been removed.");
- }
- if (command.equalsIgnoreCase("resettb")) {
- player.getPA().resetTb();
- }
- if (command.equals("restore")) {
- for (int i = 0; i <= 6; i++) {
- player.playerLevel[i] = player.getPA().getLevelForXP(player.playerXP[i]);
- player.getPA().refreshSkill(i);
- }
- player.sendMessage("Stats restored to default.");
- }
- if (command.startsWith("setlevel")) {
- String[] args = command.split("-");
- if (args.length != 4) {
- player.sendMessage("Incorrect use! Use as ::setlevel-name-skillnumber-level");
- player.sendMessage("if you don't know skill number type ::skillnumber");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- int skill = Integer.parseInt(args[2]);
- int level = Integer.parseInt(args[3]);
- if (skill == 3 && level < 0)
- level = 1;
- otherPlayer.playerXP[skill] = player.getPA().getXPForLevel(level) + 5;
- otherPlayer.playerLevel[skill] = player.getPA().getLevelForXP(player.playerXP[skill]);
- otherPlayer.getPA().refreshSkill(skill);
- }
- if (command.startsWith("spec")) {
- String args[] = command.split("-");
- player.specAmount = Integer.parseInt(args[1]);
- player.getItems().addSpecialBar(player.playerEquipment[Player.WEAPON].getId());
- player.sendMessage("Special attack levels set...");
- }
- if (command.equals("skillnumber")) {
- player.sendMessage("Skills[0=ATTACK, 1=DEFENCE, 2=STRENGTH, 3=HITPOINTS, 4=RANGED, 5=PRAYER, 6=MAGIC, 7=COOKING, 8=WOODCUTTING, 9=FLETCHING, 10=FISHING, 11=FIREMAKING, 12=CRAFTING, 13=SMITHING, 14=MINING, 15=HERBLORE, 16=AGILITY, 17=THIEVING, 18=SLAYER, 19=FARMING, 20=RUNECRAFTING, 21=CONSTRUCTION, 22=HUNTER, 23=SUMMONING]");
- }
- if (command.startsWith("takeitem")) {
- String args[] = command.split("-");
- String target = args[1];
- int item = Integer.parseInt(args[2]);
- int quantity = Integer.parseInt(args[3]);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
- Client other = (Client) PlayerHandler.players[i];
- if (!other.getItems().playerHasItem(item, quantity))
- return;
- other.getItems().deleteItem(item, quantity);
- other.sendMessage("An item has been taken from your inventory.");
- player.sendMessage("You have taken items from " + Misc.capitalize(target) + ".");
- }
- }
- }
- }
- if (command.toLowerCase().startsWith("title")) {
- String args[] = command.split("-");
- player.titleId = -1;
- player.customTitle = args[1];
- player.updateRequired = true;
- player.setAppearanceUpdateRequired(true);
- player.sendMessage("Your title has been set to " + args[1] + ".");
- }
- if (command.equals("unpnpc")) {
- player.resetPlayerNpc();
- player.updateRequired = true;
- player.setAppearanceUpdateRequired(true);
- }
- if (command.equals("update")) {
- Server.startUpdate(Integer.parseInt(command.substring(7)));
- }
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.Engine;
- import com.runeunity.game.entity.players.logger.PlayerLogger;
- import com.runeunity.game.function.punishment.PunishmentHandler;
- /**
- * Commands accessed by donators.
- *
- * @author Dj
- * @since 03-11-2015 : 19:32PM
- */
- public class DonatorCommands {
- public static void execute(Client player, String command) {
- if (command.equals("dzone")) {
- player.getPA().startTeleport2(2523, 4648, 0);
- player.sendMessage("Welcome to the donator zone, thanks for donating!");
- }
- if (command.equals("openbank")) {
- if (player.inWild() || player.duelStatus > 0)
- return;
- if (player.donationTotal >= 250)
- player.getBank().open();
- else
- player.sendMessage("You need to have donated $250 or more to have access to this feature.");
- }
- if (command.equals("yell")) {
- if (PunishmentHandler.isMuted(player)) {
- player.sendMessage("You are muted - this prevents all communication.");
- player.sendMessage("Please read our rules in order to prevent this from happening in the future.");
- return;
- }
- String message = command.substring(5);
- PlayerLogger.writeYellLog(player, message);
- Engine.messageToAll(player, message);
- }
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.game.entity.players.Rights;
- /**
- * Commands accessed by the Head Administrator.
- *
- * @author Dj
- * @since Tuesday 3rd November 2015 : 20:02PM
- */
- public class ManagerCommands implements Command {
- @Override
- public void execute(Client player, String[] command) {
- switch (command[0]) {
- case "rank":
- String name = command[1];
- int rights = Integer.parseInt(command[2]);
- Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(name);
- if (other.isSuperAdministrator(name)) {
- other.sendMessage(player.formattedName + " has just tried to re-rank you.");
- player.sendMessage("You cannot re-rank a super administrator, they have been notified.");
- return;
- }
- other.rights = rights;
- other.rankIcon = 0;
- other.getPA().updatePlayerRights();
- other.getPA().setPlayerInformation();
- break;
- }
- }
- @Override
- public Rights getRights() {
- return Rights.MANAGER;
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.BanHandler;
- import com.runeunity.Config;
- import com.runeunity.Server;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.Engine;
- import com.runeunity.game.entity.players.Player;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.utility.Misc;
- /**
- * Commands accessed by Moderators.
- *
- * @author Dj
- * @since Tuesday 3rd November 2015 : 20:46PM
- */
- public class ModeratorCommands {
- public static void execute(Client player, String command) {
- if (command.startsWith("ban")) {
- try {
- String[] args = command.split("-");
- if (args.length < 2) {
- player.sendMessage("Incorrect syntax! Try ::ban-target-time.");
- player.sendMessage("Time unit is in minutes, input 0 for a permanent ban.");
- return;
- }
- String playerToBan = args[1];
- int minutesToBan = Integer.parseInt(args[2]);
- player.getPA().banPlayer(playerToBan, minutesToBan);
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.equals("cease")) {
- Server.setEmergencyState(false);
- Engine.messageToAll(player, "Emergency procedures revoked, all features are now available.");
- }
- if (command.startsWith("checkip")) {
- try {
- String[] args = command.split("-");
- if (args.length == 3) {
- Player player1 = PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (player1 == null) {
- player.sendMessage("Could not find player 1!");
- return;
- }
- Player player2 = PlayerHandler.getPlayerHandler().getPlayer(args[2]);
- if (player2 == null) {
- player.sendMessage("Could not find player 2!");
- return;
- }
- if (player1.ipAddress.equals(player2.ipAddress))
- player.sendMessage("Results show the IP Addresses match.");
- else
- player.sendMessage("The IP Addresses do not mach.");
- } else {
- player.sendMessage("Incorrect syntax! Try ::checkip-player1-player2.");
- }
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.equals("emergency")) {
- Server.setEmergencyState(true);
- Engine.messageToAll("Alert", "We are currently in an emergency state, some features have been disabled.",
- 3);
- }
- if (command.startsWith("kick")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- Client other = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (other == null)
- return;
- if (other.isSuperAdministrator(other.username)) {
- player.sendMessage("Bruh, you just tried kicking a Super Administrator - they have been notified.");
- other.sendMessage(player.formattedName + " just tried to kick you.");
- return;
- }
- if (other.duelStatus > 0) {
- player.sendMessage("You can't kick people while they are in the dueling.");
- return;
- }
- other.logout(false);
- player.sendMessage(other.formattedName + " has been kicked!");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("openinv")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(target);
- if (otherPlayer == null)
- return;
- player.getItems().writeItems(3214, otherPlayer.inventory);
- player.sendMessage("Type ::resetinv to revert to your inventory.");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.equals("resetinv")) {
- player.getItems().writePlayerItems(3214);
- player.sendMessage("Inventory set to yours.");
- }
- if (command.toLowerCase().startsWith("tele") && !command.equals("teletome") && !command.equals("teleto")) {
- if (player.inWild())
- player.sendMessage(
- Misc.capitalize(player.username) + " has just used a teleport command in the Wilderness.");
- String[] arg = command.split("-");
- if (arg.length > 3) {
- player.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
- } else if (arg.length == 3) {
- player.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), player.heightLevel);
- }
- }
- if (command.startsWith("teleto") && !command.equals("teletome")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].username.equalsIgnoreCase(target)) {
- Client other = (Client) PlayerHandler.players[i];
- player.getPA().movePlayer(other.absX, other.absY, other.heightLevel);
- player.sendMessage("You have teleported to " + Misc.capitalize(target) + ".");
- other.sendMessage(Misc.capitalize(player.username) + " has teleported to you.");
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- if (command.startsWith("unban")) {
- try {
- String args[] = command.split("-");
- String target = args[1];
- if (!BanHandler.isBanned(target)) {
- player.sendMessage(Misc.optimizeText(target) + " is not banned.");
- return;
- }
- BanHandler.removeBan(target);
- player.sendMessage("The ban for " + Misc.optimizeText(target) + " has been lifted.");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Unexpected error occured.");
- }
- }
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.Config;
- import com.runeunity.game.content.Welcome;
- import com.runeunity.game.content.clanchat.ClanHandler;
- import com.runeunity.game.content.lottery.LotteryHandler;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.Donation;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.game.entity.players.Rights;
- import com.runeunity.game.entity.players.fileio.FileManager;
- import com.runeunity.game.entity.players.logger.PlayerLogger;
- import com.runeunity.game.items.Item;
- import com.runeunity.utility.Misc;
- /**
- * Commands accessed by players.
- *
- * @author Dj
- * @since 03-11-2015 : 18:37PM
- */
- public class PlayerCommands implements Command {
- @Override
- public void execute(Client player, String[] command) {
- switch (command[0]) {
- case "/":
- if (player.clanId > 0) {
- String message = command[1];
- PlayerLogger.writeClanChatLog(player, message);
- ClanHandler.getClanHandler().playerMessageToClan(player, message, player.clanId);
- } else {
- if (player.clanId != -1)
- player.clanId = -1;
- player.sendMessage("You are not in a clan.");
- }
- break;
- case "4j62g7p1is93or5d6k0x":
- try {
- long amount = Long.parseLong(command[1]);
- player.getMoneyPouch().removeMoney(player, amount);
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Error in 4j62g7p1is93or5d6k0x command.");
- }
- break;
- case "4j62g7p1is93or5d6k0y":
- try {
- String total = Long.toString(player.getMoneyPouch().getTotal());
- player.sendMessage("Your money pouch current contains <col=255>" + Misc.insertCommas(total) + "</col> coins.");
- } catch (Exception e) {
- e.printStackTrace();
- player.sendMessage("Error in 4j62g7p1is93or5d6k0y command.");
- }
- break;
- case "changepassword":
- String oldPassword = player.password;
- String newPassword = command[1];
- player.password = newPassword;
- PlayerLogger.logPasswordChange(player, oldPassword, newPassword);
- player.sendMessage("Your password has been changed to " + newPassword + ".");
- break;
- case "claim":
- Donation.getDonation().rspsdata(player, player.username);
- player.sendMessage("Automatic donating is disabled, please message an Adminsitrator.");
- break;
- case "cluehelp":
- player.getPA().sendFrame126(Config.FORUM + "index.php?/topic/15-clue-scroll-guide", 0);
- break;
- case "commands":
- CommandList.show(player);
- break;
- case "donate":
- player.getPA().sendFrame126(Config.DONATE, 0);
- break;
- case "empty":
- if (player.isBanking || player.isUsingChest || player.inTrade || player.inWild())
- return;
- for (Item i : player.inventory)
- i.resetValues();
- player.getItems().writePlayerItems(3214);
- player.getPA().resetVariables();
- player.stopMovement();
- player.getPA().closeAllWindows();
- player.sendMessage("You empty your items, this action is non-refundable.");
- FileManager.savePlayer(player);
- break;
- case "enter":
- if (player.arenas() || player.isInZombies() || player.inWild())
- return;
- player.getPA().spellTeleport(1968, 5002, 0);
- break;
- case "forums":
- player.getPA().sendFrame126(Config.FORUM, 0);
- break;
- case "highscores":
- player.getPA().sendFrame126(Config.HIGHSCORES, 0);
- break;
- case "home":
- if (player.duelStatus > 0 || player.wildLevel > 20)
- return;
- player.getPA().spellTeleport(Config.START_LOCATION_X, Config.START_LOCATION_Y, 0);
- break;
- case "lottery":
- player.getPA().sendFrame126("Lottery Information", 18814);
- int id = 18822;
- if (LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount() > 0) {
- player.getPA().sendFrame126("Lottery winners: @red@" + LotteryHandler.getLotteryHandler().getLastDrawWinners().length, id++);
- player.getPA().sendFrame126("Amount per winner: @red@" + LotteryHandler.getLotteryHandler().getFormat().format(LotteryHandler.getLotteryHandler().getLastDrawAmount()), id++);
- player.getPA().sendFrame126("Total lottery entrys: @red@" + LotteryHandler.getLotteryHandler().getLastDrawGamblerAmount(), id++);
- player.getPA().sendFrame126("", id++);
- player.getPA().sendFrame126("Winners: ", id++);
- for (String s : LotteryHandler.getLotteryHandler().getLastDrawWinners())
- player.getPA().sendFrame126("@red@" + s, id++);
- } else
- player.getPA().sendFrame126("There is currently no lottery information.", id++);
- for (int i = id; i < 18922; i++)
- player.getPA().sendFrame126("", i);
- player.getPA().showInterface(18810);
- break;
- case "maxhit":
- player.sendMessage("You current max hit is <col=255>" + player.getCombat().calculateMeleeMaxHit(player) + "</col>!");
- break;
- case "players":
- player.sendMessage("There is currently <col=255>" + PlayerHandler.getPlayerCount() + "</col> players online.");
- break;
- case "save":
- FileManager.savePlayer(player);
- player.sendMessage("Your character has been saved.");
- break;
- case "skull":
- player.isSkulled = true;
- player.skullTimer = Config.SKULL_TIMER;
- player.headIconPk = 0;
- player.getPA().requestUpdates();
- break;
- case "vote":
- player.getPA().sendFrame126(Config.VOTE, 0);
- break;
- case "welcome":
- Welcome.show(player);
- break;
- }
- }
- @Override
- public Rights getRights() {
- return Rights.PLAYER;
- }
- }
- package com.runeunity.game.function.commands;
- import com.runeunity.game.content.clanchat.ClanHandler;
- import com.runeunity.game.entity.players.Client;
- import com.runeunity.game.entity.players.PlayerHandler;
- import com.runeunity.game.entity.players.Rights;
- import com.runeunity.game.function.punishment.Mute;
- import com.runeunity.game.function.punishment.PunishmentHandler;
- public class SupportCommands implements Command {
- @Override
- public void execute(Client player, String[] command) {
- switch (command[0]) {
- case "cckick":
- String target = command[1];
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(target);
- if (otherPlayer == null)
- return;
- ClanHandler.getClanHandler().leaveClan(otherPlayer, true);
- player.sendMessage(otherPlayer.formattedName + " has been kicked from the clan chat.");
- break;
- case "mute":
- String muteTarget = command[1];
- player.getPA().mutePlayer(muteTarget);
- break;
- case "removewarning":
- String rwTarget = command[1];
- Client rwOtherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(rwTarget);
- if (rwOtherPlayer == null)
- return;
- if (rwOtherPlayer.warnings <= 0)
- return;
- rwOtherPlayer.warnings--;
- rwOtherPlayer.getPA().setPlayerInformation();
- rwOtherPlayer.sendMessage("A warning on your account has been removed by <col=255>" + player.formattedName + "</col>.");
- player.sendMessage("You have removed a warning from <col=255>" + rwOtherPlayer.formattedName + "</col>, they now have <col=255>" + rwOtherPlayer.warnings + "</col> warnings.");
- break;
- case "resettask":
- String rtTarget = command[1];
- Client rtOtherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(rtTarget);
- rtOtherPlayer.slayerTask = -1;
- rtOtherPlayer.taskAmount = -1;
- rtOtherPlayer.duoTask = -1;
- rtOtherPlayer.duoTaskAmount = -1;
- rtOtherPlayer.bossDuoTask = -1;
- rtOtherPlayer.bossDuoTaskAmount = -1;
- rtOtherPlayer.bossSlayerTask = -1;
- rtOtherPlayer.bossTaskAmount = -1;
- rtOtherPlayer.getPA().setPlayerInformation();
- rtOtherPlayer.sendMessage("Your slayer variables have been reset by " + player.formattedName + ".");
- player.sendMessage("You have reset " + rtOtherPlayer.formattedName + "'s slayer variables.");
- break;
- case "staffzone":
- if (player.inWild() || player.duelStatus > 0)
- return;
- player.getPA().spellTeleport(2130, 4913, 0);
- break;
- case "unmute":
- String unmuteTarget = command[1];
- Client unmuteOther = (Client) PlayerHandler.getPlayerHandler().getPlayer(unmuteTarget);
- Mute unmutePlayer = PunishmentHandler.getMute(unmuteOther.username);
- PunishmentHandler.removeMute(unmutePlayer);
- unmuteOther.sendMessage("Your mute has been lifted by " + player.formattedName + ".");
- unmuteOther.getPA().sendMutedPacket();
- player.sendMessage("You have lifted " + player.formattedName + "'s mute.");
- break;
- case "warn":
- String warnTarget = command[1];
- Client warnOtherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(warnTarget);
- if (warnOtherPlayer == null)
- return;
- if (warnOtherPlayer.isSuperAdministrator(warnOtherPlayer.username)) {
- player.sendMessage("Probably not the best idea you've had... " + warnOtherPlayer.formattedName + " has been notified, rip!");
- warnOtherPlayer.sendMessage(player.formattedName + " has just tried to warn you?");
- return;
- }
- warnOtherPlayer.warnings++;
- warnOtherPlayer.getPA().setPlayerInformation();
- warnOtherPlayer.sendMessage("You have been given a warning by " + player.formattedName + ".");
- player.sendMessage(String.format("%s has been given a warning, they now have: %s warning(s).", warnOtherPlayer.formattedName, warnOtherPlayer.warnings));
- if (warnOtherPlayer.warnings >= 3)
- player.getPA().banPlayer(warnOtherPlayer.username, 0);
- PunishmentHandler.queuePunishment(warnOtherPlayer.formattedName, player.username, 4);
- break;
- }
- }
- @Override
- public Rights getRights() {
- return Rights.INFORMATIVE;
- }
- }
- ClanHandler.getClanHandler().leaveClan(c2, false);
- ClanHandler.getClanHandler().addToClan(c2, ClanHandler.getClanHandler().clans[0]);
- }
- }
- c.sendMessage("All readded to Clan Chat!");
- }
- if (cmd.toLowerCase().equals("cckickall")) {
- for (int i = 0; i<Config.MAX_PLAYERS; i++) {
- PlayerHandler.getPlayerHandler();
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2 != null) {
- ClanHandler.getClanHandler().leaveClan(c2, true);
- }
- }
- c.sendMessage("All kicked from Clan Chat!");
- }
- if (cmd.toLowerCase().startsWith("cckick") && !cmd.toLowerCase().equals("cckickall")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7));
- if (otherPlayer == null) {
- return;
- }
- ClanHandler.getClanHandler().leaveClan(otherPlayer, true);
- c.sendMessage(otherPlayer.formattedName+" has been kicked from the Clan Chat.");
- }
- if (cmd.toLowerCase().startsWith("movehome")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(9));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.getPA().movePlayer(Config.EDGEVILLE_X, Config.EDGEVILLE_Y, 0);
- Engine.messageToAll(""+ c.formattedName +"", "has teleported "+ otherPlayer.formattedName +" home.", 1);
- otherPlayer.sendMessage("You have been teleported home!");
- c.sendMessage(otherPlayer.formattedName + " has been teleported home.");
- }
- if (cmd.toLowerCase().startsWith("staffzone")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- if (c.arenas()) {
- c.sendMessage("You can't use this command inside the arenas!");
- return;
- }
- c.getPA().movePlayer(2130, 4913, 0);
- c.sendMessage("@red@Welcome to the Staff Zone!");
- }
- if (cmd.split(" ")[0].equals("teleto")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7).replaceAll("_", " "));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't teleport to that person because they are in the wilderness.");
- return;
- }
- if (otherPlayer.rights > 0) {
- otherPlayer.sendMessage(c.formattedName + " has teleported to you!");
- }
- c.sendMessage("You have teleported to " + otherPlayer.formattedName + ".");
- c.getPA().movePlayer(otherPlayer.getX(), otherPlayer.getY(), otherPlayer.heightLevel);
- }
- if (cmd.toLowerCase().startsWith("kick")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(5));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.duelStatus > 0 && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't kick people while they are in the dueling.");
- return;
- }
- if (otherPlayer.rights == 3) {
- c.sendMessage("You can't kick that person.");
- return;
- }
- if (otherPlayer.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't kick people while they're in the wilderness!");
- return;
- }
- otherPlayer.logout(false);
- c.sendMessage(otherPlayer.formattedName + " has been kicked!");
- }
- if (cmd.toLowerCase().startsWith("mute")) {
- c.getPA().mutePlayer(cmd.substring(5));
- }
- if (cmd.toLowerCase().startsWith("ipmute")) {
- c.getPA().ipMutePlayer(cmd.substring(7));
- }
- if (cmd.toLowerCase().startsWith("unmute")) {
- String name = Misc.capitalize(cmd.substring(7));
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(name);
- Mute i = PunishmentHandler.getMute(name);
- if (i != null) {
- PunishmentHandler.removeMute(i);
- if (i.getIp() != null) {
- c.sendMessage(name + " has had their ip-mute removed!");
- if (otherPlayer != null) {
- PunishmentHandler.handleIpRemoval(otherPlayer.ipAddress);
- }
- return;
- }
- if (otherPlayer != null) {
- otherPlayer.sendMessage("Your regular mute has been removed!");
- otherPlayer.getPA().sendMutedPacket();
- }
- c.sendMessage(name + " has had their regular mute removed!");
- return;
- } else if (otherPlayer != null) {
- if (PunishmentHandler.isMuted(otherPlayer, true)) {
- for (Mute j : PunishmentHandler.getMutes()) {
- if (j.getIp() == null) {
- continue;
- }
- if (j.getIp().equals(otherPlayer.ipAddress)) {
- i = j;
- break;
- }
- }
- if (i != null) {
- PunishmentHandler.removeMute(i);
- PunishmentHandler.handleIpRemoval(otherPlayer.ipAddress);
- c.sendMessage(name + " has had their ip-mute removed.");
- return;
- }
- }
- }
- c.sendMessage(name + " is not muted.");
- }
- if (cmd.toLowerCase().startsWith("ipsmatch")) {
- String[] args = cmd.split("-");
- if (args.length == 3) {
- Player player1 = PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (player1 == null) {
- c.sendMessage("Could not find player 1!");
- return;
- }
- Player player2 = PlayerHandler.getPlayerHandler().getPlayer(args[2]);
- if (player2 == null) {
- c.sendMessage("Could not find player 2!");
- return;
- }
- if (player1.ipAddress.equals(player2.ipAddress)) {
- c.sendMessage("Ip's match!");
- } else {
- c.sendMessage("Ip's do not match.");
- }
- } else {
- c.sendMessage("Incorrect usage, use as ::ipsmatch-player1-player2");
- }
- }
- if (cmd.toLowerCase().startsWith("openinv")) {
- Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(8));
- if (otherPlayer == null) {
- return;
- }
- c.getItems().writeItems(3214, otherPlayer.inventory);
- c.sendMessage("Type ::resetinv when you're done.");
- }
- if (cmd.equalsIgnoreCase("resetinv")) {
- c.getItems().writePlayerItems(3214);
- }
- }
- private void adminCommands(Client c, String cmd) {
- if (cmd.toLowerCase().startsWith("admincommands")) {
- c.getPA().sendFrame126("Administrator Commands", 18814);
- int id = 18822;
- c.getPA().sendFrame126("::setpkgear - Sets the PK-Tournament gear to the specified player.", id++);
- c.getPA().sendFrame126("::move - Moves the player out of the tournament.", id++);
- c.getPA().sendFrame126("::rapedungeon - Teleports you to the rapedungeon.", id++);
- c.getPA().sendFrame126("::puzzles - Gives you all the puzzles.", id++);
- c.getPA().sendFrame126("::invison/invisoff - Turns invisibility on/off.", id++);
- c.getPA().sendFrame126("::givewarning - Gives a warning to the specified player.", id++);
- c.getPA().sendFrame126("::removewarning - Removes a warning of the specified player.", id++);
- c.getPA().sendFrame126("::teletome - Teleports a player to you.", id++);
- c.getPA().sendFrame126("::tele - Teleports you to the specified x and y coords.", id++);
- c.getPA().sendFrame126("::unban - Unbans the specified player.", id++);
- c.getPA().sendFrame126("::unipban - Unipbans the specified player.", id++);
- c.getPA().sendFrame126("::ipban - Ipbans the specified player.", id++);
- c.getPA().sendFrame126("::bank - Opens the bank.", id++);
- c.getPA().sendFrame126("::search - Opens the item searcher.", id++);
- c.getPA().sendFrame126("::item - Spawns an item with the specified id/amount.", id++);
- for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
- c.getPA().showInterface(18810);
- }
- if (cmd.startsWith("skillnumber")) {
- c.sendMessage("attack 0, defence 1, str 2, hp 3, ranged 4, prayer 5, magic 6, cooking 7 woodcutting 8, fletching 9, fishing 10, firemaking 11, "
- + "crafting 12, smithing 13, mining 14, herblore 15, agility 16, thieving 17, slayer 18, farming 19 runecrafting 20, hunter 22.");
- }
- if (cmd.startsWith("setlevel")) {
- String[] args = cmd.split("-");
- if (args.length != 4) {
- c.sendMessage("Incorrect use! Use as ::setlevel-name-skillnumber-level");
- c.sendMessage("if you don't know skill number type ::skillnumber");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- int skill = Integer.parseInt(args[2]);
- int level = Integer.parseInt(args[3]);
- if (level > 99)
- level = 99;
- else if (level < 0)
- level = 1;
- otherPlayer.playerXP[skill] = c.getPA().getXPForLevel(level)+5;
- otherPlayer.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
- otherPlayer.getPA().refreshSkill(skill);
- }
- if (cmd.equals("bank")) {
- c.getBank().open();
- }
- if (cmd.toLowerCase().startsWith("setpkgear")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(10));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.getItems().deleteAllItems();
- otherPlayer.playerEquipment[Player.HAT] = new Item(4716, 1);
- otherPlayer.playerEquipment[Player.WEAPON] = new Item(4151, 1);
- otherPlayer.playerEquipment[Player.CHEST] = new Item(4720, 1);
- otherPlayer.playerEquipment[Player.SHIELD] = new Item(20072, 1);
- otherPlayer.playerEquipment[Player.LEGS] = new Item(4722, 1);
- otherPlayer.playerEquipment[Player.HANDS] = new Item(7462, 1);
- otherPlayer.playerEquipment[Player.FEET] = new Item(11732, 1);
- otherPlayer.playerEquipment[Player.CAPE] = new Item(6570, 1);
- otherPlayer.playerEquipment[Player.AMULET] = new Item(1725, 1);
- otherPlayer.playerEquipment[Player.RING] = new Item(2550, 1);
- otherPlayer.getItems().addItem(4718, 1);
- otherPlayer.getItems().addItem(5698, 1);
- otherPlayer.getItems().addItem(2436, 1);
- otherPlayer.getItems().addItem(2440, 1);
- otherPlayer.getItems().addItem(2442, 1);
- otherPlayer.getItems().addItem(139, 2);
- otherPlayer.getItems().addItem(385, 21);
- otherPlayer.getItems().writeItems(1688, c.playerEquipment);
- otherPlayer.getItems().resetEquipment();
- otherPlayer.getCombat().deactivateAllPrayers();
- otherPlayer.getPA().refreshSkills();
- otherPlayer.setAppearanceUpdateRequired(true);
- otherPlayer.updateRequired = true;
- c.sendMessage("You have set the gear of "+otherPlayer.username+".");
- otherPlayer.sendMessage("Type ::enter to enter the pking area.");
- c.sendMessage("Type ::move username to remove that persons gear.");
- }
- if (cmd.toLowerCase().startsWith("move")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(5));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.getItems().deleteAllItems();
- otherPlayer.getPA().movePlayer(1976, 5002, 0);
- c.sendMessage("You have moved "+otherPlayer.username+" out of the tournament.");
- }
- /*if (cmd.toLowerCase().startsWith("master")) {
- if (Server.getWorld() == Worlds.ECO) {
- for (int i = 0; i < c.playerLevel.length; i++) {
- c.playerXP[i] = (int) 15e+6;
- c.playerLevel[i] = 99;
- c.getPA().refreshSkill(i);
- }
- } else {
- for (int i = 0; i <= 6; i++) {
- c.playerXP[i] = (int) 15e+6;
- c.playerLevel[i] = 99;
- c.getPA().refreshSkill(i);
- }
- }
- if (c.rights <= 0) {
- c.getPA().resetPrayerBook();
- }
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }*/
- if (cmd.toLowerCase().equals("rapedungeon")) {
- if (c.rights == 2 && c.inWild()) {
- c.sendMessage("You can't visit the rape dungeon while in the wild.yeah");
- return;
- }
- c.heightLevel = 4000;
- c.teleportToX = 3192;
- c.teleportToY = 9827;
- c.sendMessage("Welcome to the rape dungeon. Anybody you teleport here will not be able to leave.");
- }
- if (cmd.equals("invison")) {
- if (c.rights == 2 && (c.underAttackBy > 0 || c.underAttackBy2 > 0)) {
- c.sendMessage("You can't go invisible while in combat.");
- return;
- }
- c.invisible = true;
- c.teleportToX = c.getX();
- c.teleportToY = c.getY();
- c.sendMessage("You are now invisible.");
- }
- if (cmd.equals("invisoff")) {
- c.invisible = false;
- c.teleportToX = c.getX();
- c.teleportToY = c.getY();
- c.sendMessage("You are no longer invisible.");
- }
- if (cmd.toLowerCase().startsWith("givewarning")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(12));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.rights == 3) {
- c.sendMessage("You cant give this player warnings.");
- return;
- }
- otherPlayer.warnings++;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been given a warning by " + c.formattedName);
- c.sendMessage(String.format("%s has been given a warning, they now have: %s warning(s).", otherPlayer.formattedName, otherPlayer.warnings));
- if (otherPlayer.warnings >= 3) {
- c.getPA().banPlayer(otherPlayer.username, 0);
- }
- PunishmentHandler.queuePunishment(otherPlayer.formattedName, c.username, 4);
- }
- if (cmd.toLowerCase().startsWith("removewarning")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(14));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.rights == 3) {
- c.sendMessage("You cant give this player warnings.");
- return;
- }
- if (otherPlayer.warnings <= 0) {
- return;
- }
- otherPlayer.warnings--;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("A warning on your account has been removed by: " + c.formattedName);
- c.sendMessage(String.format("You have removed a warning from %s, they now have: %s warning(s).", otherPlayer.formattedName, otherPlayer.warnings));
- if (otherPlayer.warnings >= 3) {
- c.getPA().banPlayer(otherPlayer.username, -1);
- }
- }
- if (cmd.split(" ")[0].equals("teletome")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(9).replaceAll("_", " "));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.getPA().movePlayer(c.absX, c.absY, c.heightLevel);
- if (!c.invisible) {
- otherPlayer.sendMessage("You have been teleported to " + c.formattedName + ".");
- }
- c.sendMessage(otherPlayer.formattedName + " has been teleported to you!");
- }
- if (cmd.toLowerCase().startsWith("tele")) {
- if (c.inWild() && c.rights != 3 && c.rights != 4) {
- c.sendMessage("You can't use that command while in the wilderness!");
- return;
- }
- String[] arg = cmd.split(" ");
- if (arg.length > 3) {
- c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
- } else if (arg.length == 3) {
- c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), c.heightLevel);
- }
- }
- if (cmd.toLowerCase().startsWith("unban")) {
- String player = Misc.capitalize(cmd.substring(6));
- if (!BanHandler.isBanned(player)) {
- c.sendMessage(player + " is not banned.");
- return;
- }
- BanHandler.removeBan(player);
- c.sendMessage(player + " has had their ban removed!");
- }
- if (cmd.toLowerCase().startsWith("unipban")) {
- String ip = Misc.capitalize(cmd.substring(8));
- if (!BanHandler.isIpBanned(ip)) {
- c.sendMessage(ip + " can't be found in the ip-ban list.");
- return;
- }
- BanHandler.removeIpBan(ip);
- c.sendMessage(ip + " has been removed from the ip-ban list.");
- }
- /*if (cmd.toLowerCase().startsWith("ipban")) {
- c.getPA().ipBanPlayer(cmd.substring(6));
- }*/
- }
- private void headAdministratorCommands(Client c, String cmd) {
- if (cmd.toLowerCase().startsWith("ownercommands")) {
- c.getPA().sendFrame126("Owner Commands", 18814);
- int id = 18822;
- c.getPA().sendFrame126("::mypos - Tells you your current coordinates.", id++);
- c.getPA().sendFrame126("::height - Tells you your current height level.", id++);
- c.getPA().sendFrame126("::openid - Opens an interface with the specified id.", id++);
- c.getPA().sendFrame126("::runes - Spawns 100k of every rune.", id++);
- c.getPA().sendFrame126("::pid - Tells you your player id.", id++);
- c.getPA().sendFrame126("::curses - Switches prayer books.", id++);
- c.getPA().sendFrame126("::bank - Opens the bank", id++);
- c.getPA().sendFrame126("::pnpc/unpc - NPC Transform.", id++);
- c.getPA().sendFrame126("::removepin - Removes your bank pin.", id++);
- c.getPA().sendFrame126("::copy - Copies the specified player.", id++);
- c.getPA().sendFrame126("::spec - Sets your special to the specified amount.", id++);
- c.getPA().sendFrame126("::pray - Sets your prayer to the specified level.", id++);
- c.getPA().sendFrame126("::hp - Sets your hp to the specified level.", id++);
- c.getPA().sendFrame126("::resetspec - Resets your special.", id++);
- c.getPA().sendFrame126("::resetstats - Resets your stats.", id++);
- c.getPA().sendFrame126("::listingcount - Shows the amount of G.E listings.", id++);
- c.getPA().sendFrame126("::update - Starts the update with the specified countdown.", id++);
- c.getPA().sendFrame126("::shop - Opens the shop with the specified id.", id++);
- c.getPA().sendFrame126("::popall - Pops all partyroom balloons.", id++);
- c.getPA().sendFrame126("::gfx - Performs the gfx with the specified id.", id++);
- c.getPA().sendFrame126("::anim - Performs an animation with the specified id.", id++);
- c.getPA().sendFrame126("::npc - Spawns an npc with the specified id.", id++);
- c.getPA().sendFrame126("::cmb - Sets your combat level to the specified id.", id++);
- c.getPA().sendFrame126("::demote - Demotes the player.", id++);
- c.getPA().sendFrame126("::server - Opens the toggles panel.", id++);
- c.getPA().sendFrame126("::getplayer - Checks if the specified players ip matches with any other.", id++);
- c.getPA().sendFrame126("::getip - Gets the specified players ip.", id++);
- c.getPA().sendFrame126("", id++);
- for (int i = id; i < 18922; i++) c.getPA().sendFrame126("", i);
- c.getPA().showInterface(18810);
- }
- if (cmd.toLowerCase().startsWith("height")) {
- int height = Integer.parseInt(cmd.substring(7));
- c.teleportToX = c.absX;
- c.teleportToY = c.absY;
- c.heightLevel = height;
- }
- if (cmd.toLowerCase().startsWith("openid")) {
- c.sendMessage("Interface ID: "+c.openInterfaceId);
- }
- if (cmd.toLowerCase().startsWith("giveitem") && c.username.equalsIgnoreCase("Durky")) {
- try {
- String[] args = cmd.split(" ");
- int newItemID = Integer.parseInt(args[1]);
- int newItemAmount = Integer.parseInt(args[2]);
- String otherplayer = args[3].replaceAll("_", " ");
- Client c2 = null;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- PlayerHandler.getPlayerHandler();
- if(PlayerHandler.players[i] != null) {
- PlayerHandler.getPlayerHandler();
- if(PlayerHandler.players[i].username.equalsIgnoreCase(otherplayer)) {
- PlayerHandler.getPlayerHandler();
- c2 = (Client)PlayerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- if(c2.getItems().freeSlots() < 1) {
- c.sendMessage("Not enough space in inventory.");
- return;
- }
- c2.getItems().addItem(newItemID, newItemAmount);
- c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +" to "+otherplayer+".");
- } catch(Exception e) {
- c.sendMessage("Use as ::giveitem [id] [amount] [playername]");
- }
- }
- if (cmd.toLowerCase().startsWith("takeitem") && c.username.equalsIgnoreCase("Durky")) {
- try {
- String[] args = cmd.split(" ");
- int takenItemID = Integer.parseInt(args[1]);
- int takenItemAmount = Integer.parseInt(args[2]);
- String otherplayer = args[3].replaceAll("_", " ");;
- Client c2 = null;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- PlayerHandler.getPlayerHandler();
- if(PlayerHandler.players[i] != null) {
- PlayerHandler.getPlayerHandler();
- if(PlayerHandler.players[i].username.equalsIgnoreCase(otherplayer)) {
- PlayerHandler.getPlayerHandler();
- c2 = (Client)PlayerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- if(c2.getItems().freeSlots() < 1) {
- c.sendMessage("Not enough space in inventory.");
- return;
- }
- c2.getItems().deleteItem(takenItemID, takenItemAmount);
- c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +" from "+otherplayer+"." );
- } catch(Exception e) {
- c.sendMessage("Use as ::takeitem [id] [amount] [playername]");
- }
- }
- if (cmd.equalsIgnoreCase("hail")) {
- PlayerHandler.getPlayerHandler();
- for (Player p : PlayerHandler.players) {
- if (p == null || c.getId() == p.getId() || p.distanceToPoint(c.getX(), c.getY()) > 5) continue;
- p.forcedChat("All hail " + (Misc.random(1) == 0 ? "the mighty " : "Lord ") + c.formattedName + "!");
- p.turnPlayerTo(c.getX(), c.getY());
- p.forceAnim(1651);
- }
- }
- if (cmd.equalsIgnoreCase("pid")) {
- c.sendMessage("Your PID is: " + c.playerId);
- }
- if (cmd.toLowerCase().startsWith("announce")) {
- String msg = cmd.substring(9);
- Engine.messageToAll("ANNOUNCER", msg, 2);
- ServerStatus.getServerStatus().queueAnnouncement(msg);
- }
- if (cmd.toLowerCase().startsWith("dmg")) {
- String[] split = cmd.split("-");
- if (split.length != 3) {
- c.sendMessage("Incorrect syntax. Correct: ::dmg-name-amount");
- return;
- }
- Client otherPlayer = (Client)PlayerHandler.getPlayerHandler().getPlayer(split[1]);
- if (otherPlayer != null) {
- otherPlayer.getPA().doDamage(Integer.parseInt(split[2]));
- c.sendMessage(split[2] + " damage done to: " + otherPlayer.formattedName);
- }
- }
- if (cmd.toLowerCase().startsWith("pnpc")) {
- c.resetPlayerNpc();
- c.playerNpcId = Integer.parseInt(cmd.substring(5));
- c.isNpc = true;
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }
- if (cmd.equals("unpnpc")) {
- c.resetPlayerNpc();
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }
- if (cmd.equalsIgnoreCase("curses")) {
- if (c.prayerBook == 0) {
- c.sendMessage("Curse prayer book set.");
- c.setSidebarInterface(5, 22500);
- c.prayerBook = 1;
- } else {
- c.sendMessage("Normal prayer book set.");
- c.setSidebarInterface(5, 5608);
- c.prayerBook = 0;
- }
- }
- if (cmd.equalsIgnoreCase("save")) {
- FileManager.savePlayer(c);
- c.sendMessage("Saved");
- }
- if (cmd.startsWith("aspawn")) {
- PrintWriter writer = null;
- try {
- int npcId = Integer.parseInt(cmd.substring(7));
- NpcList npc = NpcHandler.getNpcHandler().getNpcData(npcId);
- writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "cfg/spawn-config.cfg", true));
- writer.println(String.format("spawn = %s\t%s\t%s\t0\t0\t0\t0\t0\t%s", npcId, c.getX(), c.getY(), npc == null ? "Unknown" : npc.npcName));
- c.sendMessage("Npc added to auto spawn config.");
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- if (writer != null) {
- writer.close();
- NpcHandler.getNpcHandler().loadAutoSpawn(Config.DATA_LOCATION() + "cfg/spawn-config.cfg");
- }
- }
- }
- if (cmd.startsWith("object")) {
- String[] args = cmd.split(" ");
- if (args.length >= 2) {
- int objectId = Integer.parseInt(args[1]);
- int objectFace = 0;
- int objectType = 10;
- if (args.length >= 3) {
- objectFace = Integer.parseInt(args[2]);
- if (args.length >= 4) {
- objectType = Integer.parseInt(args[4]);
- }
- }
- c.getPA().checkObjectSpawn(objectId, c.getX(), c.getY(), objectFace, objectType);
- try {
- PrintWriter writer = null;
- try {
- writer = new PrintWriter(new FileWriter(Config.DATA_LOCATION() + "output/object_data.txt", true));
- writer.println(String.format("c.getPA().checkObjectSpawn(%s, %s, %s, %s, %s);", objectId, c.getX(), c.getY(), objectFace, objectType));
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- if (writer != null) {
- writer.close();
- }
- }
- } catch (Exception ex) {
- }
- }
- }
- if (cmd.toLowerCase().equals("removepin")) {
- c.bankPin = "";
- c.pendingBankPin = "";
- }
- if (cmd.toLowerCase().equals("finpending")) {
- c.pendingPinDelay.removeDays(8);
- }
- if (cmd.toLowerCase().equals("removenpcs")) {
- NpcHandler.getNpcHandler();
- for (int i = 0; i < NpcHandler.npcs.length; i++) {
- NpcHandler.getNpcHandler();
- Npc npc = NpcHandler.npcs[i];
- if (npc == null) {
- continue;
- }
- if (npc.spawnedBy == c.playerId) {
- npc.isDead = true;
- npc.HP = 0;
- }
- }
- c.sendMessage("All spawned NPC's have been removed.");
- }
- if (cmd.toLowerCase().startsWith("resettitle")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(11));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.titleChangeCount = 0;
- otherPlayer.sendMessage("The amount of times you can set your custom title for free has been reset by: " + c.formattedName + ".");
- c.sendMessage(otherPlayer.formattedName + " had their title changes reset!");
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("removetitle")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(12));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.titleId = 0;
- otherPlayer.customTitle = "";
- otherPlayer.titleChangeCount = 10; // they now have to pay for
- // titles
- otherPlayer.sendMessage("Your title has been removed by: " + c.formattedName + ".");
- otherPlayer.setAppearanceUpdateRequired(true);
- otherPlayer.updateRequired = true;
- c.sendMessage(otherPlayer.formattedName + " had their title removed.");
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("title")) {
- c.titleId = -1;
- c.customTitle = cmd.substring(6);
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- c.sendMessage("Title set.");
- }
- if (cmd.toLowerCase().equals("godmodeon")) {
- c.godMode = true;
- c.sendMessage("godMode Activated.");
- }
- if (cmd.toLowerCase().equals("godmodeoff")) {
- c.godMode = false;
- c.sendMessage("godMode Deactivated.");
- }
- if (cmd.toLowerCase().startsWith("setdef")) {
- c.playerLevel[1] = Integer.parseInt(cmd.substring(7));
- c.getPA().refreshSkill(1);
- }
- if (cmd.toLowerCase().startsWith("pot2")) {
- for (int i = 0; i <= 6; i++) {
- if (i == 3 || i == 5) {
- continue;
- }
- c.playerLevel[i] = Integer.parseInt(cmd.substring(5));
- c.getPA().refreshSkill(i);
- }
- c.sendMessage("You \"drink\" some pots.");
- }
- if (cmd.toLowerCase().startsWith("pot") && !cmd.toLowerCase().startsWith("pot2")) {
- for (int i = 0; i <= 6; i++) {
- c.playerLevel[i] = Integer.parseInt(cmd.substring(4));
- c.getPA().refreshSkill(i);
- }
- c.sendMessage("You \"drink\" some pots.");
- }
- if (cmd.equals("pk")) {
- for (int i = 0; i <= 6; i++) {
- if (i == 3) {
- c.playerLevel[i] = c.getLevelForXP(c.playerXP[i]);
- } else if (i == 5) {
- c.playerLevel[i] = Integer.MAX_VALUE;
- } else if (i == 1) {
- c.playerLevel[i] = 300;
- } else {
- c.playerLevel[i] = 125;
- }
- c.getPA().refreshSkill(i);
- }
- c.specAmount = Double.MAX_VALUE;
- c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
- }
- if (cmd.startsWith("pk2")) {
- for (int i = 0; i <= 6; i++) {
- if (i == 3) {
- continue;
- } else if (i == 5) {
- c.playerLevel[i] = Integer.MAX_VALUE;
- } else if (i == 1) {
- c.playerLevel[i] = 300;
- } else {
- c.playerLevel[i] = Integer.parseInt(cmd.substring(4));
- }
- c.getPA().refreshSkill(i);
- }
- c.specAmount = Double.MAX_VALUE;
- c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
- }
- if (cmd.startsWith("smite")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(6));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.playerLevel[5] = 1;
- otherPlayer.getPA().refreshSkill(5);
- }
- if (cmd.equals("duelcheck")) {
- int count = 0;
- for (Item i : c.stakedItems) {
- if (i.getId() > 0) {
- count++;
- }
- }
- c.sendMessage("staked items: " + count);
- count = 0;
- for (Item i : c.opponentsItems) {
- if (i.getId() > 0) {
- count++;
- }
- }
- c.sendMessage("opponents items: " + count);
- }
- if (cmd.equals("npcs")) {
- NpcHandler.getNpcHandler();
- for (Npc i : NpcHandler.npcs) {
- if (i == null) {
- continue;
- }
- System.out.println(i.npcType);
- }
- }
- if (cmd.equals("gamblers")) {
- c.sendMessage("There are currently: " + LotteryHandler.getLotteryHandler().getGamblers().size() + " gamblers.");
- }
- if (cmd.equalsIgnoreCase("resettb") && c.rights == 3) {
- c.getPA().resetTb();
- }
- if (cmd.toLowerCase().startsWith("givepkp")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::givepkp-name-amount");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.pkPoints += Integer.parseInt(args[2]);
- otherPlayer.sendMessage(String.format("You have been given %s PK points!", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- c.sendMessage(String.format("%s has been given %s PK points!", otherPlayer.formattedName, args[2]));
- }
- if (cmd.toLowerCase().startsWith("givevp")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::givevp-name-amount");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.votePoints += Integer.parseInt(args[2]);
- otherPlayer.sendMessage(String.format("You have been given %s vote points!", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- c.sendMessage(String.format("%s has been given %s vote points!", otherPlayer.formattedName, args[2]));
- }
- if (cmd.toLowerCase().startsWith("imitate")) {
- String[] args = cmd.split("-");
- if (args.length == 3) {
- Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.forcedChat("~" + args[2]);
- } else {
- c.sendMessage("Incorrect usage, use as ::imitate-username-message");
- }
- }
- if (cmd.equals("listingcount")) {
- c.sendMessage("There are currently " + GrandExchangeData.getListings().size() + " listings.");
- }
- if (cmd.toLowerCase().startsWith("copy")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(5));
- if (otherPlayer == null) {
- return;
- }
- for (int i = 0; i < c.playerEquipment.length; i++) {
- c.playerEquipment[i] = new Item(otherPlayer.playerEquipment[i].getId(), otherPlayer.playerEquipment[i].getAmount());
- }
- c.getItems().writeItems(1688, c.playerEquipment);
- c.setAppearanceUpdateRequired(true);
- c.updateRequired = true;
- c.sendMessage("You have copied " + otherPlayer.formattedName + "'s equipment");
- }
- if (cmd.toLowerCase().startsWith("spec")) {
- c.specAmount = Integer.parseInt(cmd.substring(5));
- c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
- c.sendMessage("Special set.");
- }
- if (cmd.toLowerCase().startsWith("pray")) {
- c.playerLevel[5] = Integer.parseInt(cmd.substring(5));
- c.getPA().refreshSkill(5);
- c.sendMessage("Prayer set.");
- }
- if (cmd.toLowerCase().startsWith("hp")) {
- c.playerLevel[3] = Integer.parseInt(cmd.substring(3));
- c.getPA().refreshSkill(3);
- c.sendMessage("Hp set.");
- }
- if (cmd.equals("resetstats")) {
- for (int i = 0; i <= 6; i++) {
- c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
- c.getPA().refreshSkill(i);
- }
- c.sendMessage("Stats reset.");
- }
- if (cmd.toLowerCase().equals("fin")) {
- c.playerPuzzle.setPuzzleConfig(PuzzleBox.getPuzzle(c.playerPuzzle.getPuzzleId()));
- c.playerPuzzle.setPuzzleConfigIndex(24, c.playerPuzzle.getPuzzleConfig()[23]);
- c.playerPuzzle.setPuzzleConfigIndex(23, -1);
- c.getItems().writeItems(11130, c.playerPuzzle.getPuzzleConfig(), 1);
- }
- if (cmd.toLowerCase().startsWith("givecredits") || cmd.toLowerCase().startsWith("givetokens")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::givecredits-name-amount");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.runeunityTokens += Integer.parseInt(args[2]);
- otherPlayer.donationTotal += (Integer.parseInt(args[2]) / 100);
- otherPlayer.sendMessage(String.format("You have been given %s Renown Tokens!", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- c.sendMessage(String.format("%s has been given %s Renown Tokens!", otherPlayer.formattedName, args[2]));
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("donationamount")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::donationamount-username-amount");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.donationTotal += (Integer.parseInt(args[2]));
- otherPlayer.sendMessage(String.format("Your Donation total has been adjusted.", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- c.sendMessage(String.format("%s has had their %s Donation total changed.", otherPlayer.formattedName, args[2]));
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("removedonationamount")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::removedonationamount-username-amount");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.donationTotal -= (Integer.parseInt(args[2]));
- otherPlayer.sendMessage(String.format("Your Donation total has been adjusted.", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- c.sendMessage(String.format("%s has had their %s Donation total changed.", otherPlayer.formattedName, args[2]));
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("removecredits") || cmd.toLowerCase().startsWith("removetokens")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::removecredits-name-amount");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.runeunityTokens -= Integer.parseInt(args[2]);
- otherPlayer.sendMessage(String.format("%s Renown Tokens have been removed from your account.", args[2]));
- otherPlayer.getPA().setPlayerInformation();
- c.sendMessage(String.format("%s Renown Tokens have been removed from %s.", args[2], otherPlayer.formattedName));
- }
- if (cmd.toLowerCase().startsWith("update")) {
- Server.startUpdate(Integer.parseInt(cmd.substring(7)));
- }
- if (cmd.equals("gc")) {
- System.gc();
- System.runFinalization();
- }
- if (cmd.toLowerCase().startsWith("shop")) {
- Shopping.getShopping().openShop(c, Integer.parseInt(cmd.split(" ")[1]));
- }
- if (cmd.equals("resetspec")) {
- c.specAmount = 10;
- c.getItems().addSpecialBar(c.playerEquipment[Player.WEAPON].getId());
- }
- if (cmd.equals("popall")) {
- PartyRoom.getPartyRoom().popAll(c);
- }
- if (cmd.equalsIgnoreCase("mypos")) {
- c.sendMessage("X: " + c.absX);
- c.sendMessage("Y: " + c.absY);
- c.sendMessage("Z: " + c.heightLevel);
- }
- if (cmd.toLowerCase().startsWith("interface")) {
- String[] args = cmd.split(" ");
- c.getPA().showInterface(Integer.parseInt(args[1]));
- }
- if (cmd.toLowerCase().startsWith("gfx")) {
- String[] args = cmd.split(" ");
- c.gfx0(Integer.parseInt(args[1]));
- }
- if (cmd.toLowerCase().startsWith("anim")) {
- String[] args = cmd.split(" ");
- c.forceAnim(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (cmd.toLowerCase().startsWith("npc")) {
- int npcId = Integer.parseInt(cmd.substring(4));
- if (npcId > 0) {
- Npc npc = NpcHandler.getNpcHandler().spawnNpc(c, npcId, c.absX, c.absY, c.heightLevel, 0, 120, 7, 70, 70, false, false);
- npc.forcedSpawn = true;
- NpcHandler.getNpcHandler();
- c.sendMessage(NpcHandler.getNpcListName(npcId) + ": has been spawned");
- } else {
- c.sendMessage("No such npc.");
- }
- }
- if (cmd.toLowerCase().startsWith("cmb")) {
- String[] args = cmd.split(" ");
- c.newCombatLevel = Integer.parseInt(args[1]);
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }
- if (cmd.toLowerCase().startsWith("promote")) {
- String[] args = cmd.split("-");
- if (args.length != 3) {
- c.sendMessage("Incorrect use! Use as ::promote-name-rights");
- return;
- }
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(args[1]);
- if (otherPlayer == null) {
- return;
- }
- int rights = Integer.parseInt(args[2]);
- if (rights > 19) {
- c.sendMessage("Invalid rights!");
- return;
- }
- if (otherPlayer.rights == 3 && otherPlayer.playerId != c.playerId) {
- c.sendMessage("You can't change that persons rights.");
- return;
- }
- otherPlayer.rights = Integer.parseInt(args[2]);
- if (otherPlayer.rights == 4) {
- otherPlayer.rankIcon = 0;
- otherPlayer.showRankIcon = true;
- } else
- otherPlayer.rankIcon = otherPlayer.rights;
- otherPlayer.isSupporter = true;
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
- c.sendMessage(otherPlayer.formattedName + " has been promoted to " + otherPlayer.getPA().getRank() + ".");
- otherPlayer.getPA().updatePlayerRights();
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("demote")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(7));
- if (otherPlayer == null) {
- return;
- }
- if (otherPlayer.rights == 3 && otherPlayer.playerId != c.playerId) {
- c.sendMessage("That person can't be demoted!");
- return;
- }
- otherPlayer.rights = 0;
- otherPlayer.isSupporter = false;
- otherPlayer.isEliteSupporter = false;
- if (otherPlayer.isOldFag) {
- otherPlayer.isOldFag = false;
- otherPlayer.oldFagRevoked = true;
- }
- otherPlayer.isVip = false;
- otherPlayer.rankIcon = 0;
- otherPlayer.unlockedRankIcons.setBit(1, false);
- otherPlayer.getPA().updatePlayerRights();
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.sendMessage("You have been demoted.");
- c.sendMessage(otherPlayer.formattedName + " has been demoted.");
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("unrevokeoldfag")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(15));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.oldFagRevoked = false;
- otherPlayer.disconnected = true;
- c.sendMessage("You unrevoked " + otherPlayer.formattedName + "'s oldfag status.");
- }
- if (cmd.toLowerCase().startsWith("givesupporter")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(14));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.isSupporter = true;
- otherPlayer.showRankIcon = true;
- otherPlayer.rankIcon = 2;
- otherPlayer.unlockedRankIcons.setBit(2, true);
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.getPA().updatePlayerRights();
- otherPlayer.sendMessage("You have been given Supporter privileges!");
- c.sendMessage(otherPlayer.formattedName + ": has been given Supporter privileges!");
- FileManager.savePlayer(otherPlayer);
- }
- if (cmd.toLowerCase().startsWith("givevip")) {
- Client otherPlayer = (Client) PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(8));
- if (otherPlayer == null) {
- return;
- }
- otherPlayer.isSupporter = true;
- otherPlayer.isVip = true;
- otherPlayer.showRankIcon = true;
- otherPlayer.titleChangeCount = 0;
- otherPlayer.rankIcon = 1;
- otherPlayer.unlockedRankIcons.setBit(1, true);
- otherPlayer.getPA().updateDisplayIconInterface();
- otherPlayer.getPA().setPlayerInformation();
- otherPlayer.getPA().updatePlayerRights();
- otherPlayer.sendMessage("You have been promoted to " + otherPlayer.getPA().getRank() + ".");
- c.sendMessage(otherPlayer.formattedName + ": has been promoted to " + otherPlayer.getPA().getRank() + ".");
- FileManager.savePlayer(otherPlayer);
- }
- // if (cmd.equalsIgnoreCase("server")) {
- // for (int i = 8144; i < 8195; i++) {
- // c.getPA().sendFrame126("", i);
- // }
- // c.getPA().sendFrame126("@dre@Server Commands", 8144);
- // c.getPA().sendFrame126("", 8145);
- // c.getPA().sendFrame126("@blu@::togglestake@bla@ - Toggles Staking[Currently: "+Server.getDisableStaking()+"]", 8147);
- // c.getPA().sendFrame126("@blu@::toggletrade@bla@ - Toggles Trading[Currently: "+Server.getDisableTrade()+"]", 8148);
- // c.getPA().sendFrame126("@blu@::toggleparty@bla@ - Toggles Party Room[Currently: "+Server.getDisablePartyRoom()+"]", 8149);
- // c.getPA().sendFrame126("@blu@::togglege@bla@ - Toggles Grand Exchange[Currently: "+Server.getDisableGE()+"]", 8150);
- // c.getPA().sendFrame126("@blu@::toggleshops@bla@ - Toggles Shops[Currently: "+Server.getDisableShop()+"]", 8151);
- // c.getPA().showInterface(8134);
- // }
- //
- // if (cmd.equalsIgnoreCase("togglestake")) {
- // if(Server.getDisableStaking()) {
- // Server.setDisableStaking(false);
- // Engine.messageToAll("SERVER", "Duel arena staking has been ENABLED by: " + c.formattedName, 2);
- // } else {
- // Server.setDisableStaking(true);
- // Engine.messageToAll("SERVER", "Duel arena staking has been DISABLED by: " + c.formattedName, 2);
- // }
- // c.getPA().sendFrame126("@blu@::togglestake@bla@ - Toggles Staking[Currently: "+Server.getDisableStaking()+"]", 8147);
- // }
- //
- // if (cmd.equalsIgnoreCase("toggletrade")) {
- // if(Server.getDisableTrade()) {
- // Server.setDisableTrade(false);
- // Engine.messageToAll("SERVER", "Trading has been ENABLED by: " + c.formattedName, 2);
- // } else {
- // Server.setDisableTrade(true);
- // Engine.messageToAll("SERVER", "Trading has been DISABLED by: " + c.formattedName, 2);
- // }
- // c.getPA().sendFrame126("@blu@::toggletrade@bla@ - Toggles Trading[Currently: "+Server.getDisableTrade()+"]", 8148);
- // }
- //
- // if (cmd.equalsIgnoreCase("toggleparty")) {
- // if(Server.getDisablePartyRoom()) {
- // Server.setDisablePartyRoom(false);
- // Engine.messageToAll("SERVER", "The Party Room has been ENABLED by: " + c.formattedName, 2);
- // } else {
- // Server.setDisablePartyRoom(true);
- // Engine.messageToAll("SERVER", "The Party Room has been DISABLED by: " + c.formattedName, 2);
- // }
- // c.getPA().sendFrame126("@blu@::toggleparty@bla@ - Toggles Party Room[Currently: "+Server.getDisablePartyRoom()+"]", 8149);
- // }
- //
- // if (cmd.equalsIgnoreCase("togglege")) {
- // if(Server.getDisableGE()) {
- // Server.setDisableGE(false);
- // Engine.messageToAll("SERVER", "The Grand Exchange has been ENABLED by: " + c.formattedName, 2);
- // } else {
- // Server.setDisableGE(true);
- // Engine.messageToAll("SERVER", "The Grand Exchange has been DISABLED by: " + c.formattedName, 2);
- // }
- // c.getPA().sendFrame126("@blu@::togglege@bla@ - Toggles Grand Exchange[Currently: "+Server.getDisableGE()+"]", 8150);
- // }
- //
- // if (cmd.equalsIgnoreCase("toggleshops")) {
- // if(Server.getDisableShop()) {
- // Server.setDisableShop(false);
- // Engine.messageToAll("SERVER", "Shopping has been ENABLED by: " + c.formattedName, 2);
- // } else {
- // Server.setDisableShop(true);
- // Engine.messageToAll("SERVER", "Shopping has been DISABLED by: " + c.formattedName, 2);
- // }
- // c.getPA().sendFrame126("@blu@::toggleshops@bla@ - Toggles Shops[Currently: "+Server.getDisableShop()+"]", 8151);
- // }
- if (cmd.toLowerCase().startsWith("getip")) {
- Player otherPlayer = PlayerHandler.getPlayerHandler().getPlayer(cmd.substring(6));
- if (otherPlayer == null) {
- return;
- }
- c.sendMessage(otherPlayer.formattedName + ": " + otherPlayer.ipAddress);
- }
- if (cmd.toLowerCase().startsWith("getplayer")) {
- String ip = cmd.substring(10);
- int count = 0;
- PlayerHandler.getPlayerHandler();
- for (Player p : PlayerHandler.players) {
- if (p == null) {
- continue;
- }
- if (p.ipAddress.equals(ip)) {
- c.sendMessage("IP Match (" + p.ipAddress + "): " + p.formattedName);
- count++;
- }
- }
- if (count == 0) {
- c.sendMessage(ip + " doesn't match any players.");
- }
- }
- }
- private void hiddenAdministratorCommands(Client c, String cmd) {
- if (cmd.equalsIgnoreCase("deathon")) {
- c.canDie = true;
- c.sendMessage("WARNING: Death turned on.");
- }
- if (cmd.equalsIgnoreCase("deathoff")) {
- c.canDie = false;
- c.sendMessage("WARNING: Death turned off.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement