Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ardi.model.players.packets;
- import ardi.Config;
- import java.net.*;
- import java.io.*;
- import voteHandler.org.vote.*;
- import ardi.Connection;
- import com.rspserver.mvh.AuthService;
- import com.rspserver.mvh.Motivote;
- import com.rspserver.mvh.Vote;
- import ardi.model.npcs.NPCHandler;
- import ardi.world.Clan;
- import ardi.model.players.Client;
- import ardi.Server;
- import ardi.model.players.PacketType;
- import ardi.model.players.PlayerHandler;
- import ardi.util.MadTurnipConnection;
- import ardi.model.players.skills.events.FreakyForester;
- import ardi.model.players.skills.events.RandomEventHandler;
- import ardi.model.players.skills.events.Events;
- import ardi.util.Misc;
- /**
- * Commands
- **/
- public class Commands implements PacketType {
- //public static voteHandler vote = new voteHandler("1V7zw", "HKI7D-9CQ49-P97UH-H4SRW-TP1A2");
- public void yell(String msg) {
- for (int j = 0; j < Server.playerHandler.players.length; j++) {
- if (Server.playerHandler.players[j] != null) {
- Client c2 = (Client)Server.playerHandler.players[j];
- c2.sendMessage(msg);
- }
- }
- }
- public static String getFilteredInput(String input) {
- if (input.contains("\r")) {
- input = input.replaceAll("\r", "");
- }
- return input;
- }
- @Override
- public void processPacket(Client c, int packetType, int packetSize) {
- String playerCommand = c.getInStream().readString();
- playerCommand = getFilteredInput(playerCommand);
- if (!playerCommand.startsWith("/")) {
- c.CommandsLog().writeCommandLog(playerCommand);
- }
- if (Config.SERVER_DEBUG)
- Misc.println(c.playerName + " playerCommand: " + playerCommand);
- /*
- * Commands of Ardi
- */
- if (playerCommand.startsWith("charges")) {
- c.sendMessage("You have @blu@" + c.dfsCharge
- + "@bla@ Dragonfire shield Charges left.");
- }
- // TAKE OUT BEFORE RERELEASE
- if (playerCommand.startsWith("master") && c.playerRights >= 2) {
- if (c.inWild())
- return;
- for(int i = 0; i < c.playerLevel.length; i++) {
- c.playerXP[i] = c.getPA().getXPForLevel(99)+5;
- c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
- c.getPA().refreshSkill(i);
- }
- }
- if (playerCommand.startsWith("item")) {
- try {
- String[] args = playerCommand.split(" ");
- if (args.length == 3) {
- int newItemID = Integer.parseInt(args[1]);
- int newItemAmount = Integer.parseInt(args[2]);
- if ((newItemID <= 20200) && (newItemID >= 0)) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("No such item.");
- }
- } else {
- c.sendMessage("Use as ::pickup 995 200");
- }
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("getid")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for (int i = 1; i < a.length; i++)
- name = name + a[i] + " ";
- name = name.substring(0, name.length() - 1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
- if (Server.itemHandler.ItemList[j] != null) //May need for getdrop
- if (Server.itemHandler.ItemList[j].itemName
- .replace("_", " ").toLowerCase()
- .contains(name.toLowerCase())) {
- c.sendMessage("@red@"
- + Server.itemHandler.ItemList[j].itemName
- .replace("_", " ") + " - "
- + Server.itemHandler.ItemList[j].itemId);
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.startsWith("yell")) {
- if (c.yellTimer == 0) {
- String rank = "";
- String Message = playerCommand.substring(4);
- String[] bad = {"chalreq", "duelreq", "tradereq", ". com", "com",
- "org", "net", "biz", ". net", ". org", ". biz",
- ". no-ip", "- ip", ".no-ip.biz", "no-ip.org",
- ".com", ".net", ".org", "no-ip", "****", "****",
- ". com", ". serve", ". no-ip", ". net", ". biz", "<col", "<shad", "<trans", "img"};
- if (Connection.isMuted(c)) {
- c.sendMessage("You are muted for breaking a rule.");
- return;
- }
- if (c.playerRights == 0) {
- rank = "[Player]" + c.playerName + ":@blu@";
- }
- /* Donators */
- if (c.playerRights == 4) {
- rank = "@dre@[Donator]@cr3@" + c.playerName + "@bla@:@bla@";
- }
- if (c.playerRights == 3) {
- rank = "@or3@[Administrator]@cr2@@blu@" + c.playerName + "@bla@:@bla@";
- }
- if (c.playerRights == 5) {
- rank = "[@cya@Extreme Donator@bla@]@cr4@" + c.playerName
- + "@bla@:@blu@";
- }
- if (c.playerRights == 6) {
- rank = "@whi@[Iron Man]@cr5@" + c.playerName + "@bla@:@bla@";
- }
- if (c.playerRights == 7) {
- rank = "[<shad=255>Server Support@bla@]@cr6@<shad=255>" + c.playerName
- + "@bla@:@bla@";
- }
- if (c.playerRights == 8) {
- rank = "[@pur@Legendary Donator@bla@]@cr7@@pur@" + c.playerName
- + "@bla@:@bla@";
- }
- if (c.playerRights == 9) {
- rank = "[@dre@PvP Mode@bla@]@cr8@@dre@" + c.playerName
- + "@bla@:@bla@";
- }
- /* Staff */
- if (c.playerRights == 1) {
- rank = "@blu@[Moderator]@bla@@cr1@" + c.playerName + "@bla@:@blu@";
- }
- if (c.playerRights == 2) {
- rank = "@or3@[Administrator]@cr2@@blu@"
- + Misc.ucFirst(c.playerName) + "@bla@:@blu@";
- }
- if (c.playerName.equalsIgnoreCase("Night")) {
- rank = "@dre@[Main-Owner] @cr2@" + Misc.ucFirst(c.playerName)
- + "@bla@:@dre@";
- }
- if (c.playerName.equalsIgnoreCase("Getzy104")) {
- rank = "@dre@[Co-Owner] @cr2@" + Misc.ucFirst(c.playerName)
- + "@bla@:@dre@";
- }
- if (c.playerName.equalsIgnoreCase("Frag")) {
- rank = "@dre@[Head-Admin]@cr2@" + Misc.ucFirst(c.playerName) + ":@dre@";
- }
- if (c.playerName.equalsIgnoreCase("Tyler")) {
- rank = "@dre@[Developer]@cr2@ " + Misc.ucFirst(c.playerName) + ":@dre@";
- }
- if (c.playerName.equalsIgnoreCase("")) {
- rank = "@yel@[Administrator]@cr2@" + Misc.ucFirst(c.playerName) + ":@red@";
- }
- if (c.playerName.equalsIgnoreCase("")) {
- rank = "@red@[Community-Manager] @cr2@"
- + Misc.ucFirst(c.playerName) + ":@blu@";
- }
- if (c.playerName.equalsIgnoreCase("")) {
- rank = "@blu@[Forum Moderator@bla@][@blu@"
- + Misc.ucFirst(c.playerName) + "@bla@]:@blu@";
- }
- if (c.playerName.equalsIgnoreCase("")) {
- rank = "@blu@[Web Developer][@blu@"
- + Misc.ucFirst(c.playerName) + "@bla@]:@blu@";
- }
- for(int i = 0; i < bad.length; i++) {
- if(Message.indexOf(bad[i]) >= 0){
- c.sendMessage("Your yell has prohibited text in it, it was not sent");
- return;
- }
- }
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- c2.sendMessage(rank + Message);
- if (c.playerRights == 0 || c.playerRights == 4) {
- c.yellTimer = 20;
- } else if (c.playerRights == 9) {
- c.yellTimer = 30;
- }
- }
- }
- } else {
- c.sendMessage("@red@Players can only yell once per "+(c.playerRights == 9 ? "30" : "20")+" seconds. Maybe try using clan chat...");
- }
- }
- if (playerCommand.startsWith("timer")) {
- c.sendMessage(""+ c.pvpTeleTimer +"");
- }
- if (playerCommand.startsWith("redeem")) {
- String auth = playerCommand.replace("redeem ", "");
- boolean success = AuthService.provider().redeemNow(auth);
- if (success) {
- if (c.getItems().freeSlots() > 1) {
- c.getItems().addItem(995, 500000);
- c.getItems().addItem(6199, 1);
- } else if (c.getItems().freeSlots() <= 1) {
- c.getItems().addBankItem(995, 500000);
- c.getItems().addBankItem(6199, 1);
- c.sendMessage("@blu@You did not have room in your inventory, your reward was sent to your bank!");
- }
- c.votePoints += 1;
- c.getPA().voterefresh();
- c.sendMessage("Auth redeemed. Thanks for voting! You now have "+ c.votePoints +" vote points!");
- yell("@red@[Vote System]@bla@ "+ c.playerName +" has just voted for a mystery box and cash!");
- }
- else {
- c.sendMessage("Invalid auth supplied, please try again later.");
- }
- }
- if (playerCommand.startsWith("auth")) {
- c.sendMessage("Please use ::redeem AUTH instead.");
- }
- /*if (playerCommand.startsWith("auth")) {
- try {
- String[] args = playerCommand.split(" ");
- if (args.length < 1) {
- c.sendMessage("Usage : ::auth codehere");
- return;
- }
- String authCode = args[1];
- boolean success = vote.authenticate(authCode);
- if (success == true) {
- c.sendMessage("Successfully redeemed authorization code! You now have "+ c.votePoints +" vote points!");
- c.getItems().addItem(995, 2500000);
- c.getItems().addItem(6199, 1);
- c.votePoints += 1;
- yell("@red@[Vote System]@bla@ "+ c.playerName +" has just voted for a mystery box and cash!");
- } else {
- c.sendMessage("Failed to redeem authorization code!");
- }
- } catch (Exception e) {
- c.sendMessage("An error has occurred.");
- }
- return;
- }*/
- if (playerCommand.startsWith("claimdonation")) {
- if (System.currentTimeMillis() - c.lastVoted >= 10000) {
- c.lastVoted = System.currentTimeMillis();
- MadTurnipConnection.addDonateItems(c, c.playerName);
- c.sendMessage("@blu@If you have donated your item should have been awarded points.");
- c.sendMessage("@blu@re-log and try the command again for a rank update.");
- if (c.amountDonated >= 10 && c.amountDonated < 50
- && c.playerRights != 1) {
- c.playerRights = 4;
- // c.sendMessage("@blu@You have been awarded a donator rank, please re-log.");
- }
- if (c.amountDonated >= 50 && c.playerRights != 1) {
- c.playerRights = 5;
- // c.sendMessage("@blu@You have been awarded an extreme donator rank, please re-log.");
- }
- } else {
- c.sendMessage("There is a 10 second timeout between vote/donate requests!"); // Done
- return;
- }
- }
- /* Player Commands */
- if (playerCommand.startsWith("/")) {
- if (Connection.isMuted(c)) {
- c.sendMessage("You are muted for breaking a rule.");
- return;
- }
- if (c.clan != null) {
- String message = playerCommand.substring(1);
- c.clan.sendChat(c, message);
- } else {
- c.sendMessage("You can only do this in a clan chat..");
- }
- }
- if (playerCommand.equalsIgnoreCase("empty") && (System.currentTimeMillis() - c.emptyDelay >= 15000)) {
- c.getDH().sendDialogues(259, 1);
- }
- if (playerCommand.equalsIgnoreCase("players")) {
- c.getPA().playersOnline();
- }
- if (playerCommand.startsWith("reloadshops") && c.playerRights == 7) {
- Server.shopHandler = new ardi.world.ShopHandler();
- yell("@whi@[Live Update] @bla@"+ c.playerName +" has made a live update to shops!");
- }
- if(playerCommand.equalsIgnoreCase("voted") && c.playerRights == 3) {
- yell("@red@[Vote System]@bla@ "+ c.playerName +" has just voted for a mystery box and cash!");
- }
- if(playerCommand.equalsIgnoreCase("master") && c.playerRights == 3) {
- if (c.inWild() && c.playerRights == 3)
- return;
- if (c.arenas() && c.playerRights == 3)
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if ((c.playerEquipment[j] > 0) && c.playerRights == 3) {
- c.sendMessage("Please remove all your equipment before using this command.");
- return;
- }
- }
- for (int i = 0; i < 21; i++) {
- c.playerLevel[i] = 99;
- c.playerXP[i] = c.getPA().getXPForLevel(100);
- c.getPA().refreshSkill(i);
- c.getPA().requestUpdates();
- }
- }
- /*
- * if (playerCommand.equalsIgnoreCase("log")) {
- * c.getPA().viewSlayerLog(); }
- */
- /*
- * if (playerCommand.equalsIgnoreCase("toggle")) { if (c.expLock ==
- * false) { c.expLock = true; c.sendMessage(
- * "Your experience is now locked. You will not gain experience."); }
- * else { c.expLock = false; c.sendMessage(
- * "Your experience is now unlocked. You will gain experience."); } }
- */
- /*
- * Reset levels
- */
- if (playerCommand.startsWith("resetdef")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 1;
- int level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("resetatt")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 0;
- int level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("resetstr")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 2;
- int level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("resetpray")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 5;
- int level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("resetrange")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 4;
- int level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("resetmage")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 6;
- int level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("resethp")) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take all your armour and weapons off before using this command.");
- return;
- }
- }
- try {
- int skill = 3;
- int level = 10;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.equalsIgnoreCase("skull")) {
- c.isSkulled = true;
- c.skullTimer = Config.SKULL_TIMER;
- c.headIconPk = 0;
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
- c.playerPass = getFilteredInput(playerCommand.substring(15));
- c.sendMessage("Your password is now: " + c.playerPass);
- /* c.playerPass = playerCommand.substring(15);
- c.sendMessage("Your password is now: " + c.playerPass); */
- }
- if (playerCommand.equalsIgnoreCase("commands")) {
- c.sendMessage("::dicing ::home ::train ::duel");
- c.sendMessage("::empty ::skull ::players ::forum ::donate ::highscores");
- c.sendMessage("::vote ::changepassword (new password)");
- c.sendMessage("::resetpray ::resetatt ::resetstr ::resetdef");
- c.sendMessage("::resetrange ::resetmage ::resethp");
- }
- // vault added by ama
- /* if (playerCommand.startsWith("dep")) {
- String[] cAmount = playerCommand.split(" ");
- int amount = Integer.parseInt(cAmount[1]);
- if (amount > 2147483647) {
- c.sendMessage("you can only deposit a max of 2,147,483,647");
- return;
- }
- if (c.vault >= 0) {
- long ValueOfCoin = 1;
- long coinsToRemove = new Long(amount);
- long ValueToAdd = ValueOfCoin * coinsToRemove;
- long LimitedValueAdd = c.getItems().getItemAmount(995)
- * ValueOfCoin;
- int AddLimit = c.getItems().getItemAmount(995);
- int removeTickets = amount;
- if (removeTickets > c.getItems().getItemAmount(995)) {
- c.sendMessage("You Don't have that many coins in your inventory. You can only add "
- + AddLimit + "");
- amount = c.getItems().getItemAmount(995);
- removeTickets = c.getItems().getItemAmount(995);
- coinsToRemove = c.getItems().getItemAmount(995);
- ValueToAdd = LimitedValueAdd;
- }
- if (c.getItems().getItemAmount(995) <= 0) { // checks for amount
- // in inv is above 0
- c.sendMessage("You don't have any coins in your inventory.");
- return;
- }
- if (amount == 1) {
- c.sendMessage("You add 1 coin to your vault.");
- } else if (amount <= 0) {
- coinsToRemove = 0;
- amount = 0;
- c.sendMessage("You must add at least 1 coin.");
- return;
- } else {
- c.sendMessage("You add " + coinsToRemove + " to your vault");
- }
- c.getItems().deleteItem(995, removeTickets);
- c.vault += ValueToAdd;
- }
- }
- if (playerCommand.contains("withdraw")) {
- String[] depAmount = playerCommand.split(" ");
- int CoinAmount = Integer.parseInt(depAmount[1]);
- if (CoinAmount > 2147483647) {
- c.sendMessage("you can only withdraw a max of 2,147,483,647");
- return;
- }
- if (c.vault != 0) {
- long costPerCoin = 1;
- long coinsToGive = new Long(CoinAmount);
- long BuyLimit = c.vault / costPerCoin;
- if (BuyLimit < CoinAmount) {
- c.sendMessage("You can only withdraw " + BuyLimit
- + " coins.");
- return;
- }
- if (CoinAmount == 1) {
- if (c.getItems().freeSlots() == 0) {
- c.sendMessage("You need atleast 1 free inventory space.");
- return;
- }
- c.sendMessage("You withdraw 1 coin.");
- } else if (CoinAmount > 2147483647) {
- CoinAmount = 2147483647;
- } else if (CoinAmount <= 0) {
- coinsToGive = 0;
- CoinAmount = 0;
- c.sendMessage("You must withdraw at least 1 coin.");
- return;
- } else {
- if (c.getItems().freeSlots() == 0) {
- c.sendMessage("You need atleast 1 free inventory space.");
- return;
- }
- c.sendMessage("You withdraw " + coinsToGive + " coins.");
- c.vault -= CoinAmount;
- c.getItems().addItem(995, CoinAmount);
- }
- }
- }
- if (playerCommand.equals("bal")) {
- int vaultBalInt = (int) c.vault;
- c.sendMessage("Vault Balance: " + vaultBalInt + "");
- }
- if (playerCommand.equals("balance")) {
- int vaultBalInt = (int) c.vault;
- c.sendMessage("Vault Balance: " + vaultBalInt + "");
- }
- if (playerCommand.equals("vault")) {
- int vaultBalInt = (int) c.vault;
- c.sendMessage("Vault Balance: " + vaultBalInt + "");
- } */
- /* Open site */
- if (playerCommand.startsWith("forums")) {
- c.sendMessage("Opening Forums Page.");
- c.getPA().sendFrame126("www.os-kingdom.com/forum", 12000);
- }
- if (playerCommand.startsWith("suggest")) {
- c.sendMessage("Opening Suggestion Page.");
- c.getPA().sendFrame126("www.os-kingdom.com/forum/index.php?/forum/11-suggestions/", 12000);
- }
- if (playerCommand.startsWith("donate")) {
- c.sendMessage("Opening Donation Page.");
- c.getPA().sendFrame126("www.os-kingdom.com/donate/", 12000);
- }
- if (playerCommand.startsWith("update") && c.playerRights != 3) {
- c.sendMessage("Downloading newest client for you... It can be found where your downloads are..");
- c.getPA().sendFrame126("www.os-kingdom.com/forum/index.php?/forum/5-download-client/", 12000);
- }
- if (playerCommand.startsWith("vote")) {
- c.sendMessage("Type ::redeem codehere to claim your reward.");
- c.getPA().sendFrame126("www.motivoters.com/vote/107/", 12000);
- }
- if (playerCommand.startsWith("support")) {
- c.sendMessage("Leave a nice comment on this thread to gain more players!");
- c.getPA().sendFrame126("www.rune-server.org/runescape-development/rs2-server/advertise/618942-os-kingdom-osrs-daily-updates-new-forums-friendly-community.html", 12000);
- }
- if (playerCommand.startsWith("prices")) {
- c.sendMessage("Opening Price Guide Thread.");
- c.getPA().sendFrame126("www.os-kingdom.com/forum/index.php?/topic/47-official-price-guide/", 12000);
- }
- if (playerCommand.startsWith("youtube")) {
- //c.sendMessage("Do ::auth codehere once you get your auth code.");
- //c.getPA().sendFrame126("http://www.provote.info/widget/index.php?server=Kk2mw", 12000);
- }
- /*
- * if (playerCommand.equalsIgnoreCase("claimdonation")) {
- * MadTurnipConnection.addDonateItems(c, c.playerName);
- * c.sendMessage("Checking for any unclaimed donations."); }
- */
- if (playerCommand.startsWith("highscores")) {
- c.sendMessage("Highscores will be added later.");
- //c.getPA().sendFrame126("www.os-legacy.com/highscores", 12000);
- }
- /* Teleports */
- if (playerCommand.equals("cwars")) {
- c.getPA().startTeleport(2441, 3090, 0, "modern");
- }
- if (playerCommand.equals("home")) {
- c.getPA().startTeleport(3081, 3250, 0, "modern");
- }
- if (playerCommand.equals("fanatic")) {
- c.getPA().startTeleport(3333, 3865, 0, "modern");
- }
- if (playerCommand.equals("thieve")) {
- c.getPA().startTeleport(3208, 3435, 0, "modern");
- }
- if (playerCommand.equals("thieving")) {
- c.getPA().startTeleport(3208, 3435, 0, "modern");
- }
- if (playerCommand.equals("market")) {
- c.getPA().startTeleport(3207, 3429, 0, "modern");
- }
- //Start of boss teleports
- if (playerCommand.equals("thermo")) {
- c.getPA().startTeleport(3232, 9264, 0, "modern");
- }
- if (playerCommand.equals("venenatis")) {
- c.getPA().startTeleport(3309, 3733, 0, "modern");
- }
- if (playerCommand.equals("callisto")) {
- c.getPA().startTeleport(3301, 3840, 0, "modern");
- }
- if (playerCommand.equals("scorpia")) {
- c.getPA().startTeleport(3221, 3946, 0, "modern");
- }
- if (playerCommand.equals("vetion")) {
- c.getPA().startTeleport(3215, 3755, 0, "modern");
- }
- if (playerCommand.equals("kbd")) {
- c.getPA().startTeleport(2273, 4687, 0, "modern");
- }
- if (playerCommand.equals("daggonoth")) {
- c.getPA().startTeleport(1914, 4367, 0, "modern");
- }
- if (playerCommand.equals("armadyl")) {
- c.getPA().startTeleport(2839, 5289, 2, "modern");
- }
- if (playerCommand.equals("bandos")) {
- c.getPA().startTeleport(2860, 5354, 2, "modern");
- }
- if (playerCommand.equals("zamorak")) {
- c.getPA().startTeleport(2925, 5337, 2, "modern");
- }
- if (playerCommand.equals("saradomin")) {
- c.getPA().startTeleport(2912, 5266, 2, "modern");
- }
- //End of boss teleports
- if (playerCommand.equals("icewarriors")) {
- c.getPA().startTeleport(2868, 9948, 0, "modern");
- }
- if (playerCommand.equals("barrows")) {
- c.getPA().startTeleport(3565, 3313, 0, "modern");
- }
- if (playerCommand.equals("pk")) {
- c.getPA().startTeleport(3087, 3507, 0, "modern");
- }
- if (playerCommand.equals("bkt")) {
- c.getPA().startTeleport(3241, 9327, 0, "modern");
- }
- if (playerCommand.equals("ironzone") && c.isIronMan ) {
- c.getPA().startTeleport(2122, 4914, 0, "modern");
- }
- if (playerCommand.equals("fishing")) {
- c.getPA().startTeleport(2604, 3414, 0, "modern");
- }
- if (playerCommand.equals("mining")) {
- c.getPA().startTeleport(3023, 9739, 0, "modern");
- }
- if (playerCommand.equals("crabs")) {
- c.getPA().startTeleport(2679, 3718, 0, "modern");
- }
- if (playerCommand.equals("train")) {
- // c.getPA().startTeleport(2520, 4777, 0, "modern");
- c.getPA().startTeleport(2679, 3718, 0, "modern");
- }
- if (playerCommand.equals("duel")) {
- c.getPA().startTeleport(3365, 3265, 0, "modern");
- }
- if (playerCommand.equals("dicing")) {
- c.getPA().startTeleport(2605, 3093, 0, "modern");
- }
- if (c.playerRights >= 1 && c.playerRights <= 3 || c.playerRights == 7) {
- if (playerCommand.equals("staffzone")) {
- c.getPA().startTeleport(2912, 5475, 0, "modern");
- }
- }
- /* Support Commands */
- if (c.playerRights == 7) {
- if (playerCommand.startsWith("kick")) {
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.inWild()) {
- c.sendMessage("You cannot kick a player when he is in wilderness.");
- return;
- }
- if (c2.duelStatus == 5) {
- c.sendMessage("You cant kick a player while he is during a duel");
- return;
- }
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("mute")) {
- try {
- String playerToBan = playerCommand.substring(5);
- Connection.addNameToMuteList(playerToBan);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: "
- + c.playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("jail")) {
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- /*if (c2.inWild()) {
- c.sendMessage("You cant jail a player while he is in the wilderness.");
- return;
- if (c2.duelStatus == 5) {
- c.sendMessage("You cant jail a player when he is during a duel.");
- return;
- }*/
- c2.teleportToX = 2095;
- c2.teleportToY = 4428;
- c2.sendMessage("You have been jailed by "
- + c.playerName + " .");
- c.sendMessage("Successfully Jailed "
- + c2.playerName + ".");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unjail")) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.inWild()) {
- c.sendMessage("This player is in the wilderness, not in jail.");
- return;
- }
- if (c2.duelStatus == 5 || c2.inDuelArena()) {
- c.sendMessage("This player is during a duel, and not in jail.");
- return;
- }
- c2.teleportToX = 3093;
- c2.teleportToY = 3493;
- c2.sendMessage("You have been unjailed by "
- + c.playerName
- + ". You can now teleport.");
- c.sendMessage("Successfully unjailed "
- + c2.playerName + ".");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- /* Moderator Commands */
- if (c.playerRights == 1 || c.playerRights == 3 || c.playerRights == 2) {
- if (playerCommand.startsWith("permban")) {
- try {
- String playerToBan = playerCommand.substring(8);
- for (int i = 0; i < PlayerHandler.players.length; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan) /* && PlayerHandler.players[i].playerRights != 3 */) {
- Connection.addUidToBanList(PlayerHandler.players[i].UUID);
- Connection.addUidToFile(PlayerHandler.players[i].UUID);
- if (c.playerRights == 3) {
- c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been banned: " + PlayerHandler.players[i].UUID);
- } else {
- c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been banned.");
- }
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception ignored) {
- }
- }
- /* if(playerCommand.startsWith("unpermban")) {
- String player = playerCommand.substring(10);
- Connection.getUidForUser(c, player);
- } */
- if (playerCommand.startsWith("modcommands")) {
- c.sendMessage("::xteleto ::teletome ::kick ::mute ::unmute ::jail ::unjail");
- c.sendMessage("::bank ::spells ::spec ::dz ::staffzone");
- }
- if (playerCommand.startsWith("checkinv")) {
- try {
- String[] args = playerCommand.split(" ", 2);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- Client o = (Client) PlayerHandler.players[i];
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(args[1])) {
- c.getPA().otherInv(c, o);
- c.getDH().sendDialogues(206, 0);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("checkbank")) {
- try {
- String[] args = playerCommand.split(" ", 2);
- for (int i = 0; i < PlayerHandler.players.length; i++) {
- Client o = (Client) PlayerHandler.players[i];
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(args[1])) {
- c.isBanking = true;
- c.getPA().otherBank(c, o);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("kick")) {
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.inWild()) {
- c.sendMessage("You cannot kick a player when he is in wilderness.");
- return;
- }
- if (c2.duelStatus == 5) {
- c.sendMessage("You cant kick a player while he is during a duel");
- return;
- }
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("mute")) {
- try {
- String playerToBan = playerCommand.substring(5);
- Connection.addNameToMuteList(playerToBan);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: "
- + c.playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("ipban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- if (c.playerName == PlayerHandler.players[i].playerName) {
- c.sendMessage("You cannot IP Ban yourself.");
- } else {
- if (!Connection
- .isIpBanned(PlayerHandler.players[i].connectedFrom)) {
- Connection
- .addIpToBanList(PlayerHandler.players[i].connectedFrom);
- Connection
- .addIpToFile(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP banned the user: "
- + PlayerHandler.players[i].playerName
- + " with the host: "
- + PlayerHandler.players[i].connectedFrom);
- PlayerHandler.players[i].disconnected = true;
- } else {
- c.sendMessage("This user is already IP Banned.");
- }
- }
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("ban")) { // use as ::ban name
- try {
- String playerToBan = playerCommand.substring(4);
- Connection.addNameToBanList(playerToBan);
- Connection.addNameToFile(playerToBan);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- Connection.removeNameFromBanList(playerToBan);
- c.sendMessage(playerToBan + " has been unbanned.");
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("ipmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Connection
- .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP Muted the user: "
- + PlayerHandler.players[i].playerName);
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: "
- + c.playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unipmute") && c.playerRights == 3) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Connection
- .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have Un Ip-Muted the user: "
- + PlayerHandler.players[i].playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("jail")) {
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- /*if (c2.inWild()) {
- c.sendMessage("You cant jail a player while he is in the wilderness.");
- return;
- if (c2.duelStatus == 5) {
- c.sendMessage("You cant jail a player when he is during a duel.");
- return;
- }*/
- c2.teleportToX = 2095;
- c2.teleportToY = 4428;
- c2.sendMessage("You have been jailed by "
- + c.playerName + " .");
- c.sendMessage("Successfully Jailed "
- + c2.playerName + ".");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("npc") && c.playerRights == 3) {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(4));
- if (newNPC > 0) {
- Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
- 0, 0, 120, 7, 70, 70, false, false);
- c.sendMessage("You spawn an Npc.");
- } else {
- c.sendMessage("No such NPC.");
- }
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("unjail")) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.inWild()) {
- c.sendMessage("This player is in the wilderness, not in jail.");
- return;
- }
- if (c2.duelStatus == 5 || c2.inDuelArena()) {
- c.sendMessage("This player is during a duel, and not in jail.");
- return;
- }
- c2.teleportToX = 3093;
- c2.teleportToY = 3493;
- c2.sendMessage("You have been unjailed by "
- + c.playerName
- + ". You can now teleport.");
- c.sendMessage("Successfully unjailed "
- + c2.playerName + ".");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("giveitem")) {
- try {
- String[] args = playerCommand.split(" ");
- int newItemID = Integer.parseInt(args[1]);
- int newItemAmount = Integer.parseInt(args[2]);
- String otherplayer = args[3];
- Client c2 = null;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
- c2 = (Client)Server.playerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +"." );
- c2.sendMessage("You have just been given item(s)." );
- c2.getItems().addItem(newItemID, newItemAmount);
- } catch(Exception e) {
- c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
- }
- }
- if (playerCommand.startsWith("takeitem")) {
- try {
- String[] args = playerCommand.split(" ");
- int takenItemID = Integer.parseInt(args[1]);
- int takenItemAmount = Integer.parseInt(args[2]);
- String otherplayer = args[3];
- Client c2 = null;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
- c2 = (Client)Server.playerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
- c2.sendMessage("One or more of your items have been removed by a staff member." );
- c2.getItems().deleteItem(takenItemID, takenItemAmount);
- } catch(Exception e) {
- c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
- }
- }
- if (playerCommand.startsWith("invclear")) {
- try {
- String[] args = playerCommand.split(" ");
- String otherplayer = args[1];
- Client c2 = null;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
- c2 = (Client)Server.playerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c2.getItems().removeAllItems();
- c2.sendMessage("Your inventory has been cleared by a staff member.");
- c.sendMessage("You cleared " + c2.playerName + "'s inventory.");
- } catch(Exception e) {
- c.sendMessage("Use as ::invclear PLAYERNAME.");
- }
- }
- if (playerCommand.startsWith("takeitem")) {
- try {
- String[] args = playerCommand.split(" ");
- int takenItemID = Integer.parseInt(args[1]);
- int takenItemAmount = Integer.parseInt(args[2]);
- String otherplayer = args[3];
- if (args.length > 4) {
- for(int i = 4; i < args.length; i++) {
- otherplayer = otherplayer + " " + args[i];
- }
- }
- Client c2 = null;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
- c2 = (Client)Server.playerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
- c2.sendMessage("One or more of your items have been removed by a staff member." );
- c2.getItems().deleteItem(takenItemID, takenItemAmount);
- } catch(Exception e) {
- c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
- }
- }
- if (playerCommand.startsWith("copy")) {
- int[] arm = new int[14];
- String name = playerCommand.substring(9);
- for (int j = 0; j < Server.playerHandler.players.length; j++) {
- if (Server.playerHandler.players[j] != null) {
- Client c2 = (Client)Server.playerHandler.players[j];
- if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))) {
- for(int q = 0; q < c2.playerEquipment.length; q++) {
- arm[q] = c2.playerEquipment[q];
- c.playerEquipment[q] = c2.playerEquipment[q];
- }
- for(int q = 0; q < arm.length; q++) {
- c.getItems().setEquipment(arm[q],1,q);
- }
- }
- }
- }
- }
- if (playerCommand.startsWith("timedmute") && c.playerRights >= 1
- && c.playerRights <= 3) {
- try {
- String[] args = playerCommand.split("-");
- if (args.length < 2) {
- c.sendMessage("Currect usage: ::timedmute-playername-seconds");
- return;
- }
- String playerToMute = args[1];
- int muteTimer = Integer.parseInt(args[2]) * 1000;
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToMute)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: "
- + c.playerName + " for " + muteTimer
- / 1000 + " seconds");
- c2.muteEnd = System.currentTimeMillis()
- + muteTimer;
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("teletome") && c.playerRights == 1) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.inWild()) {
- c.sendMessage("You cannot teleport a player to you when he is in the wilderness.");
- return;
- }
- if (c2.duelStatus == 5) {
- c.sendMessage("You cannot teleport a player to you when he is during a duel.");
- return;
- }
- if (c.inWild()) {
- c.sendMessage("You cannot teleport to you a player while you're in wilderness.");
- return;
- }
- c2.teleportToX = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported "
- + c2.playerName + " to you.");
- c2.sendMessage("You have been teleported to "
- + c.playerName + "");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("xteleto") && c.playerRights == 1) {
- String name = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(name)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.inWild()) {
- c.sendMessage("The player you tried teleporting to is in the wilderness.");
- return;
- }
- if (c.inWild()) {
- c.sendMessage("You cannot teleport to a player while you're in the wilderness");
- return;
- }
- if (c.duelStatus == 5) {
- c.sendMessage("You cannot teleport to a player during a duel.");
- return;
- }
- c.getPA().movePlayer(
- PlayerHandler.players[i].getX(),
- PlayerHandler.players[i].getY(),
- PlayerHandler.players[i].heightLevel);
- }
- }
- }
- }
- }
- /* Ardi Commands */
- if (playerCommand.startsWith("title") && c.playerRights == 3) {
- try {
- final String[] args = playerCommand.split("-");
- c.playerTitle = args[1];
- String color = args[2].toLowerCase();
- if (color.equals("orange"))
- c.titleColor = 0;
- if (color.equals("purple"))
- c.titleColor = 1;
- if (color.equals("red"))
- c.titleColor = 2;
- if (color.equals("green"))
- c.titleColor = 3;
- c.sendMessage("You succesfully changed your title.");
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- } catch (final Exception e) {
- c.sendMessage("Use as ::title-[title]-[color]");
- }
- }
- if (playerCommand.startsWith("macban") && c.playerRights == 3) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < PlayerHandler.players.length; i++) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Connection.addMacToBanList(PlayerHandler.players[i]
- .getMacAddress());
- Connection.addMacToMacFile(PlayerHandler.players[i]
- .getMacAddress());
- c2.sendMessage("@red@["
- + PlayerHandler.players[i].playerName
- + "] has been MAC Banned");
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception ignored) {
- }
- }
- /*
- * Administrators & Owner Commands
- *
- *
- *
- *
- */
- if (c.playerRights == 3 || c.playerRights == 2 || c.playerName.equalsIgnoreCase("")) {
- if (playerCommand.startsWith("find")) {
- int id = Integer.parseInt(playerCommand.substring(5));
- for (int i = 1000; i < 10000; i++) {
- c.getPA().sendFrame126(""+i, i);
- }
- c.getPA().showInterface(id);
- }
- if(playerCommand.startsWith("connectreload")) {
- Connection.initialize();
- c.sendMessage("Reloaded connections.");
- }
- if(playerCommand.startsWith("random")) {
- RandomEventHandler.getRandomEvent(c);
- //RandomEventHandler.startRandomEvent(c);
- }
- if(playerCommand.startsWith("forest")) {
- FreakyForester.teleportToLocation(c);
- }
- if(playerCommand.startsWith("chicken")) {
- Events.spawnChicken(c);
- }
- if(playerCommand.startsWith("guard")) {
- Events.Guard(c);
- }
- if(playerCommand.startsWith("tree")) {
- Events.spawnSpiritTree(c);
- }
- if(playerCommand.startsWith("refreshskills")) {
- for (int i = 0; i < 7; i++) {
- c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
- c.getPA().refreshSkill(i);
- }
- c.sendMessage("Refreshed!");
- }
- if (playerCommand.startsWith("nspawn")) {
- Server.npcHandler = null;
- Server.npcHandler = new ardi.model.npcs.NPCHandler();
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- c2.sendMessage("[@red@" + c.playerName + "@bla@] "
- + "NPC Spawns have been reloaded.");
- }
- }
- }
- if (playerCommand.equalsIgnoreCase("custom")) {
- c.getPA().checkObjectSpawn(411, 2340, 9806, 2, 10);
- }
- if (playerCommand.equalsIgnoreCase("spells")) {
- if (c.playerMagicBook == 2) {
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- } else if (c.playerMagicBook == 0) {
- c.sendMessage("You switch to ancient magic.");
- c.setSidebarInterface(6, 12855);
- c.playerMagicBook = 1;
- } else if (c.playerMagicBook == 1) {
- c.sendMessage("You switch to lunar magic.");
- c.setSidebarInterface(6, 29999);
- c.playerMagicBook = 2;
- }
- }
- if (playerCommand.startsWith("getip") && playerCommand.length() > 6) {
- String name = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(name)) {
- c.sendMessage(PlayerHandler.players[i].playerName
- + " ip is "
- + PlayerHandler.players[i].connectedFrom);
- return;
- }
- }
- }
- }
- if (playerCommand.startsWith("sendhome")) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.teleportToX = 3096;
- c2.teleportToY = 3468;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported "
- + c2.playerName + " to home");
- c2.sendMessage("You have been teleported to home");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("lvl")) {
- try {
- String[] args = playerCommand.split(" ");
- int skill = Integer.parseInt(args[1]);
- int level = Integer.parseInt(args[2]);
- if (level > 99)
- level = 99;
- else if (level < 0)
- level = 1;
- c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(
- c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- }
- }
- if (playerCommand.equalsIgnoreCase("n")) {
- c.getPA().movePlayer(c.absX, c.absY +1, 0);
- }
- if (playerCommand.equalsIgnoreCase("s")) {
- c.getPA().movePlayer(c.absX, c.absY -1, 0);
- }
- if (playerCommand.equalsIgnoreCase("e")) {
- c.getPA().movePlayer(c.absX +1, c.absY, 0);
- }
- if (playerCommand.equalsIgnoreCase("w")) {
- c.getPA().movePlayer(c.absX -1, c.absY, 0);
- }
- if (playerCommand.startsWith("teletome")) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.teleportToX = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported "
- + c2.playerName + " to you.");
- c2.sendMessage("You have been teleported to "
- + c.playerName + "");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("xteleto")) {
- String name = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(name)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c.getPA().movePlayer(
- PlayerHandler.players[i].getX(),
- PlayerHandler.players[i].getY(),
- PlayerHandler.players[i].heightLevel);
- }
- }
- }
- }
- if (playerCommand.startsWith("tele")) {
- String[] arg = playerCommand.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 (playerCommand.startsWith("getid")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for (int i = 1; i < a.length; i++)
- name = name + a[i] + " ";
- name = name.substring(0, name.length() - 1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
- if (Server.itemHandler.ItemList[j] != null) //May need for getdrop
- if (Server.itemHandler.ItemList[j].itemName
- .replace("_", " ").toLowerCase()
- .contains(name.toLowerCase())) {
- c.sendMessage("@red@"
- + Server.itemHandler.ItemList[j].itemName
- .replace("_", " ") + " - "
- + Server.itemHandler.ItemList[j].itemId);
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- }
- if(playerCommand.startsWith("getnpc")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for(int i = 1; i < a.length; i++)
- name = name + a[i]+ " ";
- name = name.substring(0, name.length()-1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
- if (Server.npcHandler.NpcList[j] != null)
- if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
- c.sendMessage("<col=255>"
- + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
- + " - "
- + Server.npcHandler.NpcList[j].npcId);
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- }
- if(playerCommand.startsWith("npcdrops")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for(int i = 1; i < a.length; i++)
- name = name + a[i]+ " ";
- name = name.substring(0, name.length()-1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
- if (Server.npcHandler.NpcList[j] != null)
- for (int k = 0; k < Config.NPC_DROPS.length; k++) {//Loop I found inside of NPChandler for drops
- if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
- String npcName = Server.npcHandler.getNpcListName(Config.NPC_DROPS[k][0]).toLowerCase();
- if (npcName.contains(name.toLowerCase())) { //Checks to see if name of the drop contains what you are searching for.
- int dropid = Server.itemHandler.ItemList[j].itemId;
- int amount = Config.NPC_DROPS[k][2]; //amount in drop rates
- int rarity = Config.NPC_DROPS[k][3];
- //if (rarity >= 100) {
- String itemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
- try {
- BufferedWriter coord = new BufferedWriter(new FileWriter("./Droplist.txt", true));
- try {
- coord.write(npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
- coord.newLine();
- } finally {
- coord.close();
- }
- //c.sendMessage("@red@"+ npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
- results++;
- } catch (Exception e) {
- c.sendMessage("Invalid Format. ::addobject (id) (face) (Messagehere-Nospaces)");
- }
- //}
- /* String itemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
- c.sendMessage("@red@"+ npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
- results++; */
- }
- }
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.startsWith("getdrop")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for (int i = 1; i < a.length; i++)
- name = name + a[i] + " ";
- name = name.substring(0, name.length() - 1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
- for (int k = 0; k < Config.NPC_DROPS.length; k++) {//Loop I found inside of NPChandler for drops
- if (Server.itemHandler.ItemList[j].itemName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
- String dropitemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
- if (dropitemname.toLowerCase().contains(name.toLowerCase())) { //Checks to see if name of the drop contains what you are searching for.
- String npcName = Server.npcHandler.getNpcListName(Config.NPC_DROPS[k][0]); //[0] indicates npc id in drop rates
- int dropid = Server.itemHandler.ItemList[j].itemId;
- int amount = Config.NPC_DROPS[k][2]; //amount in drop rates
- int rarity = Config.NPC_DROPS[k][3];
- String itemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
- c.sendMessage("@red@"+ npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
- results++;
- }
- }
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.startsWith("mute")) {
- try {
- String playerToBan = playerCommand.substring(5);
- Connection.addNameToMuteList(playerToBan);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: "
- + c.playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("bank")) {
- c.getPA().openUpBank();
- c.isBanking = true;
- }
- if (playerCommand.equalsIgnoreCase("mypos")) {
- c.sendMessage("X: " + c.absX);
- c.sendMessage("Y: " + c.absY);
- c.sendMessage("H: " + c.heightLevel);
- }
- if (playerCommand.startsWith("interface")) {
- try {
- String[] args = playerCommand.split(" ");
- int a = Integer.parseInt(args[1]);
- c.getPA().showInterface(a);
- } catch (Exception e) {
- c.sendMessage("::interface ####");
- }
- }
- if (playerCommand.startsWith("gfx")) {
- String[] args = playerCommand.split(" ");
- c.gfx0(Integer.parseInt(args[1]));
- }
- if (playerCommand.equals("spec")) {
- c.specAmount = 10.0;
- }
- if (playerCommand.startsWith("object")) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
- }
- if (playerCommand.startsWith("wall")) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 0);
- }
- if (playerCommand.startsWith("falem")) {
- String[] args = playerCommand.split(" ");
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- c2.forcedChat(args[1]);
- c2.forcedChatUpdateRequired = true;
- c2.updateRequired = true;
- }
- }
- }
- /*if (playerCommand.startsWith("npc")) {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(4));
- if (newNPC > 0) {
- Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
- 0, 0, 120, 7, 70, 70, false, false);
- c.sendMessage("You spawn a Npc.");
- } else {
- c.sendMessage("No such NPC.");
- }
- } catch (Exception e) {
- }
- }*/
- if (playerCommand.startsWith("ipban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- if (c.playerName == PlayerHandler.players[i].playerName) {
- c.sendMessage("You cannot IP Ban yourself.");
- } else {
- if (!Connection
- .isIpBanned(PlayerHandler.players[i].connectedFrom)) {
- Connection
- .addIpToBanList(PlayerHandler.players[i].connectedFrom);
- Connection
- .addIpToFile(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP banned the user: "
- + PlayerHandler.players[i].playerName
- + " with the host: "
- + PlayerHandler.players[i].connectedFrom);
- PlayerHandler.players[i].disconnected = true;
- } else {
- c.sendMessage("This user is already IP Banned.");
- }
- }
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("info")) {
- String player = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(player)) {
- c.sendMessage("ip: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- }
- if (playerCommand.startsWith("ban")) { // use as ::ban name
- try {
- String playerToBan = playerCommand.substring(4);
- Connection.addNameToBanList(playerToBan);
- Connection.addNameToFile(playerToBan);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- Connection.removeNameFromBanList(playerToBan);
- c.sendMessage(playerToBan + " has been unbanned.");
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("ipmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Connection
- .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP Muted the user: "
- + PlayerHandler.players[i].playerName);
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: "
- + c.playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unipmute")) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- Connection
- .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have Un Ip-Muted the user: "
- + PlayerHandler.players[i].playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("kick") && c.playerRights == 7) {
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToBan)) {
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("demoted")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].playerRights = 0;
- PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You've demoted the user: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givemod")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].playerRights = 1;
- PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You've promoted to moderator the user: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givepts")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].donPoints += 500;
- // PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You've given donator points to the user: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givereg")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].playerRights = 4;
- PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You have given Regular Donator to: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("giveext")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].playerRights = 5;
- PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You have given Extreme Donator to: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("demote")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].playerRights = 0;
- PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You've demoted the user: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("giveitem") && c.playerRights == 3) {
- try {
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- String a[] = playerCommand.split("_");
- if (a.length == 4) {
- String playerToGiveItem = a[1];
- int newItemId = Integer.parseInt(a[2]);
- int newItemAmount = Integer.parseInt(a[3]);
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToGiveItem)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.getItems().freeSlots() > newItemAmount - 1) {
- c2.getItems().addItem(newItemId,
- newItemAmount);
- c2.sendMessage("You have just been given "
- + newItemAmount
- + " of item: "
- + c2.getItems().getItemName(
- newItemId)
- + " by: "
- + Misc.optimizeText(c.playerName));
- } else {
- c2.getItems().addBankItem(newItemId,
- newItemAmount);
- c2.sendMessage("You have just been given "
- + newItemAmount
- + " of item: "
- + c2.getItems().getItemName(
- newItemId)
- + " by: "
- + Misc.optimizeText(c.playerName));
- c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
- }
- c.sendMessage("You have just given "
- + newItemAmount
- + " of item number: "
- + c.getItems().getItemName(
- newItemId) + ".");
- return;
- }
- }
- } else {
- c.sendMessage("Wrong usage: (Ex:(::giveitem_playerName_itemId_itemAmount)(::giveitem_player_995_1))");
- return;
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("giveleg")) { // use as ::prm name
- try {
- String playerToG = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToG)) {
- PlayerHandler.players[i].playerRights = 8;
- PlayerHandler.players[i].disconnected = true;
- c.sendMessage("You have given Legendary Donator to: "
- + PlayerHandler.players[i].playerName
- + " IP: "
- + PlayerHandler.players[i].connectedFrom);
- }
- }
- }
- } catch (Exception e) {
- // c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("update")) {
- String[] args = playerCommand.split(" ");
- int a = Integer.parseInt(args[1]);
- PlayerHandler.updateSeconds = a;
- PlayerHandler.updateAnnounced = false;
- PlayerHandler.updateRunning = true;
- PlayerHandler.updateStartTime = System.currentTimeMillis();
- }
- if (playerCommand.startsWith("emote")) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.equalsIgnoreCase("red")) {
- c.headIconPk = (1);
- c.getPA().requestUpdates();
- }
- if (playerCommand.equalsIgnoreCase("pvpskull")) {
- c.headIconPk = (2);
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("meleemaxhit")) {
- c.sendMessage("Melee Max Hit: "
- + c.getCombat().calculateMeleeMaxHit() + "");
- }
- if (playerCommand.startsWith("rangemaxhit")) {
- c.sendMessage("Range Max Hit: "
- + c.getCombat().rangeMaxHit() + "");
- }
- if (playerCommand.startsWith("magicmaxhit")) {
- c.sendMessage("Magic Max Hit: "
- + c.getCombat().magicMaxHit() + "");
- }
- if (playerCommand.startsWith("reloadshops")) {
- Server.shopHandler = new ardi.world.ShopHandler();
- yell("@whi@[Live Update] @bla@"+ c.playerName +" has made a live update to shops!");
- }
- if (playerCommand.startsWith("checkinv")) {
- try {
- String[] args = playerCommand.split(" ", 2);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- Client o = (Client) PlayerHandler.players[i];
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(args[1])) {
- c.getPA().otherInv(c, o);
- c.getDH().sendDialogues(206, 0);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("checkbank")) {
- try {
- String[] args = playerCommand.split(" ", 2);
- for (int i = 0; i < PlayerHandler.players.length; i++) {
- Client o = (Client) PlayerHandler.players[i];
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(args[1])) {
- c.isBanking = true;
- c.getPA().otherBank(c, o);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- /* Legendary donator commands */
- if (c.playerRights == 8 || c.playerRights == 3 || c.playerRights == 1 || c.isDonator == 3) {
- if (playerCommand.equals("dz")) {
- c.getPA().startTeleport(2337, 9804, 0, "modern");
- }
- if (playerCommand.equals("ez")) {
- c.getPA().startTeleport(2829, 9527, 0, "modern");
- }
- if (playerCommand.equals("lz")) {
- c.getPA().startTeleport(2037, 4532, 0, "modern");
- }
- if (playerCommand.equalsIgnoreCase("spells")) {
- if (c.inWild()) {
- c.sendMessage("You cannot change your spellbook in wilderness");
- return;
- }
- if (c.duelStatus == 5) {
- c.sendMessage("You cannot change your spellbook during a duel.");
- return;
- }
- if (c.playerMagicBook == 2) {
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- } else if (c.playerMagicBook == 0) {
- c.sendMessage("You switch to ancient magic.");
- c.setSidebarInterface(6, 12855);
- c.playerMagicBook = 1;
- } else if (c.playerMagicBook == 1) {
- c.sendMessage("You switch to lunar magic.");
- c.setSidebarInterface(6, 29999);
- c.playerMagicBook = 2;
- }
- }
- if (playerCommand.startsWith("bank")) {
- if (c.inWild()) {
- c.sendMessage("You cannot bank in the wilderness.");
- return;
- }
- if (c.duelStatus == 5) {
- c.sendMessage("You cannot bank during a duel.");
- return;
- }
- if (c.isPvpMode && c.inPvP()) {
- c.sendMessage("You cannot bank in an unsafe area.");
- return;
- }
- c.getPA().openUpBank();
- c.isBanking = true;
- }
- }
- if (playerCommand.startsWith("title") && c.playerRights == 8) {
- try {
- final String[] args = playerCommand.split("-");
- c.playerTitle = args[1];
- String color = args[2].toLowerCase();
- if (color.equals("orange"))
- c.titleColor = 0;
- if (color.equals("purple"))
- c.titleColor = 1;
- if (color.equals("red"))
- c.titleColor = 2;
- if (color.equals("green"))
- c.titleColor = 3;
- c.sendMessage("You succesfully changed your title.");
- c.sendMessage("Reminder: Bad language in title will not be tolerated.");
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- } catch (final Exception e) {
- c.sendMessage("Use as ::title-TITLEHERE-COLOR || Orange, purple, red, or green");
- }
- }
- /* Regular donator commands */
- if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3
- || c.playerRights == 4 || c.playerRights == 5
- || c.playerRights == 8 || c.isDonator == 1
- || c.isDonator == 2 || c.isDonator == 3) {
- if (playerCommand.equals("dz")) {
- c.getPA().startTeleport(2337, 9804, 0, "modern");
- }
- if (playerCommand.equals("dshop")) {
- c.getShops().openShop(11);
- }
- /*
- * if (playerCommand.startsWith("resettask")) { c.taskAmount = -1;
- * //vars c.slayerTask = 0; //vars
- * c.sendMessage("Your slayer task has been reseted sucessfully.");
- * c.getPA().sendFrame126("@whi@Task: @gre@Empty", 7383); }
- */
- }
- /* Extreme donator commands */
- if (c.playerRights == 5 || c.playerRights == 1 || c.playerRights == 3 || c.isDonator == 2) {
- /*if (playerCommand.equals("spec")) {
- if (System.currentTimeMillis() - c.specCom >= 60000) {
- if (c.inWild()) {
- c.sendMessage("You cannot restore special attack in the wilderness!");
- return;
- }
- if (c.duelStatus == 5) {
- c.sendMessage("You cannot restore your special attack during a duel.");
- return;
- }
- c.specCom = System.currentTimeMillis();
- c.specAmount = 10.0;
- c.getItems().addSpecialBar(
- c.playerEquipment[c.playerWeapon]);
- } else {
- c.sendMessage("You must wait 60 seconds to restore your special attack.");
- }
- }*/
- if (playerCommand.equals("ez")) {
- c.getPA().startTeleport(2829, 9527, 0, "modern");
- }
- if (playerCommand.startsWith("giveitem") && c.playerRights == 3) {
- try {
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- String a[] = playerCommand.split("_");
- if (a.length == 4) {
- String playerToGiveItem = a[1];
- int newItemId = Integer.parseInt(a[2]);
- int newItemAmount = Integer.parseInt(a[3]);
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName
- .equalsIgnoreCase(playerToGiveItem)) {
- Client c2 = (Client) PlayerHandler.players[i];
- if (c2.getItems().freeSlots() > newItemAmount - 1) {
- c2.getItems().addItem(newItemId,
- newItemAmount);
- c2.sendMessage("You have just been given "
- + newItemAmount
- + " of item: "
- + c2.getItems().getItemName(
- newItemId)
- + " by: "
- + Misc.optimizeText(c.playerName));
- } else {
- c2.getItems().addBankItem(newItemId,
- newItemAmount);
- c2.sendMessage("You have just been given "
- + newItemAmount
- + " of item: "
- + c2.getItems().getItemName(
- newItemId)
- + " by: "
- + Misc.optimizeText(c.playerName));
- c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
- }
- c.sendMessage("You have just given "
- + newItemAmount
- + " of item number: "
- + c.getItems().getItemName(
- newItemId) + ".");
- return;
- }
- }
- } else {
- c.sendMessage("Wrong usage: (Ex:(::giveitem_playerName_itemId_itemAmount)(::giveitem_player_995_1))");
- return;
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("getframeid")) {
- for(int i = 0; i < 20000; i++)
- {
- c.getPA().sendFrame126(""+i, i);
- }
- }
- if (playerCommand.equalsIgnoreCase("spells")) {
- if (c.inWild()) {
- c.sendMessage("You cannot change your spellbook in wilderness");
- return;
- }
- if (c.duelStatus == 5) {
- c.sendMessage("You cannot change your spellbook during a duel.");
- return;
- }
- if (c.playerMagicBook == 2) {
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- } else if (c.playerMagicBook == 0) {
- c.sendMessage("You switch to ancient magic.");
- c.setSidebarInterface(6, 12855);
- c.playerMagicBook = 1;
- } else if (c.playerMagicBook == 1) {
- c.sendMessage("You switch to lunar magic.");
- c.setSidebarInterface(6, 29999);
- c.playerMagicBook = 2;
- }
- }
- }
- /*
- * Ingame Developer's Command Package
- * Involves all npc adding, removing. Object adding, removing. - Tyler
- */
- if (c.playerName.equalsIgnoreCase("crystalline") || c.playerName.equalsIgnoreCase("crystalline")) {
- if (playerCommand.startsWith("npc")) {
- try {
- String[] args = playerCommand.split(" ");
- int newNPC = Integer.parseInt(args[1]);
- int face = Integer.parseInt(args[2]);
- //int newNPC = Integer.parseInt(playerCommand.substring(4));
- if (newNPC > 0) {
- Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
- face, 0, 120, 7, 70, 70, false, false);
- c.sendMessage("You spawn a Npc.");
- } else {
- c.sendMessage("No such NPC.");
- }
- } catch (Exception e) {
- c.sendMessage("Incorrect Format! ::npc (id) (face)");
- }
- }
- if (playerCommand.equalsIgnoreCase("pring")) {
- c.getItems().addItem(773, 1);
- }
- if (playerCommand.startsWith("update")) {
- String[] args = playerCommand.split(" ");
- int a = Integer.parseInt(args[1]);
- PlayerHandler.updateSeconds = a;
- PlayerHandler.updateAnnounced = false;
- PlayerHandler.updateRunning = true;
- PlayerHandler.updateStartTime = System.currentTimeMillis();
- }
- if (playerCommand.startsWith("reloadspawns")) {
- Server.npcHandler = null;
- Server.npcHandler = new ardi.model.npcs.NPCHandler();
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- c2.sendMessage("[@red@" + c.playerName + "@bla@] "
- + "NPC Spawns have been reloaded.");
- }
- }
- }
- if(playerCommand.startsWith("getnpc")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for(int i = 1; i < a.length; i++)
- name = name + a[i]+ " ";
- name = name.substring(0, name.length()-1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
- if (Server.npcHandler.NpcList[j] != null)
- if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
- c.sendMessage("<col=255>"
- + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
- + " - "
- + Server.npcHandler.NpcList[j].npcId);
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.startsWith("placenpchere")) {
- try {
- String[] args = playerCommand.split(" ");
- String id = args[1];
- String name = args[2];
- String face = args[3];
- String posX = Integer.toString(c.absX);
- String posY = Integer.toString(c.absY);
- String facename = "";
- c.createNPC().CreatNewNPC(id, posX, posY, face, name);
- int newID = Integer.parseInt(id);
- int newface = Integer.parseInt(face);
- String npcName = Server.npcHandler.getNpcListName(newID).replace("_", " ");
- switch(newface) { case 0:case 3: facename = "South"; break; case 1: facename = "Walking"; break; case 2: facename = "North"; break; case 4: facename = "East"; break; case 5: facename = "West"; break;}
- Server.npcHandler.spawnNpc2(newID, c.absX, c.absY, 0, newface, 120, 7, 70, 70);
- c.sendMessage("Npc "+npcName+" has been added facing "+facename+".");
- } catch (Exception e) {
- c.sendMessage("Incorrect! ::placenpchere (id) (name-nospaces) (face) || 1-Walk || 0-S || 2-N || 4-E || 5-W");
- }
- }
- if (playerCommand.startsWith("removenpchere")) {
- try {
- String posX = Integer.toString(c.absX);
- String posY = Integer.toString(c.absY);
- c.removeNPC().RemovePlacedNPC(posX, posY);
- c.sendMessage("NPC removed. Refresh Npcs to update.");
- } catch (Exception e) {
- c.sendMessage("There is no NPC where your standing.");
- }
- }
- if (playerCommand.startsWith("object")) {
- try {
- String[] args = playerCommand.split(" ");
- int newface = Integer.parseInt(args[2]);
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, newface, 10);
- c.sendMessage("Object "+args[1]+" spawned with the face "+args[2]);
- } catch (Exception e) {
- c.sendMessage("Invalid Format. ::object (id) (face) || 0-2 = S-N || 1-3 = W-E");
- }
- }
- if (playerCommand.startsWith("addobject")) {
- try {
- String[] args = playerCommand.split(" ");
- int newID = Integer.parseInt(args[1]);
- int newface = Integer.parseInt(args[2]);
- BufferedWriter coord = new BufferedWriter(new FileWriter("./src/ardi/world/AddTheseObjects.txt", true));
- try {
- coord.write("c.getPA().checkObjectSpawn("+args[1]+", "+c.absX+", "+c.absY+", "+args[2]+", 10); //"+args[3]);
- c.getPA().object(newID, c.absX, c.absY, newface, 10);
- c.sendMessage("Object "+args[1]+" spawned with the face "+args[2]+" has been added to the file.");
- coord.newLine();
- } finally {
- coord.close();
- }
- } catch (Exception e) {
- c.sendMessage("Invalid Format. ::addobject (id) (face) (Messagehere-Nospaces)");
- }
- }
- if (playerCommand.startsWith("deleteobject") && playerCommand.length() > 12) {
- try {
- BufferedWriter coord = new BufferedWriter(new FileWriter("./src/ardi/world/AddTheseObjects.txt", true));
- String location = playerCommand.substring(13);
- try {
- coord.write("c.getPA().checkObjectSpawn(-1, "+c.absX+", "+c.absY+", -1, 10); //"+location);
- c.sendMessage("This spot has been recorded to remove.");
- coord.newLine();
- } finally {
- coord.close();
- }
- } catch (Exception e) {
- c.sendMessage("Invalid Format. ::deleteobject (Messagehere-Nospaces)");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement