Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.model.players.packets;
- 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.util.Misc;
- import java.io.*;
- /**
- * Commands
- **/
- public class Commands implements PacketType
- {
- @Override
- public void processPacket(Client c, int packetType, int packetSize)
- {
- String playerCommand = c.getInStream().readString();
- if (!playerCommand.startsWith("/"))
- {
- c.getPA().writeCommandLog(playerCommand);
- }
- if (playerCommand.startsWith("pure") && c.puremaster == 0) {
- int i = 0;
- c.getPA().addSkillXP((15000000), 0);
- c.getPA().addSkillXP((15000000), 2);
- c.getPA().addSkillXP((15000000), 3);
- c.getPA().addSkillXP((15000000), 4);
- c.getPA().addSkillXP((15000000), 6);
- c.playerXP[3] = c.getPA().getXPForLevel(99)+5;
- c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- c.puremaster = 1;
- }
- 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 (Config.SERVER_DEBUG)
- Misc.println(c.playerName+" playerCommand: "+playerCommand);
- if (c.playerRights >= 0)
- playerCommands(c, playerCommand);
- if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3)
- moderatorCommands(c, playerCommand);
- if (c.playerRights == 2 || c.playerRights == 3)
- administratorCommands(c, playerCommand);
- if (c.playerRights == 3)
- ownerCommands(c, playerCommand);
- if (c.playerRights == 4)
- DonatorCommands(c, playerCommand);
- }
- public void playerCommands(Client c, String playerCommand)
- {
- if (playerCommand.startsWith("rtask")) {
- c.taskAmount = -1;
- c.slayerTask = 0;
- }
- 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("rest")) {
- c.startAnimation(5713);
- }
- if (playerCommand.startsWith("halloween")) {
- c.getPA().showInterface(18681);
- c.sendMessage("Happy Halloween!");
- }
- if (playerCommand.startsWith("xmas")) {
- c.getPA().showInterface(11877);
- c.sendMessage("Happy Xmas!");
- }
- if (playerCommand.startsWith("pushups")) {
- c.startAnimation(2756);
- }
- if (playerCommand.startsWith("dupe")) {
- c.getPA().showInterface(14600);
- c.sendMessage("Nice try assholes");
- }
- if (playerCommand.startsWith("stafflist")) {
- c.getPA().sendFrame126(" ", 13610);
- c.getPA().sendFrame126(" ", 13611);
- c.getPA().sendFrame126(" ", 13612);
- c.getPA().sendFrame126(" ", 13613);
- c.getPA().sendFrame126(" ", 13614);
- c.getPA().sendFrame126(" ", 13615);
- c.getPA().sendFrame126(" ", 13616);
- c.getPA().sendFrame126(" ", 13617);
- c.getPA().sendFrame126(" ", 13618);
- c.getPA().sendFrame126(" ", 13619);
- c.getPA().sendFrame126(" ", 13620);
- c.getPA().sendFrame126(" ", 13621);
- c.getPA().sendFrame126(" ", 13622);
- c.getPA().sendFrame126(" ", 13623);
- c.getPA().showInterface(13585);
- c.getPA().sendFrame126("@blu@CorruptionPVP Official Staff List:", 13589);
- c.getPA().sendFrame126("Main Owner - Pvm max", 13591);
- c.getPA().sendFrame126("2nd Owner - Vortex ", 13592);
- c.getPA().sendFrame126("Administrators- Chuck norris, owen, NONE", 13593);
- c.getPA().sendFrame126("Head - Moderator- Kidzfucker", 13594);
- c.getPA().sendFrame126("Moderators - Torva", 13595);
- c.getPA().sendFrame126("Server Helpers/ Donators- Alot ", 13596);
- c.getPA().sendFrame126("Server Coder - Lovely bawb", 13597);
- c.getPA().sendFrame126("", 13598);
- c.getPA().sendFrame126("PM any of these players above if you need help!", 13599);
- c.getPA().sendFrame126("( Unless they are busy! )", 13600);
- c.getPA().sendFrame126("", 13601);
- c.getPA().sendFrame126("", 13602);
- c.getPA().sendFrame126("", 13602);
- c.getPA().sendFrame126("", 13603);
- c.getPA().sendFrame126("", 13604);
- c.getPA().sendFrame126("", 13605);
- c.getPA().sendFrame126("", 13606);
- c.getPA().sendFrame126("", 13607);
- c.getPA().sendFrame126("", 13608);
- c.getPA().sendFrame126("", 13609);
- }
- if (playerCommand.startsWith("vote")) {
- c.getPA().sendFrame126("http://www.runelocus.com/toplist/index.php?action=vote&id=28896", 12000);
- c.sendMessage("Type ::voted after you vote do this everyday :P");
- }
- if (playerCommand.equalsIgnoreCase("voted")) {
- if(c.checkVotes(c.playerName)) {
- c.getItems().addItem(995, 5000000);
- c.sendMessage("<col=1532693>Thanks for voting!</col>");
- } else {
- c.sendMessage("<col=1532693>You have voted already!</col>");
- }
- }
- if (playerCommand.equals("tradearea")) {
- c.getPA().startTeleport(3210, 3424, 0, "modern");
- }
- if (playerCommand.equals("home")) {
- c.getPA().startTeleport(3087, 3498, 0, "modern");
- }
- if (playerCommand.equals("funpk")) {
- c.getPA().startTeleport(2582, 3171, 0, "modern");
- }
- if (playerCommand.equals("kq")) {
- c.getPA().startTeleport(3507, 9494, 0, "modern");
- }
- if (playerCommand.equals("ice")) {
- c.getPA().startTeleport(2851, 3809, 2, "modern");
- }
- if (playerCommand.equals("aod")) {
- c.sendMessage("Protect Melee this is lethal 1HITK0 consquences.Bring some pray pots and food.");
- c.getPA().startTeleport(3239, 3611, 0, "modern");
- }
- if (playerCommand.equals("nomad")) {
- c.sendMessage("Protect Melee this is lethal 1HITK0 consquences.Go north for him.");
- c.getPA().startTeleport(3241, 3778, 0, "modern");
- }
- if (playerCommand.equals("pq")) {
- c.sendMessage("Go north for him/her (btw) its not hard just get protect just incase.");
- c.getPA().startTeleport(3247, 9564, 0, "modern");
- }
- if (playerCommand.equals("hell")) {
- c.sendMessage("Welcome to HELL.");
- c.getPA().startTeleport(3015, 5240, 0, "modern");
- }
- if (playerCommand.equals("fdrags")) {
- c.sendMessage("Shit! where did i put my jacket?.");
- c.getPA().startTeleport(3039, 9581, 0, "modern");
- }
- if (playerCommand.equals("eye")) {
- c.sendMessage("'EYE' got a feeling im being watched!.");
- c.getPA().startTeleport(2982, 9630, 0, "modern");
- }
- if (playerCommand.equals("sail")) {
- c.sendMessage("Mind the gap between the gangplank and the platform.");
- c.getPA().startTeleport(3025, 3217, 0, "modern");
- }
- if (playerCommand.equals("demon")) {
- c.sendMessage("A,B,C,D,E,M,O,N...");
- c.getPA().startTeleport(2875, 9781, 0, "modern");
- }
- if (playerCommand.equalsIgnoreCase("players")) {
- c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
- }
- if (playerCommand.startsWith("empty")) {
- c.getItems().removeAllItems();
- c.sendMessage("You empty your inventory");
- }
- if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
- c.playerPass = playerCommand.substring(15);
- c.sendMessage("Your password is now: " + c.playerPass);
- }
- if (playerCommand.startsWith("ep") || playerCommand.startsWith("Ep") || playerCommand.startsWith("EP") || playerCommand.startsWith("eP")) {
- c.sendMessage("EP: "+ c.earningPotential+"");
- }
- if (playerCommand.startsWith("yell")) {
- for (int j = 0; j < Server.playerHandler.players.length; j++) {
- if (Server.playerHandler.players[j] != null) {
- Client c2 = (Client)Server.playerHandler.players[j];
- if (c.isDonator == 1 && (c.playerRights < 1 || c.playerRights > 3)){
- c2.sendMessage("<shad=6081134>[Donator]</col><img=0>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerName.equalsIgnoreCase("Bawb")) {
- c2.sendMessage("<shad=9440238>[Coder]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerName.equalsIgnoreCase("Chuck norris")) {
- c2.sendMessage("<shad=990000>[Trolled BRUV]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerRights == 1){
- c2.sendMessage("<col=255>[Mod]</col><img=1>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerRights == 2){
- c2.sendMessage("<col=255>[Admin]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerRights == 3){
- c2.sendMessage("<shad=255>[Owner]</col><img=2>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerRights == 5){
- c2.sendMessage("<col=255>[VIP]</col><img=0>"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- }else if (c.playerRights == 0 && c.isDonator == 0) {
- c.sendMessage("<shad=6081134><img=0>You must be a Donator to use Yell!<img=0></col>");
- }
- }
- }
- }
- public void moderatorCommands(Client c, String playerCommand)
- {
- if(playerCommand.startsWith("jail")) {
- 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)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.teleportToX = 3102;
- c2.teleportToY = 9516;
- c2.Jail = true;
- 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("mute")) {
- 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);
- c.sendMessage("You have muted: " + c2.playerName);
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- c.sendMessage("Unmuted.");
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("checkbank")) {
- String[] args = playerCommand.split(" ");
- for(int i = 0; i < Config.MAX_PLAYERS; i++)
- {
- Client o = (Client) Server.playerHandler.players[i];
- if(Server.playerHandler.players[i] != null)
- {
- if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1]))
- {
- c.getPA().otherBank(c, o);
- break;
- }
- }
- }
- }
- 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("ban") && playerCommand.charAt(3) == ' ') {
- 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;
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage(" " +c2.playerName+ " Got Banned By " + c.playerName+ ".");
- }
- }
- }
- } 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("unjail")) {
- 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)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.teleportToX = 3086;
- c2.teleportToY = 3493;
- c2.monkeyk0ed = 0;
- c2.Jail = false;
- c2.sendMessage("You have been unjailed by "+c.playerName+".");
- c.sendMessage("Successfully unjailed "+c2.playerName+".");
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- public void administratorCommands(Client c, String playerCommand)
- {
- if (playerCommand.startsWith("alert") && c.playerRights > 1) {
- String msg = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (Server.playerHandler.players[i] != null) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("Alert##Notification##" + msg + "##By: " + c.playerName);
- }
- }
- }
- if (playerCommand.startsWith("ipmute")) {
- 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);
- c2.sendMessage(" " +c2.playerName+ " Got IpMuted By " + c.playerName+ ".");
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("object")) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
- }
- if (playerCommand.equalsIgnoreCase("mypos")) {
- c.sendMessage("X: "+c.absX+" Y: "+c.absY+" H: "+c.heightLevel);
- }
- 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("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("xteletome")) {
- 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].playerName.equalsIgnoreCase(playerToTele)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been teleported to " + c.playerName);
- c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
- break;
- }
- }
- }
- } 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 (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.equalsIgnoreCase("bank")) {
- c.getPA().openUpBank();
- }
- if (playerCommand.startsWith("unipmute")) {
- 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.startsWith("ipban")) {
- 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);
- Client c2 = (Client)Server.playerHandler.players[i];
- Server.playerHandler.players[i].disconnected = true;
- c2.sendMessage(" " +c2.playerName+ " Got IpBanned By " + c.playerName+ ".");
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- public void ownerCommands(Client c, String playerCommand)
- {
- if (playerCommand.startsWith("update") && c.playerName.equalsIgnoreCase("bawb")) {
- 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")) {
- 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")) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("spec")) {
- c.specAmount = 500.0;
- }
- if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("Pvm Max")) {
- 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.playerName.equalsIgnoreCase("Pvm Max")) {
- 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("pnpc"))
- {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(5));
- if (newNPC <= 200000 && newNPC >= 0) {
- c.npcId2 = newNPC;
- c.isNpc = true;
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }
- else {
- c.sendMessage("No such P-NPC.");
- }
- } catch(Exception e) {
- c.sendMessage("Wrong Syntax! Use as ::pnpc #");
- }
- }
- if (playerCommand.startsWith("givedonor") && c.playerName.equalsIgnoreCase("Pvm Max")) {
- try {
- String playerToMod = 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(playerToMod)) {
- Client c2 = (Client)Server.playerHandler.players[i];
- c2.sendMessage("You have been given donator status by " + c.playerName);
- c2.playerRights = 4;
- c2.isDonator = 1;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("demote") && c.playerName.equalsIgnoreCase("Pvm Max")) {
- 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("reloadspawns")) {
- Server.npcHandler = null;
- Server.npcHandler = new server.model.npcs.NPCHandler();
- 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("<shad=15695415>[" + c.playerName + "] " + "NPC Spawns have been reloaded.</col>");
- }
- }
- }
- 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 <= 20500) && (newItemID >= 0)) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("That item ID does not exist.");
- }
- } else {
- c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
- }
- } catch(Exception e) {
- } // HERE?
- } // HERE?
- if (playerCommand.startsWith("pickup") && c.playerRights == 2) {
- if (c.inWild()) {
- c.sendMessage("you can't spawn items in the wilderness!");
- return;
- }
- try {
- String[] args = playerCommand.split(" ");
- if (args.length == 3) {
- int newItemID = Integer.parseInt(args[1]);
- int newItemAmount = Integer.parseInt(args[2]);
- // add restricted items here.
- int restrictedItems[] = {15773, 15774, 15818, 15888, 15889, 15890, 15891, 15924, 15935, 15946, 16001, 16023, 16034, 16045, 16090, 16126, 16137, 16152, 16184, 16206, 16217, 16258, 16259, 16260, 16261, 16272, 16293, 16294, 16315, 16316, 16359, 16360, 16381, 16382, 16403, 16404, 16425, 16426, 16667, 16668, 16689, 16690, 16711, 16712, 16733, 16734, 16837, 16838, 16839, 16840, 16841, 16842, 16843, 16844, 16909, 16910, 16955, 16956, 17039, 17040, 17143, 17144, 17145, 17146, 17147, 17148, 17149, 17150, 17259, 17260, 17361, 17362, 20822, 20832, 20824, 20825, 20826, 20833, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 2422, 13531, 13532, 13533, 13534, 13535, 13536, 1053, 1054, 1055, 1056, 1057, 1058, 13538, 13539, 13540, 18786, 19780, 19784, 19669, 13362, 13361, 13359, 13358, 13355, 13354, 13352, 13351, 13350, 13348, 13347, 13346, 13345, 13344, 13343, 13342, 13341, 13340, 13339, 13370, 13371, 13369, 13336, 13335};
- for (int i : restrictedItems) {
- if (i == newItemID) {
- if (c.playerRights != 3) {
- c.sendMessage("You can't spawn this item!");
- return;
- }
- }
- }
- if ((newItemID <= 30000) && (newItemID >= 0)) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("You can't spawn this item!");
- }
- } else {
- c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
- }
- } catch(Exception e) {
- }}
- 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("copy") && c.playerRights == 3) {
- int[] arm = new int[14];
- String name = playerCommand.substring(5);
- 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("hail") && c.playerRights == 3) {
- for (int j = 0; j < Server.playerHandler.players.length; j++) {
- if (Server.playerHandler.players[j] != null) {
- Client p = (Client)Server.playerHandler.players[j];
- p.forcedChat("KOOKIES! PVM & bawb & VORTEX OWNZ! ;)");
- p.startAnimation(1651);
- }
- }
- }
- 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.equals("alltome")) {
- 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)) {
- try {
- String[] args = playerCommand.split(" ");
- int a = Integer.parseInt(args[1]);
- c.getPA().showInterface(a);
- } catch (Exception e) {
- c.sendMessage("::interface ####");
- }
- }
- if (playerCommand.equalsIgnoreCase("master")) {
- for (int i = 0; i < 22; i++) {
- c.playerLevel[i] = 99;
- c.playerXP[i] = c.getPA().getXPForLevel(100);
- c.getPA().refreshSkill(i);
- }
- c.getPA().requestUpdates();
- }
- }
- public void DonatorCommands(Client c, String playerCommand)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment