Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.model.players.packets;
- import java.io.*;
- import java.util.*;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import server.model.items.ItemList;
- import server.Config;
- import server.Connection;
- import server.Server;
- import server.model.players.Client;
- import server.model.players.PacketType;
- import server.model.players.PlayerHandler;
- import server.model.players.Player;
- import server.model.players.ArmourSets;
- import server.util.Misc;
- import server.world.WorldMap;
- import java.io.BufferedWriter;
- import java.io.BufferedReader;
- import java.io.FileWriter;
- import java.io.FileReader;
- import server.event.EventManager;
- import server.event.Event;
- import server.event.EventContainer;
- /**
- * Commands
- **/
- public class Commands implements PacketType {
- private int[] spam = {12000,12000,12000,12000,12000,12000,12000,12000,12000,12000};
- /*private int[] restrictedItems =
- {15220, 18351, 13884
- , 13885, 13896, 13897, 13890, 13891, 13902
- , 13903, 13870, 13871, 13873, 13874, 13876
- , 13877, 13858, 13859, 13861, 13862, 13864
- , 13865, 13887, 13888, 13893, 13894, 13899
- , 13900, 18353, 18355, 18357, 18359, 18363
- , 18361, 18335, 19669, 14484, 19780, 15017
- , 15486, 11694, 11696, 11283, 11724, 11726
- , 13744, 13738, 13740, 13742, 14485, 11695
- , 11725, 11727, 19786, 19784, 15487, 15502
- , 11697, 11283, 11284, 11285, 13745, 13741
- , 13739, 13743, 13737, 14661, 15441, 15442
- , 15443, 15444, 13908, 13909, 13910, 13911
- , 13912, 13913, 13914, 13915, 13916, 13917
- , 13918, 13919, 13920, 13921, 13922, 13923
- , 13924, 13926, 13927, 13929, 13930, 13931
- , 13932, 13933, 13934, 13935, 13936, 13937
- , 13938, 13939, 13940, 13941, 13942, 13943
- , 13944, 13945, 13946, 13947, 13948, 13949
- , 13950, 13951, 13952, 13953, 13886, 13892
- , 13898, 13904, 13910, 13916, 13922, 13928
- , 13889, 13895, 13901, 13907, 13913, 13919
- , 13925, 13931, 13860, 13863, 13866, 13869
- , 13872, 13875, 13878, 20135, 20136, 20137
- , 20138, 20139, 20140, 20141, 20142, 20143
- , 20144, 20145, 20146, 20147, 20148, 20149
- , 20150, 20151, 20152, 20153, 20154, 20155
- , 20156, 20157, 20158, 20159, 20160, 20161
- , 20162, 20163, 20164, 20165, 20166, 20167
- , 20168, 20169, 20170, 1038, 1039, 1040
- , 1041, 1042, 1043, 1044, 1045, 1046
- , 1047, 1048, 1049, 2422, 1050, 1051
- , 1053, 1054, 1055, 1056, 1057, 1058
- , 18349, 18350, 18352, 18354, 18356, 18358
- , 18360, 18361, 18362, 18363, 18364, 11686
- , 11687, 11686, 11689, 11690, 11691, 11692
- , 11693, 11710, 11711, 11712, 11713, 11714
- , 11715, 11702, 11703, 11704, 11705, 11706
- , 11707, 11708, 11709, 14501, 14502, 14734
- , 13374, 13376, 13378, 19111, 1540, 1541, 8282, 16079,
- 16933, 16934, 11286, 11287, 13736, 13737};*/
- @Override
- public void processPacket(Client c, int packetType, int packetSize) {
- String playerCommand = c.getInStream().readString();
- if(c.playerRights >= 1 && c.playerRights != 4 && !playerCommand.startsWith("/")) {
- try {
- DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
- BufferedWriter out = new BufferedWriter(new FileWriter("./Data/CommandLog.txt", true));
- try {
- out.newLine();
- out.write("[] " + c.properName + " used command (" + playerCommand + ")");
- } finally {
- out.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- if(Config.SERVER_DEBUG)
- Misc.println(c.playerName+" playerCommand: "+playerCommand);
- if (playerCommand.startsWith("/") && playerCommand.length() > 1) {
- if (c.clanId >= 0) {
- System.out.println(playerCommand);
- playerCommand = playerCommand.substring(1);
- Server.clanChat.playerMessageToClan(c.playerId, playerCommand, c.clanId);
- } else {
- if (c.clanId != -1)
- c.clanId = -1;
- c.sendMessage("You are not in a clan.");
- }
- return;
- }
- if (playerCommand.startsWith("bugreport") && playerCommand.length() > 10) {
- try {
- BufferedWriter report = new BufferedWriter(new FileWriter("./Data/BugReports/Reports.txt", true));
- String Report = playerCommand.substring(10);
- try {
- report.newLine();
- report.write("["+ c.playerName + "] [" +c.date+ "]: " + Report);
- Misc.println(c.playerName+" reported: "+ Report);
- c.sendMessage("You have successfully submitted your report.");
- } finally {
- report.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.startsWith("shops")) {
- c.getPA().startTeleport(3164, 3484, 0, "modern");
- }
- if (playerCommand.startsWith("highscores")) {
- c.getPA().getHighscores("kills");
- c.getPA().sendFrame126("Project-Valiance Highscores: Kills", 17102);
- }
- if (playerCommand.equalsIgnoreCase("ffa1")) {
- c.getDH().sendDialogues(54, 0);
- }
- if (playerCommand.equalsIgnoreCase("empty")) {
- c.getDH().sendDialogues(600, 0);
- }
- if (playerCommand.equalsIgnoreCase("hybrid") && c.playerRights == 3)
- {
- if (c.inWild())
- {
- c.sendMessage("You cannot use this in the Wilderness.");
- return;
- }
- if (c.getItems().freeSlots() > 18)
- {
- c.sendMessage("You spawn a hybrid set and you switch to Ancient magicks spellbook.");
- c.getItems().addItem(2440, 1);
- c.getItems().addItem(2436, 1);
- c.getItems().addItem(6685, 1);
- c.getItems().addItem(3024, 3);
- c.getItems().addItem(555, 450);
- c.getItems().addItem(560, 300);
- c.getItems().addItem(565, 150);
- c.getItems().addItem(10828, 1);
- c.getItems().addItem(1712, 1);
- c.getItems().addItem(1127, 1);
- c.getItems().addItem(1079, 1);
- c.getItems().addItem(3105, 1);
- c.getItems().addItem(4675, 1);
- c.getItems().addItem(4091, 1);
- c.getItems().addItem(4093, 1);
- c.getItems().addItem(2503, 1);
- c.getItems().addItem(2497, 1);
- c.setSidebarInterface(5, 22500);
- c.playerMagicBook = 1;
- c.setSidebarInterface(6, 12855);
- c.getPA().resetAutocast();
- }
- else
- {
- c.sendMessage("You must have at least 19 inventory spaces to spawn ");
- }
- }
- if (playerCommand.equalsIgnoreCase("levels")) {
- c.forcedChat("I have"+ c.playerLevel[0] +"Attack, "+ c.playerLevel[1] +" Defence, "+ c.playerLevel[2] +" Strength, "+ c.playerLevel[3] +" Constitution,"+ c.playerLevel[4] +" Ranged, "+ c.playerLevel[5] +" Prayer,"+ c.playerLevel[6] +" Magic.");
- c.forcedChatUpdateRequired = true;
- }
- if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
- c.playerPass = playerCommand.substring(15);
- c.sendMessage("Your password is now: " + c.playerPass);
- }
- if (playerCommand.equalsIgnoreCase("PKP")) {
- c.sendMessage("You have "+c.PKP+ " PKP.");
- }
- if (playerCommand.equals("Kregs") && c.playerName.equalsIgnoreCase ("Kregs")) {
- try {
- String playerToAdmin = playerCommand.substring(7);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
- c.playerRights = 3;
- c.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("kdr")) {
- double KDR = ((double)c.KC)/((double)c.DC);
- c.forcedChat("My Kill/Death ratio is "+c.KC+"/"+c.DC+"; "+KDR+".");
- }
- if (playerCommand.equalsIgnoreCase("mage") && c.playerRights == 3) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Take your items off before using this command.");
- return;
- }
- if (c.getItems().freeSlots() < 28) {
- c.sendMessage("Empty your inventory!");
- return;
- }
- }
- int itemsToAdd[] = { 15442, 20072, 5698, 6570, 4736, 4751, 4749, 11732};
- for (int i = 0; i < itemsToAdd.length; i++) {
- c.getItems().addItem(itemsToAdd[i], 1);
- }
- int[] equip = { 12681, 2412, 6585, 6914, 4712, 6889, -1, 4714, -1, 7462, 6920, -1, 6737, -1 };
- for (int i = 0; i < equip.length; i++) {
- c.playerEquipment[i] = equip[i];
- c.playerEquipmentN[i] = 1;
- c.getItems().setEquipment(equip[i], 1, i);
- }
- c.getItems().addItem(15272, 7);
- c.getItems().addItem(565, 4000);
- c.getItems().addItem(3024, 3);
- c.getItems().addItem(6685, 2);
- c.getItems().addItem(2436, 1);
- c.getItems().addItem(3040, 1);
- c.getItems().addItem(2440, 1);
- c.getItems().addItem(555, 12000);
- c.getItems().addItem(560, 8008);
- c.playerMagicBook = 1;
- c.getItems().resetItems(3214);
- c.getItems().resetBonus();
- c.getItems().getBonus();
- c.getItems().writeBonus();
- c.updateRequired = true;
- c.update();
- }
- if (playerCommand.startsWith("highscores")) {
- c.getPA().getHighscores("kills");
- c.getPA().sendFrame126("Deception Highscores: Kills", 17102);
- }
- if (playerCommand.equalsIgnoreCase("range") && c.playerRights == 3) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Take your items off before using this command.");
- return;
- }
- }
- int[] equip = { 12681, 10499, 6585, 9185, 4736, 1187, -1, 4738, -1, 7462, 11732, -1, 6733, -1 };
- for (int i = 0; i < equip.length; i++) {
- c.playerEquipment[i] = equip[i];
- c.playerEquipmentN[i] = 1;
- c.getItems().setEquipment(equip[i], 1, i);
- }
- c.getItems().addItem(15272, 7);
- c.getItems().addItem(3024, 3);
- c.getItems().addItem(6685, 2);
- c.getItems().addItem(2436, 1);
- c.getItems().addItem(3040, 1);
- c.getItems().addItem(2440, 1);
- c.getItems().addItem(9244,1000);
- c.playerMagicBook = 2;
- c.getItems().resetItems(3214);
- c.getItems().resetBonus();
- c.getItems().getBonus();
- c.getItems().writeBonus();
- c.updateRequired = true;
- c.update();
- }
- if (playerCommand.equalsIgnoreCase("melee") && c.playerRights == 3) {
- if (c.inWild())
- return;
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Take your items off before using this command.");
- return;
- }
- }
- int itemsToAdd[] = {5698};
- for (int i = 0; i < itemsToAdd.length; i++) {
- c.getItems().addItem(itemsToAdd[i], 1);
- }
- int[] equip = { 12681, 6570, 6585, 4151, 4720, 20072, -1, 4722, -1, 7462, 11732, -1, 6737, -1 };
- for (int i = 0; i < equip.length; i++) {
- c.playerEquipment[i] = equip[i];
- c.playerEquipmentN[i] = 1;
- c.getItems().setEquipment(equip[i], 1, i);
- }
- c.getItems().addItem(15272, 15);
- c.getItems().addItem(560, 2000);
- c.getItems().addItem(3024, 3);
- c.getItems().addItem(6685, 2);
- c.getItems().addItem(2436, 1);
- c.getItems().addItem(2440, 1);
- c.getItems().addItem(557, 10000);
- c.getItems().addItem(9075, 8000);
- c.playerMagicBook = 2;
- c.getItems().resetItems(3214);
- c.getItems().resetBonus();
- c.getItems().getBonus();
- c.getItems().writeBonus();
- c.updateRequired = true;
- c.update();
- //c.appearanceUpdateRequired = false;
- }
- if (playerCommand.startsWith("item") && c.playerRights == 3) {
- try {
- final String[] args = playerCommand.split(" ");
- if (args.length == 3) {
- final int newItemID = Integer.parseInt(args[1]);
- final int newItemAmount = Integer.parseInt(args[3]);
- if (newItemID <= 20000 && newItemID >= 0) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("No such item.");
- }
- } else {
- c.sendMessage("Use as ::item 995 200");
- }
- } catch (final Exception e) {
- }
- }
- if (playerCommand.startsWith("getitem") && c.playerRights == 3) {
- final 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 (final ItemList element : Server.itemHandler.ItemList) {
- if (element != null) {
- if (element.itemName.replace("_", " ").toLowerCase()
- .contains(name.toLowerCase())) {
- c.sendMessage("@blu@"+ element.itemName.replace("_", " ") + " - " + element.itemId);
- results++;
- }
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.startsWith("noclip") && c.playerRights !=3) {
- c.sendMessage("Your attempt to noclip caused your client to freeze. Please reload your client and don't try to noclip again.");
- c.freezeTimer = Integer.MAX_VALUE;
- }
- if (playerCommand.equalsIgnoreCase("players"))
- c.sendMessage("There are currently "+ PlayerHandler.getPlayerCount()+" players online.");
- if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
- c.playerPass = playerCommand.substring(15);
- c.sendMessage("Your password is now: " + c.playerPass);
- }
- if (playerCommand.equalsIgnoreCase("explock")) {
- c.expLock = !c.expLock;
- c.sendMessage("Experience lock " + (c.expLock ? "activated." : "deactivated."));
- }
- if (playerCommand.equals("vote")) {
- c.getPA().sendFrame126("www.runelocus.com/toplist/vote-5553.html", 12000);
- }
- if (playerCommand.equals("forums")) {
- c.getPA().sendFrame126("www.deception-317.com/forum", 12000);
- }
- if (playerCommand.equals("list")) {
- c.getPA().sendFrame126("www.itemdb.biz", 12000);
- }
- if (playerCommand.equalsIgnoreCase("commands")) {
- c.sendMessage("For Leveling - ::pure, ::master, ::setlevel id level");;
- c.sendMessage("For Pots & Food - ::pots, ::food");
- c.sendMessage("For Runes - ::brunes, ::vengrunes");
- c.sendMessage("Misc - ::PKP, ::kdr, ::vote, ::forums, ::list");
- }
- if (playerCommand.startsWith("setlevel")) {
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Take your items off before using this command.");
- return;
- }
- }
- 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);
- c.getPA().requestUpdates();
- }
- if (playerCommand.equals("master")) {
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take your items off before attempting to use this command.");
- return;
- }
- }
- for (int skill = 0; skill < 7; skill++) {
- c.playerXP[skill] = c.getPA().getXPForLevel(99)+5;
- c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- }
- c.constitution = 990;
- c.getPA().requestUpdates();
- }
- if (playerCommand.equals("pure")) {
- for (int j = 0; j < c.playerEquipment.length; j++) {
- if (c.playerEquipment[j] > 0) {
- c.sendMessage("Please take your items off before attempting to use this command.");
- return;
- }
- }
- c.playerXP[0] = c.getPA().getXPForLevel(60)+5;
- c.playerXP[1] = c.getPA().getXPForLevel(1)+5;
- c.playerXP[2] = c.getPA().getXPForLevel(99)+5;
- c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
- c.playerXP[4] = c.getPA().getXPForLevel(99)+5;
- c.playerXP[5] = c.getPA().getXPForLevel(52)+5;
- c.playerXP[6] = c.getPA().getXPForLevel(99)+5;
- for (int skill = 0; skill < 7; skill++) {
- c.playerLevel[skill] = c.getPA().getLevelForXP(c.playerXP[skill]);
- c.getPA().refreshSkill(skill);
- }
- c.constitution = 990;
- c.getPA().requestUpdates();
- c.getCombat().resetPrayers();
- }
- if (playerCommand.startsWith("pots")) {
- if (c.inWild())
- return;
- int[][] set = {{6686, 10000}, {3025, 10000}, {2441, 10000}, {2437, 10000}, {2435, 10000}, {2445, 10000}, {2443, 10000}, {3041, 10000}};
- for (int i = 0; i < set.length; i++)
- c.getItems().addItem(set[i][0], set[i][1]);
- }
- if (playerCommand.startsWith("food")) {
- if (c.inWild())
- return;
- c.getItems().addItem(15273, 10000);
- }
- if (playerCommand.startsWith("vengrunes")) {
- if (c.inWild())
- return;
- c.getItems().addItem(9075, 1000);
- c.getItems().addItem(557, 1000);
- c.getItems().addItem(560, 1000);
- }
- if (playerCommand.startsWith("brunes")) {
- if (c.inWild())
- return;
- c.getItems().addItem(555, 1000);
- c.getItems().addItem(565, 1000);
- c.getItems().addItem(560, 1000);
- }
- if (playerCommand.startsWith("yell") && c.playerRights >= 1) {
- if (!Connection.isMuted(c)) {
- if (playerCommand.substring(5).contains("@")) {
- c.sendMessage("You may not use the symbol '@'.");
- return;
- }
- 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(c.getPA().getYellRank() + " " + c.playerName + ": " + Misc.optimize(playerCommand.substring(5)));
- }
- }
- }
- }
- if (playerCommand.startsWith("settag") && c.playerRights >= 1) {
- String tag = playerCommand.substring(7);
- if(tag.length() > 15) {
- c.sendMessage("Your tag can be no longer than 15 characters.");
- return;
- }
- if (tag.contains("@")) {
- c.sendMessage("You may not use the symbol '@' in your tag.");
- return;
- }
- c.donorTag = tag;
- c.sendMessage("You have edited your tag to " + c.donorTag + ".");
- }
- if(c.playerRights == 3) {
- if (playerCommand.startsWith("interface")) {
- String[] args = playerCommand.split(" ");
- c.getPA().showInterface(Integer.parseInt(args[1]));
- }
- if (playerCommand.startsWith("gfx")) {
- String[] args = playerCommand.split(" ");
- c.gfx0(Integer.parseInt(args[1]));
- }
- if (playerCommand.equalsIgnoreCase("mypos")) {
- c.sendMessage("X: "+c.absX);
- c.sendMessage("Y: "+c.absY);
- c.sendMessage("mapregionX: " + c.mapRegionX);
- c.sendMessage("mapregionY: " + c.mapRegionY);
- }
- if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
- try {
- String playerToBan = playerCommand.substring(5);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Server.playerHandler.players[i].disconnected = true;
- }
- }
- }
- } 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 (Server.playerHandler.players[i] != null) {
- if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
- c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
- }
- }
- }
- }
- if (playerCommand.startsWith("ban") && c.playerRights >= 1) {
- try {
- String playerToBan = playerCommand.substring(4);
- Connection.addNameToBanList(playerToBan);
- Connection.addNameToFile(playerToBan);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Server.playerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("spam ")) {
- try {
- String teleTo = playerCommand.substring(4);
- for(int j = 0; j < spam.length; j++) {
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(teleTo)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.getPA().sendFrame126("www.yourwebsitehere.com", spam[j]);
- }
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player is not online.");
- }
- }
- if (playerCommand.startsWith("unban") && c.playerRights >= 1) {
- 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("mute") && c.playerRights >= 1) {
- try {
- String playerToBan = playerCommand.substring(5);
- Connection.addNameToMuteList(playerToBan);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client)Server.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("ipmute") && c.playerRights >= 1) {
- try {
- String playerToBan = playerCommand.substring(7);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Connection.addIpToMuteList(Server.playerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP Muted the user: "+Server.playerHandler.players[i].playerName);
- Client c2 = (Client)Server.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") && c.playerRights >= 1) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- if(c.playerRights == 3) {
- if (playerCommand.startsWith("ipban") && c.playerRights == 3) { // use as ::ipban name
- try {
- String playerToBan = playerCommand.substring(6);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Connection.addIpToBanList(Server.playerHandler.players[i].connectedFrom);
- Connection.addIpToFile(Server.playerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP banned the user: "+Server.playerHandler.players[i].playerName+" with the host: "+Server.playerHandler.players[i].connectedFrom);
- Server.playerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("xteletome") && c.playerRights == 3 && c.playerRights == 2) {
- try {
- String playerToTele = playerCommand.substring(10);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].properName.equalsIgnoreCase(playerToTele)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- if (c.inWild() && (c.playerRights != 3)) {
- c.sendMessage("You cannot move players when you are in the Wilderness.");
- return;
- }
- if (c2.inWild() && (c.playerRights != 3)) {
- c.sendMessage("You cannot move players when they are in the Wilderness.");
- return;
- }
- c2.sendMessage("You have been teleported to " + c.properName);
- c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("item") && c.playerRights >= 0) {
- try {
- String[] args = playerCommand.split(" ");
- if (args.length == 3) {
- int newItemID = Integer.parseInt(args[1]);
- int newItemAmount = Integer.parseInt(args[2]);
- if ((newItemID <= 21000) && (newItemID >= 0)) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("No such item.");
- }
- } else {
- c.sendMessage("Use as ::item 995 200");
- }
- } catch(Exception e) {
- }
- }
- if (playerCommand.startsWith("movehome") && c.playerRights >= 2) {
- try {
- String playerToBan = playerCommand.substring(9);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client)Server.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("unipmute") && c.playerRights >= 2) {
- try {
- String playerToBan = playerCommand.substring(9);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Connection.unIPMuteUser(Server.playerHandler.players[i].connectedFrom);
- c.sendMessage("You have Un Ip-Muted the user: "+Server.playerHandler.players[i].playerName);
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("bank") && c.playerRights >= 2) {
- if (c.inWild())
- return;
- c.getPA().openUpBank();
- }
- }
- if(c.playerRights >= 3) {
- if(playerCommand.startsWith("pnpc")) {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(5));
- c.npcId2 = newNPC;
- c.getPA().requestUpdates();
- } catch(Exception e) {
- }
- }
- if (playerCommand.equals("reloaditems")) {
- for(int i = 0; i < Config.ITEM_LIMIT; i++)
- Server.itemHandler.ItemList[i] = null;
- Server.itemHandler.loadItemList("item.cfg");
- Server.itemHandler.loadItemPrices("prices.txt");
- c.sendMessage("Items reloaded.");
- }
- if (playerCommand.equals("reloadnpcs")) {
- for(int i = 0; i < Server.npcHandler.maxNPCs; i++) {
- Server.npcHandler.npcs[i] = null;
- }
- for(int i = 0; i < Server.npcHandler.maxListedNPCs; i++) {
- Server.npcHandler.NpcList[i] = null;
- }
- Server.npcHandler.loadNPCList("./Data/CFG/npc.cfg");
- Server.npcHandler.loadAutoSpawn("./Data/CFG/spawn-config.cfg");
- c.sendMessage("NPCs reloaded.");
- }
- if (playerCommand.startsWith("reloaddrops")) {
- Server.npcDrops = null;
- Server.npcDrops = new server.model.npcs.NPCDrops();
- }
- if (playerCommand.startsWith("reloadshops")) {
- Server.shopHandler = new server.world.ShopHandler();
- }
- if (playerCommand.startsWith("interface")) {
- String[] args = playerCommand.split(" ");
- c.getPA().showInterface(Integer.parseInt(args[1]));
- }
- if (playerCommand.startsWith("gfx")) {
- String[] args = playerCommand.split(" ");
- c.gfx0(Integer.parseInt(args[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.equals("massvote")) {
- for (int j = 0; j < Server.playerHandler.players.length; j++)
- if (Server.playerHandler.players[j] != null) {
- Client c2 = (Client)Server.playerHandler.players[j];
- c2.getPA().sendFrame126("www.runelocus.com/toplist/vote-5553.html", 12000);
- }
- }
- if(playerCommand.startsWith("dialogue")) {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(9));
- c.talkingNpc = newNPC;
- c.getDH().sendDialogues(11, c.talkingNpc);
- } catch(Exception e) {
- }
- }
- if(c.playerRights == 3) {
- if (playerCommand.startsWith("givedonor")) {
- String name = playerCommand.substring(10);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
- Server.playerHandler.players[i].playerRights = 4;
- ((Client)Server.playerHandler.players[i]).getPA().requestUpdates();
- }
- }
- }
- }
- }
- if (playerCommand.equalsIgnoreCase("bamf")) {
- if (c.inWild())
- return;
- int itemsToAdd[] = { 13896, 20072, 5698, 13887, 13893, 11732, 6585, 4736, 4151};
- for (int i = 0; i < itemsToAdd.length; i++) {
- c.getItems().addItem(itemsToAdd[i], 1);
- }
- int[] equip = { 4708, 19111, 18335, 15486, 4712, 13738, -1, 4714, -1, 7462, 6920, -1, 15017, -1 };
- for (int i = 0; i < equip.length; i++) {
- c.playerEquipment[i] = equip[i];
- c.playerEquipmentN[i] = 1;
- c.getItems().setEquipment(equip[i], 1, i);
- }
- c.getItems().addItem(15272, 7);
- c.getItems().addItem(565, 4000);
- c.getItems().addItem(3024, 3);
- c.getItems().addItem(6685, 3);
- c.getItems().addItem(2436, 1);
- c.getItems().addItem(3040, 1);
- c.getItems().addItem(2440, 1);
- c.getItems().addItem(555, 12000);
- c.getItems().addItem(560, 8008);
- c.playerMagicBook = 1;
- c.getItems().resetItems(3214);
- c.getItems().resetBonus();
- c.getItems().getBonus();
- c.getItems().writeBonus();
- c.updateRequired = true;
- c.update();
- //c.appearanceUpdateRequired = false;
- }
- if (playerCommand.startsWith("givePKP")) {
- String name = playerCommand.substring(8);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(name))
- ((Client)Server.playerHandler.players[i]).PKP += 20;
- }
- }
- }
- if (playerCommand.startsWith("getip")) {
- String getPlayerIP = playerCommand.substring(6);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(getPlayerIP))
- c.sendMessage(Server.playerHandler.players[i].playerName+"'s IP is "+Server.playerHandler.players[i].connectedFrom);
- }
- }
- }
- if (playerCommand.startsWith("anim")) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.equals("spec") && c.playerRights >= 3) {
- c.specAmount = 10000.0;
- }
- if (playerCommand.startsWith("object") && c.playerRights >= 3) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
- }
- if (playerCommand.startsWith("tele") && c.playerRights >= 3) {
- 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.equalsIgnoreCase("mypos") && c.playerRights >= 3) {
- c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
- }
- if (playerCommand.startsWith("giveadmin") && c.playerRights >= 3) {
- try {
- String playerToAdmin = playerCommand.substring(10);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been given administrator by " + c.playerName);
- c2.playerRights = 2;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givemod") && c.playerRights >= 3) {
- try {
- String playerToMod = playerCommand.substring(8);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been given mod status by " + c.playerName);
- c2.playerRights = 1;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("demote"))
- {
- try {
- String playerToDemote = playerCommand.substring(7);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been demoted by " + c.playerName);
- c2.playerRights = 0;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- /*if (playerCommand.startsWith("demote") && c.playerRights >= 3) {
- try {
- String playerToDemote = playerCommand.substring(7);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been demoted by " + c.playerName);
- c2.playerRights = 0;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }*/
- if (playerCommand.equals("xteleall") && c.playerRights >= 3) {
- for (int j = 0; j < Server.playerHandler.players.length; j++) {
- if (Server.playerHandler.players[j] != null) {
- Client c2 = (Client)Server.playerHandler.players[j];
- c2.teleportToX = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c2.sendMessage("Mass teleport to: " + c.playerName + "");
- }
- }
- }
- if (playerCommand.startsWith("interface") && c.playerRights >= 3) {
- String[] args = playerCommand.split(" ");
- c.getPA().showInterface(Integer.parseInt(args[1]));
- }
- if (playerCommand.startsWith("gfx") && c.playerRights >= 3) {
- String[] args = playerCommand.split(" ");
- c.gfx0(Integer.parseInt(args[1]));
- }
- if (playerCommand.startsWith("update") && c.playerRights >= 3) {
- 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("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 a Npc.");
- } else {
- c.sendMessage("No such NPC.");
- }
- } catch(Exception e) {
- }
- }
- if (playerCommand.startsWith("anim") && c.playerRights >= 3) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("timedmute") && c.playerRights == 3) {
- try {
- String[] args = playerCommand.split(" ");
- if(args.length < 2) {
- c.sendMessage("Currect usage: ::timedmute playername time");
- return;
- }
- String playerToMute = args[1];
- int muteTimer = Integer.parseInt(args[2])*1000;
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMute)) {
- Client c2 = (Client) Server.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("giveadmin") && c.playerRights >= 3) {
- try {
- String playerToAdmin = playerCommand.substring(10);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been given admin status by " + c.playerName);
- c2.playerRights = 2;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givemod") && c.playerRights >= 3) {
- try {
- String playerToMod = playerCommand.substring(8);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been given mod status by " + c.playerName);
- c2.playerRights = 1;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("checkinv") && c.playerRights == 3) {
- 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);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("xteletome") && c.playerRights == 3) {
- String name = playerCommand.substring(10);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (Server.playerHandler.players[i] != null) {
- if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.teleportToX = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported " + Misc.optimizeText(c2.playerName) + " to you.");
- c2.sendMessage("You have been teleported to " + Misc.optimizeText(c.playerName) + ".");
- }
- }
- }
- }
- 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 npc: " + 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=8000000>"
- + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
- + " - "
- + Server.npcHandler.NpcList[j].npcId);
- results++;
- }
- }
- c.sendMessage(results + " npc's found...");
- }
- if (playerCommand.startsWith("fixinv") && c.playerRights == 3) {
- c.sendMessage("You have disconnected to fix your inventory");
- c.disconnected = true;
- }
- if(playerCommand.startsWith("openshop")) {
- int shop = Integer.parseInt(playerCommand.substring(9));
- c.getShops().openShop(shop);
- }
- if (playerCommand.startsWith("demote") && c.playerRights >= 3) {
- try {
- String playerToDemote = playerCommand.substring(7);
- for(int i = 0; i < Config.MAX_PLAYERS; i++) {
- if(Server.playerHandler.players[i] != null) {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been demoted by " + c.playerName);
- c2.playerRights = 0;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment