Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.game.players.packets;
- import server.Config;
- import server.Connection;
- import server.DonationHandler;
- import server.Server;
- import server.content.Dicing;
- import server.content.MoneyVault;
- import server.game.players.Client;
- import server.game.players.PacketType;
- import server.game.players.Player;
- import server.game.players.PlayerHandler;
- import server.game.players.party.Party;
- import server.game.players.party.SocialSlayer;
- import java.io.*;
- import core.util.Backup;
- import core.util.Misc;
- /**
- * Commands
- **/
- public class Commands implements PacketType {
- @Override
- public void processPacket(Client c, int packetType, int packetSize) {
- String playerCommand = c.getInStream().readString();
- if (playerCommand.startsWith("report") && playerCommand.length() > 7) {
- try {
- BufferedWriter report = new BufferedWriter(new FileWriter("./Data/bans/Reports.txt", true));
- String Report = playerCommand.substring(7);
- try {
- report.newLine();
- report.write(c.playerName + ": " + Report);
- c.sendMessage("You have successfully submitted your report.");
- } finally {
- report.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.startsWith("//")) {
- if (c.party == null) {
- c.sendMessage("You must be in a party to do that.");
- return;
- }
- playerCommand = playerCommand.trim().substring(2).replaceAll("<[^>]*>", "").replaceAll("@[^@]*@", "")
- .replaceAll(":tradereq:", "").replaceAll(":duelreq:", "").replaceAll("-partyinvite", "");
- playerCommand = playerCommand.substring(0, 1).toUpperCase() + playerCommand.substring(1);
- if (playerCommand.isEmpty()) {
- c.sendMessage("You can not send blank messages.");
- return;
- }
- c.party.partyMessage("[<col=255>" + c.party.getName() + "</col>] <col=255>"
- + Misc.formatPlayerName(c.playerName) + "</col>: <col=7e3200>" + playerCommand);
- return;
- } else if (playerCommand.startsWith("/")) {
- if (c.clan != null) {
- String message = playerCommand.substring(1);
- c.clan.sendChat(c, message);
- }
- }
- if(playerCommand.startsWith("minmax")) {
- if(c.getItems().playerHasItem(Dicing.DICE)) {
- Dicing.setMinAndMax(c);
- }
- }
- if(playerCommand.startsWith("stats")) {
- c.sendMessage("Profit:"+c.totalProfit);
- c.sendMessage("Won:"+c.betsWon);
- c.sendMessage("Lost:"+c.betsLost);
- }
- if (playerCommand.equals("staffzone") && (c.playerRights >= 1)) {
- c.getPA().startTeleport(2012, 4751, 0, "modern");
- c.sendMessage("Welcome to the Staffzone!");
- }
- if(playerCommand.equalsIgnoreCase("players")) {
- c.getPA().showInterface(17350);
- c.getPA().refreshPlayersInterface();
- }
- if (playerCommand.equals("chill") && (c.playerRights >= 0)) {
- c.getPA().startTeleport(2705, 9187, 1, "modern");
- c.sendMessage("Welcome to Chillzone!");
- }
- if (playerCommand.equals("chode") && (c.playerRights >= 0)) {
- c.getPA().startTeleport(2849, 3498, 1, "modern");
- c.sendMessage("Welcome to the ChodeZone!");
- }
- if (playerCommand.equals("donated") && (c.playerRights >= 0)) {
- DonationHandler.check(c);//go for it.
- }
- if (playerCommand.equals("commands")) {
- c.sendMessage("changepassword, lottery, donated, shout, players, ep");
- c.sendMessage("home, rules, vote, forums, chill");
- }
- if (playerCommand.equals("home")) {
- if (c.inWild()) {
- return;
- }
- c.getPA().startTeleport(3087, 3498, 0, "modern");
- }
- 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 == 8)
- SupportCommands(c, playerCommand);
- if (c.playerRights == 4 || c.playerRights == 6 || c.playerRights == 7)
- DonatorCommands(c, playerCommand);
- }
- public void playerCommands(Client c, String playerCommand) {
- if (playerCommand.startsWith("resettask")) {
- c.taskAmount = -1;
- c.slayerTask = 0;
- }
- if (playerCommand.startsWith("store")) {
- int amount;
- try {
- amount = Integer.parseInt(playerCommand.substring(6));
- MoneyVault.depositMoney(c, amount);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("withdraw")) {
- int amount;
- try {
- amount = Integer.parseInt(playerCommand.substring(9));
- MoneyVault.withdrawMoney(c, amount);
- } catch (Exception e) {
- }
- }
- if (playerCommand.startsWith("check")) {
- MoneyVault.checkMoney(c);
- }
- if (playerCommand.equalsIgnoreCase("players")) {
- c.sendMessage("There are currently " + PlayerHandler.getPlayerCount() + " players online.");
- }/*
- if (playerCommand.startsWith("shout")) {
- if (Connection.isMuted(c)) {
- c.sendMessage("Sorry but you can't yell because you are muted.");
- return;
- }
- if (c.YellPoints < 1) {
- c.sendMessage("You need to purchase Yell points before using this command!");
- return;
- }
- if (System.currentTimeMillis() - c.lastYell < 10000) {
- c.sendMessage("You have to wait 10 seconds before yelling again.");
- return;
- }
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- if (c.playerRights == 0) {
- c2.sendMessage("<shad=255>[Player]</shad>" + Misc.optimizeText(c.playerName) + ": " + playerCommand.substring(6) + "");
- c.YellPoints -= 1;
- c.lastYell = System.currentTimeMillis();
- }
- }
- }
- c.getPA().sendFrame34a(10494, c.WillKeepItem1, 0,
- c.WillKeepAmt1);
- }*/
- if (playerCommand.startsWith("spyon")) {
- String playerToCheck = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- Client o = (Client) PlayerHandler.players[i];
- if (PlayerHandler.players[i] == null)
- continue;
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToCheck)) {
- c.getPA().sendFrame126("Checking player: " + Misc.capitalize(o.playerName), 47105);
- for(int i1 = 0; i1 < o.playerItems.length; i1++)
- c.getPA().sendFrame34(47153, o.playerItems[i1]-1, 0, o.playerItemsN[i1]);
- for(int i1 = 0; i1 < o.playerEquipment.length; i1++)
- c.getPA().sendFrame34(47156, o.playerEquipment[i1], 0, o.playerEquipmentN[i1]);
- for(int i1 = 0; i1< o.bankItems.length; i1++)
- c.getPA().sendFrame34(47159, o.bankItems[i1]-1, 0, o.bankItemsN[i1]);
- c.getPA().showInterface(47100);
- break;
- }
- }
- }
- }
- if(playerCommand.startsWith("check")) {
- try {
- Client c2 = (null);
- String playerToCheck = playerCommand.substring(6);
- for(Player p : PlayerHandler.players) {
- if (p == null)
- continue;
- if (p.playerName.equalsIgnoreCase(playerToCheck))
- c2 = (Client)p;
- }
- if (c2 != null) {
- c.getPA().sendFrame126("Checking player: " + Misc.capitalize(c2.playerName), 47105);
- for(int i = 0; i < c2.playerItems.length; i++)
- c.getPA().sendFrame34a(47153, c2.playerItems[i], i, c2.playerItemsN[i]);
- for(int i = 0; i < c2.playerEquipment.length; i++)
- c.getPA().sendFrame34a(47156, c2.playerEquipment[i], i, c2.playerEquipmentN[i]);
- for(int i = 0; i < c2.bankItems.length; i++)
- c.getPA().sendFrame34a(47159, c2.bankItems[i], i, c2.bankItemsN[i]);
- c.getPA().showInterface(47100);
- } else {
- c.sendMessage("Cannot find player: '"+playerToCheck+"'");
- }
- } catch(Exception e) {
- c.sendMessage("@red@Use as ::check [playername]");
- }
- }
- if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
- c.playerPass = playerCommand.substring(15);
- c.sendMessage("Your password is now: " + c.playerPass);
- }
- if (playerCommand.startsWith("yell")) {
- /*
- * This is the sensor for the yell command
- */
- /*
- * String text = playerCommand.substring(5); String[] bad =
- * {"chalreq", "duelreq", "tradereq", ". com", "c0m", "com", "org",
- * "net", "biz", ". net", ". org", ". biz", ". no-ip", "- ip",
- * ".no-ip.biz", "no-ip.org", "servegame", ".com", ".net", ".org",
- * "no-ip", "****", "is gay", "****", "crap", "rubbish", ". com",
- * ". serve", ". no-ip", ". net", ". biz"}; for(int i = 0; i <
- * bad.length; i++){ if(text.indexOf(bad[i]) >= 0){ return; } }
- */
- if (Connection.isMuted(c)) {
- c.sendMessage("Sorry but you can't yell because you are muted.");
- 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("mr selby")) {
- c2.sendMessage("<col=17407><shad=54783>[Founder]<img=2>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "</col></shad>");
- } else if (c.playerRights == 1) {
- c2.sendMessage("<shad=10906535>[Moderator]</col><img=1>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.playerRights == 7) {
- c2.sendMessage("<shad=003366>[Sponsor]</col><img=6>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.playerRights == 2) {
- c2.sendMessage("<col=255><shad=15695415>[Administrator]</col><img=2>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.playerRights == 3) {
- c2.sendMessage("<col=255><shad=15695415>[Owner]</col><img=2>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.playerRights == 8) {
- c2.sendMessage("<col=000099><img=7>[Support]<img=7>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.isDonator == 1) {
- c2.sendMessage("<col=13238272><shad=16711680>[Donator]<img=3>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "</col></shad>");
- } else if (c.isDonator == 2) {
- c2.sendMessage("<shad=65535>[Super Donator]</col><img=4>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.isDonator == 3) {
- c2.sendMessage("<shad=14981889>[Extreme Donator]</col><img=5>" + Misc.optimizeText(c.playerName) + ": " + Misc.optimizeText(playerCommand.substring(5)) + "");
- } else if (c.playerRights == 0) {
- c.sendMessage("You are not a Donator or member of our Staff team so please use shout");
- return;
- }
- }
- }
- }
- }
- 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("check")) {
- try {
- String playerToCheck = playerCommand.substring(6);
- Client c2 = null;
- for(Player p : PlayerHandler.players) {
- if(p.playerName.equalsIgnoreCase(playerToCheck))
- c2 = (Client)p;
- }
- if(c2 != null) {
- c.getPA().sendFrame126("Checking player: " + Misc.capitalize(c2.playerName), 47105);
- for(int i = 0; i < c2.playerItems.length; i++)
- c.getPA().sendFrame34a(47153, c2.playerItems[i]-1, i, c2.playerItemsN[i]);
- for(int i = 0; i < c2.playerEquipment.length; i++)
- c.getPA().sendFrame34a(47156, c2.playerEquipment[i], i, c2.playerEquipmentN[i]);
- for(int i = 0; i < c2.bankItems.length; i++)
- c.getPA().sendFrame34a(47159, c2.bankItems[i]-1, i, c2.bankItemsN[i]);
- c.getPA().showInterface(47100);
- } else {
- c.sendMessage("Cannot find player: '"+playerToCheck+"'");
- }
- } catch(Exception e) {
- c.sendMessage("<col=800000000>Use as ::check [playername]");
- }
- }
- if (playerCommand.startsWith("emote") && c.playerRights >= 2) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("god") && c.playerRights >= 1) {
- if (c.playerStandIndex != 1501) {
- c.startAnimation(1500);
- c.playerStandIndex = 1501;
- c.playerTurnIndex = 1851;
- c.playerWalkIndex = 1851;
- c.playerTurn180Index = 1851;
- c.playerTurn90CWIndex = 1501;
- c.playerTurn90CCWIndex = 1501;
- c.playerRunIndex = 1851;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- c.sendMessage("You turn God mode on.");
- } else {
- c.playerStandIndex = 0x328;
- c.playerTurnIndex = 0x337;
- c.playerWalkIndex = 0x333;
- c.playerTurn180Index = 0x334;
- c.playerTurn90CWIndex = 0x335;
- c.playerTurn90CCWIndex = 0x336;
- c.playerRunIndex = 0x338;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- c.sendMessage("Godmode has been diactivated.");
- }
- }
- if (playerCommand.startsWith("fall") && c.playerRights >= 1) {
- if (c.playerStandIndex != 2048) {
- c.startAnimation(2046);
- c.playerStandIndex = 2048;
- c.playerTurnIndex = 2048;
- c.playerWalkIndex = 2048;
- c.playerTurn180Index = 2048;
- c.playerTurn90CWIndex = 2048;
- c.playerTurn90CCWIndex = 2048;
- c.playerRunIndex = 2048;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- } else {
- c.startAnimation(2047);
- c.playerStandIndex = 0x328;
- c.playerTurnIndex = 0x337;
- c.playerWalkIndex = 0x333;
- c.playerTurn180Index = 0x334;
- c.playerTurn90CWIndex = 0x335;
- c.playerTurn90CCWIndex = 0x336;
- c.playerRunIndex = 0x338;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- }
- if (playerCommand.startsWith("pushups") && c.playerRights >= 1) {
- c.startAnimation(2756);
- }
- if (playerCommand.startsWith("mute")) {
- try {
- String playerToBan = playerCommand.substring(5);
- Connection.addNameToMuteList(playerToBan);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: " + c.playerName);
- c.sendMessage("You have muted: " + c2.playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("xteletome") && c.playerRights >= 1) {
- try {
- String playerToTele = playerCommand.substring(10);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToTele)) {
- Client c2 = (Client) 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") && c.playerRights >= 1) {
- if (c.inWild()) {
- return;
- }
- String name = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
- c.getPA().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
- }
- }
- }
- }
- 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("kick") && playerCommand.charAt(4) == ' ') {
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- PlayerHandler.players[i].disconnected = true;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("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 (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- PlayerHandler.players[i].disconnected = true;
- Client c2 = (Client) 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 = 3087;
- c2.teleportToY = 3498;
- c2.heightLevel = 0;
- 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")) {
- String msg = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("Alert##Notification##" + msg + "##By: " + c.playerName);
- }
- }
- }
- if (playerCommand.startsWith("empty")) {
- c.getItems().removeAllItems();
- c.sendMessage("<shad=6081134>You empty your inventory.</col>");
- }
- if (playerCommand.startsWith("ipmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Connection.addIpToMuteList(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP Muted the user: " + PlayerHandler.players[i].playerName);
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been muted by: " + c.playerName);
- c2.sendMessage(" " + c2.playerName + " Got IpMuted By " + c.playerName + ".");
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("mypos")) {
- c.sendMessage("X: " + c.absX + " Y: " + c.absY + " H: " + c.heightLevel);
- }
- if (playerCommand.startsWith("tele")) {
- String[] arg = playerCommand.split(" ");
- if (arg.length > 3)
- c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
- else if (arg.length == 3)
- c.getPA().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), c.heightLevel);
- }
- if (playerCommand.startsWith("unipmute")) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Connection.unIPMuteUser(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have Un Ip-Muted the user: " + PlayerHandler.players[i].playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("@red@Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("ipban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
- Connection.addIpToBanList(PlayerHandler.players[i].connectedFrom);
- Connection.addIpToFile(PlayerHandler.players[i].connectedFrom);
- c.sendMessage("You have IP banned the user: " + PlayerHandler.players[i].playerName + " with the host: " + PlayerHandler.players[i].connectedFrom);
- Client c2 = (Client) PlayerHandler.players[i];
- PlayerHandler.players[i].disconnected = true;
- c2.sendMessage(" " + c2.playerName + " Got IpBanned By " + c.playerName + ".");
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("@red@Player Must Be Offline.");
- }
- }
- }
- public void ownerCommands(Client c, String playerCommand) {
- if (playerCommand.equals("backup")) {
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- Backup.startBackupService();
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("Character Files have been backed up.");
- }
- }
- }
- if (playerCommand.startsWith("party")) {
- String[] args = playerCommand.split(" ");
- if (args.length < 2) {
- for (int i = 0; i < args.length; i++)
- c.sendMessage(args[i]);
- return;
- }
- switch (args[1]) {
- case "gettask":
- if (c.party == null || !(c.party instanceof SocialSlayer)) {
- return;
- }
- ((SocialSlayer) c.party).giveTask();
- break;
- case "create":
- if (args[2] == null) {
- c.sendMessage("no party type");
- return;
- }
- try {
- c.party = (Party) Class.forName("server.game.players.party." + args[2]).newInstance();
- c.party.init(c);
- } catch (Exception e) {
- c.sendMessage("Unable to find class: server.model.players.party." + args[2]);
- }
- break;
- case "invite":
- Client toInvite = null;
- if (args[2] == null) {
- c.sendMessage("no username");
- return;
- }
- for (Player player : PlayerHandler.players) {
- if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
- toInvite = (Client) player;
- break;
- }
- }
- if (toInvite == null) {
- c.sendMessage("Unable to find " + args[2]);
- return;
- }
- if (c.party == null) {
- c.sendMessage("You're not in a party");
- return;
- }
- c.party.invite(toInvite);
- break;
- case "leave":
- if (c.party == null)
- return;
- c.party.leave(c);
- break;
- case "join":
- if (c.party != null)
- c.party.leave(c);
- Client toJoin = null;
- for (Player player : PlayerHandler.players) {
- if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
- toJoin = (Client) player;
- break;
- }
- }
- if (toJoin == null) {
- c.sendMessage("Unable to find " + args[2]);
- return;
- }
- if (toJoin.party == null) {
- c.sendMessage(toJoin.playerName + " is not in a party.");
- return;
- }
- toJoin.party.forceJoin(c);
- break;
- case "forcejoin":
- if (c.party == null) {
- c.sendMessage("You are not in a party.");
- return;
- }
- Client toForceJoin = null;
- for (Player player : PlayerHandler.players) {
- if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
- toForceJoin = (Client) player;
- break;
- }
- }
- if (toForceJoin == null) {
- c.sendMessage("Unable to find " + args[2]);
- return;
- }
- if (toForceJoin.party != null)
- toForceJoin.party.leave(toForceJoin);
- c.party.forceJoin(toForceJoin);
- break;
- case "kick":
- if (c.party == null) {
- c.sendMessage("You are not in a party.");
- return;
- }
- Client toKick = null;
- for (Player player : PlayerHandler.players) {
- if (player != null && player.playerName.equalsIgnoreCase(args[2].replaceAll("_", " "))) {
- toKick = (Client) player;
- break;
- }
- }
- if (toKick == null) {
- c.sendMessage("Unable to find " + args[2]);
- return;
- }
- if (toKick.party == null) {
- c.sendMessage(toKick.playerName + " is not in a party.");
- return;
- }
- toKick.party.leave(toKick);
- break;
- case "rename":
- if (c.party == null)
- return;
- c.party.setName(args[2].replaceAll("_", " "));
- break;
- }
- }
- if (playerCommand.startsWith("interface")) {
- try {
- String[] args = playerCommand.split(" ");
- int a = Integer.parseInt(args[1]);
- c.getPA().showInterface(a);
- } catch (Exception e) {
- c.sendMessage("::interface id");
- }
- }
- if (playerCommand.equalsIgnoreCase("bank") && c.playerRights >= 2) {
- c.getPA().openUpBank();
- }
- if (playerCommand.startsWith("gfx")) {
- String[] args = playerCommand.split(" ");
- c.gfx0(Integer.parseInt(args[1]));
- }
- if (playerCommand.startsWith("kill") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToKill = playerCommand.substring(5);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToKill)) {
- c.sendMessage("You have killed the user: " + PlayerHandler.players[i].playerName);
- Client c2 = (Client) PlayerHandler.players[i];
- c2.isDead = true;
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("update") && c.playerName.equalsIgnoreCase("mr selby")) {
- 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("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("<shad=505>That item ID does not exist.</col>");
- }
- } else {
- c.sendMessage("<shad=505>Wrong usage: (Ex:(::item 995 1))</col>");
- }
- } catch (Exception e) {
- } // HERE?
- } // HERE?
- if (playerCommand.startsWith("giveitem") && c.playerName.equalsIgnoreCase("mr selby")) {
- 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 (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
- c2 = (Client) PlayerHandler.players[i];
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c.sendMessage("You have just given " + server.game.items.Item.getItemName(newItemID) + "X" + newItemAmount + " to " + c2.playerName + ".");
- c2.getItems().addItem(newItemID, newItemAmount);
- } catch (Exception e) {
- c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
- }
- }
- if (playerCommand.startsWith("givesp") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- final String[] args = playerCommand.split(" ");
- final String otherplayer = args[1];
- final int point = Integer.parseInt(args[2]);
- for (final Player player : PlayerHandler.players) {
- if (player != null) {
- if (player.playerName.equalsIgnoreCase(otherplayer)) {
- final Client c2 = (Client) player;
- //c2.SPoints += point; // CHANGE THIS TO YOUR POINTS
- // VARIABLE
- c.sendMessage("<shad=24344>You have given " + otherplayer + ", " + point + " Slayer points.");
- c2.sendMessage("<shad=24344>You have been given " + point + " Slayer points by " + c.playerName + ".");
- }
- }
- }
- } catch (final Exception e) {
- c.sendMessage("Wrong syntax! ::givesp name amount");
- }
- }
- if (playerCommand.startsWith("empty")) {
- c.getItems().removeAllItems();
- c.sendMessage("<shad=6081134>You empty your inventory.</col>");
- }
- if (playerCommand.startsWith("npc") && c.playerRights >= 2) {
- 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.equalsIgnoreCase("infspec") && c.playerRights >= 2) {
- c.getItems().updateSpecialBar();
- c.gfx0(2015);
- c.specAmount = 100000000;
- }
- if (playerCommand.equalsIgnoreCase("infhp") && c.playerRights >= 2) {
- c.getPA().requestUpdates();
- c.playerLevel[3] = 99999999;
- c.getPA().refreshSkill(3);
- c.gfx0(754);
- }
- if (playerCommand.equalsIgnoreCase("infpray") && c.playerRights >= 2) {
- c.getPA().requestUpdates();
- c.playerLevel[5] = 99999999;
- c.getPA().refreshSkill(5);
- c.startAnimation(12565);
- c.gfx0(2226);
- }
- if (playerCommand.startsWith("object") && c.playerRights >= 2) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
- }
- if (playerCommand.startsWith("emote") && c.playerRights >= 2) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("spec") && c.playerRights >= 2) {
- c.specAmount = 500.0;
- }
- if (playerCommand.startsWith("giveadmin") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToAdmin = playerCommand.substring(10);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
- Client c2 = (Client) 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("givesupport") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToAdmin = playerCommand.substring(12);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been given Support status by " + c.playerName);
- c2.playerRights = 8;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givemod") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToMod = playerCommand.substring(8);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client) 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("givee") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToMod = playerCommand.substring(6);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been given donator status by " + c.playerName);
- c2.playerRights = 7;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givesuper") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToMod = playerCommand.substring(10);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been given donator status by " + c.playerName);
- c2.playerRights = 6;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givedonor") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToMod = playerCommand.substring(10);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been given donator status by " + c.playerName);
- c2.playerRights = 4;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("givesupport") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToMod = playerCommand.substring(10);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
- Client c2 = (Client) PlayerHandler.players[i];
- c2.sendMessage("You have been given [Support] status by " + c.playerName);
- c2.playerRights = 8;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("demote") && c.playerName.equalsIgnoreCase("mr selby")) {
- try {
- String playerToDemote = playerCommand.substring(7);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToDemote)) {
- Client c2 = (Client) 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.equalsIgnoreCase("switch") && c.playerRights >= 2) {
- for (int i = 0; i < 8; i++) {
- c.getItems().wearItem(c.playerItems[i] - 1, i);
- }
- c.sendMessage("Switching Armor");
- }
- if (playerCommand.equalsIgnoreCase("brid") && c.playerRights >= 2) {
- c.getItems().deleteAllItems();
- int itemsToAdd[] = { 4151, 6585, 10551, 20072, 11732, 11726, 15220, 7462, 2440, 2436, 3024 };
- for (int i = 0; i < itemsToAdd.length; i++) {
- c.getItems().addItem(itemsToAdd[i], 1);
- }
- int[] equip = { 10828, 2414, 18335, 15486, 4712, 6889, -1, 4714, -1, 6922, -1, 6920, 15018 };
- for (int i = 0; i < equip.length; i++) {
- c.playerEquipment[i] = equip[i];
- c.playerEquipmentN[i] = 1;
- c.getItems().setEquipment(equip[i], 1, i);
- }
- c.getItems().addItem(555, 1200);
- c.getItems().addItem(560, 800);
- c.getItems().addItem(565, 400);
- c.getItems().addItem(5698, 1);
- c.getItems().addItem(391, 13);
- c.playerMagicBook = 1;
- c.setSidebarInterface(6, 12855);
- c.getItems().resetItems(3214);
- c.getItems().resetBonus();
- c.getItems().getBonus();
- c.getItems().writeBonus();
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- if (playerCommand.equals("alltome") && c.playerRights == 3) {
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) 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("setlevel") && c.playerRights == 3) {
- try {
- String[] args = playerCommand.split("-");
- int skill = Integer.parseInt(args[1]);
- int level = Integer.parseInt(args[2]);
- String otherplayer = args[3];
- Client target = null;
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
- target = (Client) PlayerHandler.players[i];
- break;
- }
- }
- }
- if (target == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c.sendMessage("You have just set one of " + Misc.ucFirst(target.playerName) + "'s skills.");
- target.sendMessage("" + Misc.ucFirst(c.playerName) + " has just set one of your skills.");
- target.playerXP[skill] = target.getPA().getXPForLevel(level) + 5;
- target.playerLevel[skill] = target.getPA().getLevelForXP(target.playerXP[skill]);
- target.getPA().refreshSkill(skill);
- } catch (Exception e) {
- c.sendMessage("Use as ::setlevel SKILLID LEVEL PLAYERNAME.");
- }
- }
- if (playerCommand.startsWith("shop")) {
- try {
- c.getShops().openShop(Integer.parseInt(playerCommand.substring(5)));
- } catch (Exception e) {
- c.sendMessage("Invalid input data! try typing ::shop 1");
- }
- }
- if (playerCommand.equals("votenow") && c.playerRights == 3) {
- for (int j = 0; j < PlayerHandler.players.length; j++)
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- c2.getPA().sendFrame126("annihilatedreality.net/vote", 12000);
- c2.sendMessage("Please vote every 12 hours!");
- }
- }
- if (playerCommand.equals("website") && c.playerRights == 3) {
- for (int j = 0; j < PlayerHandler.players.length; j++)
- if (PlayerHandler.players[j] != null) {
- Client c2 = (Client) PlayerHandler.players[j];
- c2.getPA().sendFrame126("annihilatedreality.net", 12001);
- c2.sendMessage("Enjoy annihilated Reality's Site!");
- }
- }
- if (playerCommand.startsWith("demon") && c.playerRights >= 2) {
- int id = 82 + Misc.random(2);
- c.npcId2 = id;
- c.isNpc = true;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- c.playerStandIndex = 66;
- c.playerTurnIndex = 66;
- c.playerWalkIndex = 63;
- c.playerTurn180Index = 66;
- c.playerTurn90CWIndex = 66;
- c.playerTurn90CCWIndex = 63;
- c.playerRunIndex = 63;
- }
- if (playerCommand.startsWith("brute") && c.playerRights >= 2) {
- int id = 6102 + Misc.random(2);
- c.npcId2 = id;
- c.isNpc = true;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- }
- public void SupportCommands(Client c, String playerCommand) {
- if (playerCommand.startsWith("szone")) {
- c.getPA().startTeleport(3087, 3498, 0, "modern");
- c.sendMessage("Just testing at the moment.");
- }
- if (playerCommand.startsWith("report") && playerCommand.length() > 7) {
- try {
- BufferedWriter report = new BufferedWriter(new FileWriter("./Data/bans/Reports.txt", true));
- String Report = playerCommand.substring(7);
- try {
- report.newLine();
- report.write("[Support]" + c.playerName + ": " + Report);
- c.sendMessage("You have successfully submitted your report.");
- } finally {
- report.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- public void DonatorCommands(Client c, String playerCommand) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement