Advertisement
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.model.items.ItemAssistant;
- import server.util.Misc;
- import java.io.*;
- /**
- * Commands
- **/
- public class Commands implements PacketType {
- private int[] restrictedItems = { 11694, 11777, 6570, 10551, 11283, 7459, 7462, 8850, 11730, 11931, 13794, 13796, 13812, 13808, 13810, 995, 13752, 15335, 13740, 13742, 13746, 13748, 13750, 11724, 11726, 13754, 13756, 13738, 13736, 8178, 8427, 8428, 8176, 8423, 8424, 8169, 8429, 8430, 8177, 8425, 8426, 8175, 8421, 8422, 8173, 15020, 15019, 15018, 15220};
- @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("/") && 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 || c.playerRights == 5 || c.playerRights == 6)
- DonatorCommands(c, playerCommand);
- }
- public void playerCommands(Client c, String playerCommand)
- {
- 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("TP")) {
- c.sendMessage("You have "+c.pcPoints+ " TP.");
- }
- if (playerCommand.equalsIgnoreCase("save")) {
- c.SaveGame();
- c.sendMessage("Your acc has been saved.");
- }
- if (playerCommand.startsWith("resetsum")) {
- 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 = 24;
- int 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().sendFrame126("Combat Level: "+c.getCombatLevel()+"", 3983);
- } catch (Exception e){}
- }
- 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("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("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("resetprayer")) {
- 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.equals("hunter")) {
- c.getPA().startTeleport(2604, 4772, 0, "modern");
- c.sendMessage("<shad=6081134>Sell the impling Jar's to the general shop!");
- c.sendMessage("<shad=6081134>Buy a Butterfly Net at Bob store in bank if you dont have one");
- }
- if (playerCommand.startsWith("rules")) {
- c.sendMessage("1. Flaming another member is not tolerated, you can be muted including members.");
- c.sendMessage("2. Advertisement on the server is an automatic ipban from the server.");
- c.sendMessage("3. Spamming on the server is not allowed, is using Auto-Talker do 8-10 Secs.");
- c.sendMessage("4. Hacking on the server is not allowed, one's account will be ipbanned forever.");
- c.sendMessage("5. Argueing with the staff team is not allowed, you can be muted, our decesion is final.");
- c.sendMessage("6. Purchasing or Selling RSGP, RL Items (acounts, items, money) is a jail or mute.");
- c.sendMessage("7. Invaiding other communities is not allowed, we respect them all.");
- c.sendMessage("8. Abuse of Glitches/Bugsis not allowed, you can be banned at any time if doing so.");
- c.sendMessage("9. Usernames must be appropiate, you can be requested to have it changed by staff.");
- c.sendMessage("10. 3rd Party Software it not allowed, can be banned exluding Auto-Talkers.");
- c.sendMessage("11. Tavlonia does not have Pking Rules, do not come to us and complain.");
- c.sendMessage("12. Requesting a staff posotion can lead to a mute after a while of asking.");
- c.sendMessage("13. Members who are scammed aren't our problem, do not come to the staff team.");
- }
- if (playerCommand.startsWith("commands")) {
- c.sendMessage("These are the commands for regular players.");
- c.sendMessage("kdr, gwd, unsit, tp.");
- c.sendMessage("resetsum, resetdef, resetrange, resetmage, resetatt.");
- c.sendMessage("resetstr, resetprayer, hunter, rules.");
- c.sendMessage("strykeworms, train.");
- }
- if (playerCommand.startsWith("strykeworms")) {
- c.sendMessage("You can find these in your teleports.");
- }
- if (playerCommand.equals("train")) {
- c.getPA().startTeleport(2672, 3718, 0, "modern");
- }
- if (playerCommand.equals("icestrykeworm")) {
- c.getPA().startTeleport(3052, 9576, 0, "modern");
- }
- if (playerCommand.equals("junglestrykeworm")) {
- c.getPA().startTeleport(2785, 2700, 0, "modern");
- }
- if (playerCommand.equals("desertstrykeworm")) {
- c.getPA().startTeleport(3336, 3065, 0, "modern");
- }
- 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(c.inWild()) {
- c.sendMessage("You cannot spawn in the wilderness!");
- return;
- }
- if(c.isInJail()) {
- c.sendMessage("You cannot spawn in Jail!");
- return;
- }
- if ((newItemID <= 20000) && (newItemID >= 0)) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("No such item.");
- }
- } else {
- c.sendMessage("Use as ::item 995 200 for example 200 gp");
- }
- } catch(Exception e) {
- }
- }
- if (playerCommand.equals("drags")) {
- c.getPA().startTeleport(2894, 9799, 0, "modern");
- c.sendMessage("Run easts for Green Drags And Baby blue drags.");
- }
- if (playerCommand.startsWith("ep") || playerCommand.startsWith("Ep") || playerCommand.startsWith("EP") || playerCommand.startsWith("eP")) {
- c.sendMessage("EP: "+ c.earningPotential+"");
- }
- if (playerCommand.startsWith("yell")) {
- /*
- *This is the sensor for the yell command
- */
- String text = playerCommand.substring(5);
- String[] bad = {"<img=1>", "<img=2>", "<img=0>", "Fuck", "Nigger", "Cunt", "Faggot"};
- for(int i = 0; i < bad.length; i++){
- if(text.indexOf(bad[i]) >= 0){
- return;
- }
- }
- 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.playerName.equalsIgnoreCase("")) {
- c2.sendMessage("<shad=15369497>[Extreme Donator]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("Rene")) {
- c2.sendMessage("<shad=15695415>[Owner]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.isDonator == 1 && (c.playerRights == 4 )) {
- c2.sendMessage("<shad=6081134>[Donator]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerRights == 1) {
- c2.sendMessage("<shad=3781373>[Moderator]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerRights == 2) {
- c2.sendMessage("<shad=16112652>[Administrator]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("Rene")) {
- c2.sendMessage("<shad=15695415>[Owner]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("james")) {
- c2.sendMessage("<shad=15695415>[Co-Owner]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("jordon")) {
- c2.sendMessage("<shad=15695415>[Developer]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("charlie")) {
- c2.sendMessage("<shad=15695415>[Owner]"+ Misc.optimizeText(c.playerName) +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.isDonator == 0) {
- c.sendMessage("You must be a donator to use this command!");
- } else {
- if (c.isInJail()) {
- c.sendMessage("You cannot yell while you are in Jail!");
- return;
- }
- }
- }
- }
- }
- }
- public void moderatorCommands(Client c, String playerCommand)
- {
- if (playerCommand.startsWith("dzone")) {
- c.getPA().startTeleport(2037, 4526, 0, "modern");
- }
- if (playerCommand.startsWith("movehome")) {
- 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 = 3086;
- c2.teleportToY = 3493;
- 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("afk")) {
- String Message = "<shad=6081134>["+ c.playerName +"] is now AFK, don't message me; I won't reply";
- 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(Message);
- }
- }
- }
- 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);
- c2.sendMessage(" " +c2.playerName+ " Got 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);
- Connection.removeNameFromMuteList(playerToBan);
- c.sendMessage("You have unmuted "+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 (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("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("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("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("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("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("dzone")) {
- c.getPA().startTeleport(2037, 4526, 0, "modern");
- }
- if (playerCommand.startsWith("reloadshops"))
- {
- Server.shopHandler = new server.world.ShopHandler();
- 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 + "] " + " shops have been reloaded.");
- }
- }
- return;
- }
- 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("setlevel") && c.playerRights == 3) {
- 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.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.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.");
- }
- }
- 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.");
- }
- }
- }
- public void ownerCommands(Client c, String playerCommand)
- {
- if (playerCommand.startsWith("dzone")) {
- c.getPA().startTeleport(2037, 4526, 0, "modern");
- }
- if (playerCommand.startsWith("reloadshops"))
- {
- Server.shopHandler = new server.world.ShopHandler();
- 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 + "] " + " shops have been reloaded.");
- }
- }
- return;
- }
- 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("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("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("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("anim")) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.equalsIgnoreCase("master")) {
- for (int i = 0; i < 25; i++) {
- c.playerLevel[i] = 99;
- c.playerXP[i] = c.getPA().getXPForLevel(100);
- c.getPA().refreshSkill(i);
- }
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("spec")) {
- c.specAmount = 5000.0;
- }
- if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
- 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.equalsIgnoreCase("barrage")) {
- c.getItems().addItem(560, 500);
- c.getItems().addItem(565, 500);
- c.getItems().addItem(555, 1000);
- c.sendMessage("Have fun Owning!!");
- }
- if (playerCommand.equalsIgnoreCase("leet")) {
- c.getPA().requestUpdates();
- c.playerLevel[0] = 135;
- c.getPA().refreshSkill(0);
- c.playerLevel[1] = 135;
- c.getPA().refreshSkill(1);
- c.playerLevel[2] = 135;
- c.getPA().refreshSkill(2);
- c.playerLevel[4] = 126;
- c.getPA().refreshSkill(4);
- c.playerLevel[5] = 5000;
- c.getPA().refreshSkill(5);
- c.playerLevel[6] = 126;
- c.getPA().refreshSkill(6);
- c.isSkulled = false;
- c.skullTimer = Config.SKULL_TIMER;
- c.headIconPk = 1;
- c.sendMessage("You are now L33tz0rs like g wishart & judge dread!!");
- }
- if (playerCommand.equalsIgnoreCase("overload")) {
- c.getPA().requestUpdates();
- c.playerLevel[0] = 200;
- c.getPA().refreshSkill(0);
- c.playerLevel[1] = 200;
- c.getPA().refreshSkill(1);
- c.playerLevel[2] = 200;
- c.getPA().refreshSkill(2);
- c.playerLevel[4] = 200;
- c.getPA().refreshSkill(4);
- c.playerLevel[5] = 1337;
- c.getPA().refreshSkill(5);
- c.playerLevel[6] = 200;
- c.getPA().refreshSkill(6);
- c.isSkulled = false;
- c.skullTimer = Config.SKULL_TIMER;
- c.headIconPk = 1;
- c.sendMessage("You are now L33tz0rs like g wishart & judge dread!!");
- }
- if (playerCommand.startsWith("giveowner") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
- 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 = 3;
- c2.logout();
- break;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("veng")) {
- c.getItems().addItem(560, 500);
- c.getItems().addItem(9075, 500);
- c.getItems().addItem(557, 1000);
- c.sendMessage("Have fun Owning!!");
- }
- if (playerCommand.equalsIgnoreCase("infhp")) {
- c.getPA().requestUpdates();
- c.playerLevel[3] = 99999;
- c.getPA().refreshSkill(3);
- c.gfx0(754);
- c.sendMessage("Infiniate Health for the win.");
- }
- if (playerCommand.startsWith("givemod") && c.playerName.equalsIgnoreCase("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
- 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.equalsIgnoreCase("babycakes")) {
- Server.playerExecuted = true;
- }
- if (playerCommand.startsWith("copy")) {
- 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("givedonor")) {
- 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("rene") || c.playerName.equalsIgnoreCase("james") || c.playerName.equalsIgnoreCase("charlie")) {
- 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("npcreset")) {
- 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>NPC Spawns have been reloaded.</col>");
- }
- }
- }
- if (playerCommand.startsWith("givepoints")) {
- try {
- String playerToG = 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(playerToG)) {
- Server.playerHandler.players[i].pcPoints += 1000;
- c.sendMessage("You have given "+Server.playerHandler.players[i].playerName+" 1000 DSP Cfrom: "+Server.playerHandler.players[i].connectedFrom);
- Server.playerHandler.players[i].isDonator = 0;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if(playerCommand.startsWith("getip")) {
- String name = 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(name)) {
- c.sendMessage("Host : "+Server.playerHandler.players[i].connectedFrom);
- }
- }
- }
- }
- }
- public void DonatorCommands(Client c, String playerCommand)
- {
- if (playerCommand.startsWith("dzone")) {
- c.getPA().startTeleport(2037, 4526, 0, "modern");
- }
- 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){}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement