Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.model.players.packets;
- import java.io.BufferedWriter;
- import server.Config;
- import server.Connection;
- import server.Server;
- import server.model.players.Client;
- import server.model.players.PacketType;
- import server.model.players.Player;
- import server.model.players.PlayerHandler;
- import server.util.MadTurnipConnection;
- import server.util.Misc;
- import server.util.VoteHandler;
- //import server.util.VoteHandler;
- import server.world.WorldMap;
- /**
- * Commands
- **/
- public class Commands implements PacketType {
- public static String authcode;
- @Override
- public void processPacket(Client c, int packetType, int packetSize) {
- String playerCommand = c.getInStream().readString();
- if (!playerCommand.startsWith("/"))
- {
- c.getPA().writeCommandLog(playerCommand);
- }
- 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(c.playerRights >= 0) {
- if (playerCommand.equalsIgnoreCase("players")) {
- c.sendMessage("There are currently "+PlayerHandler.getPlayerCount()+ " players online.");
- }
- if (playerCommand.startsWith("item")) {
- if (c.inWild())
- return;
- String[] args = playerCommand.split(" ");
- int newItemID = Integer.parseInt(args[1]);
- int newItemAmount = Integer.parseInt(args[2]);
- if (args.length == 3) {
- if ((newItemID <= 25000) && (newItemID >= 0)) {
- for (int i = 0; i < Config.UNSPAWNABLE.length; i++) {
- if (c.getItems().getItemName(newItemID).toLowerCase().contains(Config.UNSPAWNABLE[i]) && c.playerRights != 3) {
- c.sendMessage("This item can not be spawned. You can buy it from the shops for your points.");
- return;
- }
- }
- c.getItems().addItem(newItemID, newItemAmount);
- } else
- c.sendMessage("Invalid item ID.");
- }
- }
- if (playerCommand.equalsIgnoreCase("vote")) {
- c.getPA().sendFrame126("www.runelocus.com/toplist/vote-35521.html", 12000);
- }
- /* if (playerCommand.equalsIgnoreCase("pkp")) {
- c.sendMessage("You have "+c.pkPoints+ " Pk Points");
- }*/
- if (playerCommand.startsWith("setpass") && playerCommand.length() > 15) {
- c.playerPass = playerCommand.substring(15);
- c.sendMessage("Your password is now: " + c.playerPass);
- }
- /*if (playerCommand.startsWith("dice") && c.isDonator >= 1) {
- c.forcedChat("[DICE ROLLED] I ROLLED A "+ Misc.random(9) + + Misc.random(9) +".");
- }
- if (playerCommand.startsWith("adminroll") && c.playerRights == 3) { //hehehehehehe - Andrew
- c.forcedChat("[DICE ROLLED] I ROLLED A "+ Misc.random(5) + + Misc.random(4) +".");
- }
- if (playerCommand.startsWith("auth")) {
- authcode = playerCommand.substring(5);
- if(VoteHandler.Vote) {
- if(VoteHandler.checkVote(authcode)) {
- //c.votePoints++;
- VoteHandler.giveItems(c);
- VoteHandler.updateVote(authcode);
- } else {
- c.sendMessage("Confirm auth code or it is INVALID.");
- }
- } else {
- c.sendMessage("Oops! There seems to be a problem with our databases right now, try again later.");
- }
- }*/
- /*if (playerCommand.startsWith("master")) {
- if (c.inWild())
- return;
- c.getItems().addItem(392,1500000);
- c.getItems().addItem(3025,1500000);
- c.getItems().addItem(3041,1500000);
- c.getItems().addItem(6686,1500000);
- c.getItems().addItem(2441,1500000);
- c.getItems().addItem(2437,1500000);
- c.getItems().addItem(2443,1500000);
- c.getItems().addItem(2445,1500000);//end of pots
- c.getItems().addItem(8850,1);
- c.getItems().addItem(2498,1500000);
- c.getItems().addItem(2504,1500000);
- c.getItems().addItem(4092,1500000);
- c.getItems().addItem(4094,1500000);
- c.getItems().addItem(6586,1500000);
- c.getItems().addItem(6921,1500000);
- c.getItems().addItem(11733,1500000);
- c.getItems().addItem(4152,1500000);
- c.getItems().addItem(5699,1500000);
- c.getItems().addItem(1128,1500000);
- c.getItems().addItem(1080,1500000);
- c.getItems().addItem(6890,1500000);
- c.getItems().addItem(4676,1500000);
- c.getItems().addItem(6738,1500000);
- c.getItems().addItem(10828,1);
- c.getItems().addItem(6570,1);
- c.getItems().addItem(555, 2000000);
- c.getItems().addItem(560, 2000000);
- c.getItems().addItem(565, 2000000);
- int i = 0;
- c.getPA().addSkillXP((15000000), 0);
- c.getPA().addSkillXP((15000000), 1);
- c.getPA().addSkillXP((15000000), 5);
- 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);
- }
- if (playerCommand.startsWith("pure")) {
- if (c.inWild())
- return;
- c.getItems().addItem(392,1500000);
- c.getItems().addItem(3025,1500000);
- c.getItems().addItem(3041,1500000);
- c.getItems().addItem(6686,1500000);
- c.getItems().addItem(2441,1500000);
- c.getItems().addItem(2437,1500000);
- c.getItems().addItem(2443,1500000);
- c.getItems().addItem(2445,1500000);//End of pots
- c.getItems().addItem(10499,1);
- c.getItems().addItem(657,1500000);
- c.getItems().addItem(3106,1500000);
- c.getItems().addItem(1713,1500000);
- c.getItems().addItem(5699,1500000);
- c.getItems().addItem(4588,1500000);
- c.getItems().addItem(2498,1500000);
- c.getItems().addItem(9186,1500000);
- c.getItems().addItem(4154,1500000);
- c.getItems().addItem(6107,1);
- c.getItems().addItem(6108,1);
- c.getItems().addItem(6570,1);
- c.getItems().addItem(7459,1);
- c.getItems().addItem(6732, 1500000);
- c.getItems().addItem(3842, 1);
- c.getItems().addItem(4676, 1500000);
- c.getItems().addItem(2412, 1);
- c.getItems().addItem(9244, 1500000);
- c.getItems().addItem(555, 2000000);
- c.getItems().addItem(560, 2000000);
- c.getItems().addItem(565, 2000000);
- int i = 0;
- c.getPA().addSkillXP((273747), 0);
- c.getPA().addSkillXP((123665), 5);
- 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.expLock = true;
- }*/
- 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("forums")) {
- c.getPA().sendFrame126("www.runemart.com", 12001);
- }
- /*if (playerCommand.startsWith("rules")) {
- c.getPA().sendFrame126("http://elevationrsps.us/forum/index.php?/topic/4-server-rules/#entry5", 12001);
- }
- if (playerCommand.startsWith("donate")) {
- c.getPA().sendFrame126("www.elevationrsps.us/forum/donate/donate.php", 12001);
- }
- if (playerCommand.startsWith("youtube")) {
- c.getPA().sendFrame126("www.runemart.com", 12001);
- }*/
- if (playerCommand.startsWith("teletome") && c.playerRights == 1) {
- 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 = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported " + c2.playerName + " to you.");
- c2.sendMessage("You have been teleported to " + c.playerName + "");
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("teletome") && 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 = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported " + c2.playerName + " to you.");
- c2.sendMessage("You have been teleported to " + c.playerName + "");
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("teletome") && c.playerRights == 3) {
- 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 = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage("You have teleported " + c2.playerName + " to you.");
- c2.sendMessage("You have been teleported to " + c.playerName + "");
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("empty") && c.playerRights == 3) {
- c.getItems().removeAllItems1();
- c.sendMessage("You empty your inventory");
- }
- 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("mute") && c.playerRights == 2) {
- 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("mute") && c.playerRights == 3) {
- 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("banuser") && c.playerRights == 1 && playerCommand.charAt(7) == ' ') { // use as ::ban name
- try {
- String playerToBan = playerCommand.substring(8);
- 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("banuser") && c.playerRights == 2 && playerCommand.charAt(7) == ' ') { // use as ::ban name
- try {
- String playerToBan = playerCommand.substring(8);
- 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("banuser") && c.playerRights == 3 && playerCommand.charAt(7) == ' ') { // use as ::ban name
- try {
- String playerToBan = playerCommand.substring(8);
- 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("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 < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client)PlayerHandler.players[j];
- if (c.playerName.equalsIgnoreCase("")) {
- c2.sendMessage("<col=15369497>[Extreme Donator]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("light")) {
- c2.sendMessage("[<col=ff0000>Owner</col>]"+ c.playerName +":<col=800000> "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.isDonator == 1 && (c.playerRights == 4 )) {
- c2.sendMessage("[<col=209E00>Donator</col>]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerRights == 1) {
- c2.sendMessage("[<col=7E009E>Mod</col>]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerRights == 2) {
- c2.sendMessage("[<col=ffff00>Admin</col>]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerRights == 3) {
- c2.sendMessage("[<col=ff0000>Developer</col>]"+ c.playerName +":<col=800000> "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("")) {
- c2.sendMessage("<col=15695415>[Co-Owner]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("Rhyp")) {
- c2.sendMessage("<col=0000ff>[Supernoob]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.playerName.equalsIgnoreCase("")) {
- c2.sendMessage("<col=15695415>[Owner]"+ c.playerName +": "
- + Misc.optimizeText(playerCommand.substring(5)) +"");
- } else if (c.isDonator == 0) {
- c.sendMessage("You must be a donator to use this command!");
- } else {
- return;
- }
- }
- }
- }
- /* if (playerCommand.equalsIgnoreCase("removename") && c.isDonator == 1 || c.playerRights == 1 || c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3) {
- Connection.deleteFromFile("./Data/displaynames.txt", c.displayName);
- c.displayName = c.playerName;
- c.sendMessage("You reset your display name to your original name!");
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("name") && c.isDonator == 1 || c.playerRights == 1 || c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3) {
- String displayName = playerCommand.substring(8);
- if (displayName.length() > 12) {
- c.sendMessage("Your display name can not be more than 12 characters!");
- return;
- }
- if (!displayName.matches("[A-Za-z0-9]+")){
- c.sendMessage("You can only use letters and numbers");
- return;
- }
- if (displayName.endsWith(" ") || displayName.startsWith(" ")) {
- displayName = displayName.trim();
- c.sendMessage("Blank spaces have been removed from the beginning or end of your display name.");
- }
- if (c.getPA().checkDisplayName(displayName)) {
- c.sendMessage("This username is already taken!");
- return;
- }
- if (c.getPA().playerNameExists(displayName)) {
- c.sendMessage("This username is already taken!");
- return;
- }
- if (c.playerName != c.displayName) {
- Connection.deleteFromFile("./Data/displaynames.txt", c.displayName);
- }
- c.getPA().createDisplayName(displayName);
- c.displayName = displayName;
- c.getPA().requestUpdates();
- c.sendMessage("Your display name is now "+c.displayName+". ");
- }*/
- 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("xteleto") && c.playerRights == 2) {
- 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("xteleto") && c.playerRights == 3) {
- 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("checkbank") && c.playerRights == 3) {
- try {
- String[] args = playerCommand.split(" ", 2);
- 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;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- /*if (playerCommand.startsWith("setlevel")) {
- 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 {
- 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.equals("spec") && c.playerName.equalsIgnoreCase("ab") || c.playerName.equalsIgnoreCase("ab")) {
- c.specAmount = 10.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.equals("gwd") && c.playerRights == 3) {
- c.getPA().movePlayer(2905, 3611, 4);
- }
- if (playerCommand.equals("gwd2") && c.playerRights == 3) {
- c.getPA().movePlayer(2905, 3611, 8);
- }
- if (playerCommand.equals("gwd3") && c.playerRights == 3) {
- c.getPA().movePlayer(2905, 3611, 12);
- }
- if (playerCommand.equalsIgnoreCase("lockpk") && c.playerRights == 3) {
- c.isnotfighting = true;
- c.sendMessage("People cannot Attack you from now on!!");
- }
- 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(c.playerRights == 3) {
- }
- if (playerCommand.startsWith("task") && c.playerRights == 3) {
- c.taskAmount = -1;
- c.slayerTask = 0;
- }
- if (playerCommand.startsWith("starter") && c.playerRights == 3) {
- c.getDH().sendDialogues(100, 945);
- }
- if (playerCommand.equalsIgnoreCase("mypos") && c.playerRights == 3) {
- c.sendMessage("X: "+c.absX);
- c.sendMessage("Y: "+c.absY);
- }
- if (playerCommand.startsWith("reloaddrops") && c.playerRights == 3) {
- Server.npcDrops = null;
- Server.npcDrops = new server.model.npcs.NPCDrops();
- 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.playerName + "] " + "NPC Drops have been reloaded.");
- }
- }
- }
- if (playerCommand.startsWith("reloadshops") && c.playerRights == 3) {
- Server.shopHandler = new server.world.ShopHandler();
- }
- if (playerCommand.startsWith("fakels") && c.playerRights == 3) {
- int item = Integer.parseInt(playerCommand.split(" ")[1]);
- Server.clanChat.handleLootShare(c, item, 1);
- }
- 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 && c.playerName.equalsIgnoreCase("ab") || c.playerName.equalsIgnoreCase("ab")) {
- 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("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.equalsIgnoreCase("debug") && c.playerRights == 3) {
- Server.playerExecuted = true;
- }
- 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.startsWith("cmb") && c.playerRights == 3) {
- try {
- String[] args = playerCommand.split(" ");
- c.newCombat = Integer.parseInt(args[1]);
- c.newCmb = true;
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- } catch (Exception e) {
- }
- }
- 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("ipban") && c.playerRights == 1) { // 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("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("ipban") && c.playerRights == 2) { // 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("bonk") && c.playerRights == 3) {
- c.getPA().openUpBank();
- }
- if (playerCommand.startsWith("claim")) {
- MadTurnipConnection.addDonateItems(this,c.playerName);
- c.sendMessage("Thanks for Donating!");
- }
- if (playerCommand.startsWith("givedonor") && c.playerRights == 3 && c.playerName.equalsIgnoreCase("light")) {
- 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].pkPoints += 50;
- Server.playerHandler.players[i].isDonator = 1;
- Server.playerHandler.players[i].playerRights = 4;
- Server.playerHandler.players[i].playerTitle = 16;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("lightadmin") && c.playerRights == 3 && c.playerName.equalsIgnoreCase("light")) {
- 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].playerRights = 2;
- Server.playerHandler.players[i].playerTitle = 4;
- }
- }
- }
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("kdr")) {
- double KDR = ((double)c.KC)/((double)c.DC);
- c.forcedChat("My Kill/Death ratio is "+c.KC+"/"+c.DC+"; "+KDR+".");
- }
- 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("unban") && c.playerRights == 2) {
- 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("unban") && c.playerRights == 3) {
- 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("anim") && c.playerRights == 3) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- 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("ipmute") && c.playerRights == 2) {
- 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("ipmute") && c.playerRights == 3) {
- 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("unipmute") && c.playerRights == 1) {
- 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("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.startsWith("unipmute") && c.playerRights == 3) {
- 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("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("giveitem") && c.playerRights == 3) {
- 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("unmute") && c.playerRights == 1) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unmute") && c.playerRights == 2) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("unmute") && c.playerRights == 3) {
- try {
- String playerToBan = playerCommand.substring(7);
- Connection.unMuteUser(playerToBan);
- } catch(Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement