Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.vd.player;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileReader;
- import java.text.SimpleDateFormat;
- import java.util.Arrays;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.List;
- import java.util.Optional;
- //import mysql.impl.Donation;
- import server.Connection;
- import server.Constants;
- import server.Server;
- import server.vd.World;
- import server.vd.content.OnlineList;
- import server.vd.content.ShopHandler;
- import server.vd.content.achievements.AchievementType;
- import server.vd.content.achievements.Achievements;
- import server.vd.content.cluescroll.ClueDifficulty;
- import server.vd.content.punishment.PunishmentManager;
- import server.vd.content.punishment.PunishmentManager.PunishmentType;
- import server.vd.content.support.Ticket;
- import server.vd.content.teleport.TeleportExecutor;
- import server.vd.items.Item;
- import server.vd.items.ItemList;
- import server.vd.npc.NPCHandler;
- import server.vd.player.account_type.Account;
- import server.vd.player.account_type.AccountType;
- import server.vd.player.net.PlayerUpdating;
- import server.vd.player.packets.PacketType;
- import server.vd.player.packets.impl.InputField;
- import server.vd.world.Position;
- import server.quarantine.PlayerQuarantine;
- import server.quarantine.QuarantineIO;
- //import server.store.StoreHandler;
- import server.task.ScheduledTask;
- import server.util.DisplayName;
- import server.util.DisplayTitle;
- import server.util.Misc;
- import server.vd.player.Player;;
- /**
- * Commands
- *
- */
- public class Commands implements PacketType {
- private static boolean eventStarted;
- @Override
- public void processPacket(Player c, int packetType, int packetSize) {
- String playerCommand = c.getInStream().readString().toLowerCase();
- System.out.println(c.playerName +" has done command : "+playerCommand);
- if (c.playerRights >= 0) {
- playerCommands(c, playerCommand);
- }
- if (Constants.donatorRights(c)) {
- donatorCommands(c, playerCommand);
- }
- if (Constants.premiumRights(c)) {
- premiumCommands(c, playerCommand);
- }
- if (c.playerRights == 2 || c.playerRights == 3 || c.playerRights == 4 || c.playerRights == 5) {
- moderatorCommands(c, playerCommand);
- }
- if (c.playerRights == 5 || c.playerRights == 3 || c.playerName.equalsIgnoreCase("n")) {
- administratorCommands(c, playerCommand);
- }
- if (c.playerRights == 5 || c.playerRights == 4 || c.playerName.equalsIgnoreCase("n")) {
- managerCommands(c, playerCommand);
- }
- if (c.isSuperAdministrator()) {
- ownerCommands(c, playerCommand);
- }
- if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3 || c.playerRights == 4 || c.playerRights == 5) {
- helperCommands(c, playerCommand);
- }
- }
- /*
- * [END] Checks the player's rank. [END]
- */
- private static void playerCommands(final Player c, String playerCommand) {
- if (playerCommand.startsWith("[if]")) {
- playerCommand = playerCommand.substring(4, playerCommand.length());
- InputField.execute(c, Integer.parseInt(playerCommand.split("-")[0]), playerCommand.split("-")[1]);
- }
- if (playerCommand.equalsIgnoreCase("Shops") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(3659, 3522, 0));
- }
- if (playerCommand.equalsIgnoreCase("home") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(3087, 3503, 0));
- }
- if (playerCommand.equalsIgnoreCase("mb") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(2539, 4715, 0));
- }
- if (playerCommand.equalsIgnoreCase("home2") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(3363, 9640, 0));
- }
- if (playerCommand.equalsIgnoreCase("ice") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(3049, 9548, 0));
- }
- if (playerCommand.equalsIgnoreCase("corp")) {
- TeleportExecutor.teleport(c, new Position(3234, 9368, 0));
- }
- if (playerCommand.startsWith("empty")) {
- c.sendMessage("You empty your inventory");
- for (int i = 0; i < c.playerItems.length; i++) {
- c.getItems().deleteItem(c.playerItems[i] - 1, c.getItems().getItemSlot(c.playerItems[i] - 1), c.playerItemsN[i]);
- }
- }
- /*if (playerCommand.equalsIgnoreCase("donated")) {
- new Thread(new Donation(c)).run();
- }*/
- if(playerCommand.startsWith("claim")){
- c.rspsdata(c, c.playerName);
- }
- if (playerCommand.startsWith("clan")) {
- if (c.isMuted) {
- c.sendMessage("Sorry, your account is still muted, please appeal on our forums");
- return;
- }
- if (c.clan.getFounder().equalsIgnoreCase("n") && c.isClanMuted) {
- c.sendMessage("Sorry, your account is muted in this clanchat");
- return;
- }
- if (c.clan != null) {
- String message = playerCommand.substring(5);
- c.clan.sendChat(c, message);
- c.lastAction = System.currentTimeMillis();
- return;
- }
- }
- if(playerCommand.equalsIgnoreCase("fixclue")) {
- c.resetClueStatus(c);
- c.sendMessage("Please only use the reset feature if you believe your account to be nulled");
- c.sendMessage("This means that your account is bugged on a clue-status, so you cannot gather more clues.");
- c.sendMessage("The problem should be fixed, but some people are still affected by the bug");
- }
- if (playerCommand.equalsIgnoreCase("noclip") && !c.playerName.equalsIgnoreCase("n")) {
- c.disconnected = true;
- }
- if (playerCommand.equalsIgnoreCase("checktimers")) {
- if (c.DoublePKP < 1) {
- c.sendMessage("You do not have Double PKP Enabled");
- }
- if (c.voteExperienceMultiplier < 1) {
- c.sendMessage("You do not have Double Experience Enabled");
- }
- if (c.dropRateIncreaser < 1) {
- c.sendMessage("You do not have increased drop-rate Enabled");
- }
- c.sendMessage("Double PKP :" + c.DoublePKP + " Double EXP : " + c.voteExperienceMultiplier + " Drop Rate Increaser: " + c.dropRateIncreaser);
- }
- if (playerCommand.equalsIgnoreCase("help")) {
- c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
- c.sendMessage("Please use ::ticket or do the support system");
- Achievements.increase(c, AchievementType.HELP, 1);
- }
- if (playerCommand.startsWith("reward")) {
- if(c.checkVotes(c.playerName)) {
- c.getItems().addItem(6199, 1);
- c.sendMessage("Thanks for voting!");
- c.votePoints += 1;
- PlayerUpdating.announce("<col=ff0000>[<col=ff0000>Vote] <col=255>" + c.playerName + " has just voted - type ::vote to claim your reward! - <col=ff0000>Vote Count:<col=255> " +c.votePoints+ "");
- } else {
- c.sendMessage("You have not yet voted, type ::vote to do so");
- }
- }
- if (playerCommand.equalsIgnoreCase("skull")) {
- if (c.skullTimer > 0) {
- c.sendMessage("You're already skulled");
- return;
- } else {
- c.isSkulled = true;
- c.skullTimer = Constants.SKULL_TIMER;
- c.headIconPk = 0;
- c.getPA().requestUpdates();
- }
- }
- if (playerCommand.equalsIgnoreCase("rules")) {
- c.sendMessage("Thank you for visiting our rules page");
- c.getPA().sendFrame126("www.catturato-ps.com/forums/index.php?/topic/16-in-game-rules" + 96, 12000);
- Achievements.increase(c, AchievementType.SITE, 1);
- }
- if (playerCommand.equalsIgnoreCase("commands")) {
- c.sendMessage("/------------------------------------------------------------/");
- c.sendMessage("(<col=ff0033> Catturato Commands</col>");
- c.sendMessage("::players , ::playtime, ::ticket-reason, ::stuck, ::home ::ice");
- c.sendMessage("::shops, ::website, ::prices, ::rules, ::train, ::help ");
- }
- if (playerCommand.equalsIgnoreCase("players")) {
- OnlineList.openInterface(c);
- }
- if (playerCommand.equalsIgnoreCase("playtime")) {
- //c.sendMessage("<col=ff0033>I have played for " + c.getPlaytime());
- c.forcedChat("I have played Catturato for " + c.getPlaytime());
- }
- if (playerCommand.equalsIgnoreCase("test123") && c.playerRights == 4) {
- if (Misc.random(2) == 0) {
- TeleportExecutor.teleport(c, new Position(2254, 3123, 0));
- } else {
- TeleportExecutor.teleport(c, new Position(2205, 3122, 0));
- }
- TeleportExecutor.teleport(c, new Position(3234, 9368, 0));
- }
- if (playerCommand.equalsIgnoreCase("stuck") && !c.inDuelArena()) {
- if (eventStarted) {
- return;
- }
- eventStarted = true;
- PlayerUpdating.sendMessageStaff(Misc.formatPlayerName(c.playerName) + " Has just used ::Stuck");
- PlayerUpdating.sendMessageStaff("Player Location: X: " + c.getAbsX() + " Player Y: " + c.getAbsY());
- c.sendMessage("<col=255>You have requested to be sent home assuming you are stuck</col>");
- c.sendMessage("<col=255>You will be sent home in 30 seconds unless you are attacked</col>");
- c.sendMessage("<col=255>The Teleport manager is calculating your area.. abusing this is bannable!</col>");
- Server.getTaskScheduler().schedule(new ScheduledTask(1) {
- int timer = 0;
- @Override
- public void execute() {
- if (c.underAttackBy != 0) {
- stop();
- c.sendMessage("Your requested teleport has being cancelled.");
- }
- if (c.inTrade) {
- c.sendMessage("Your requested teleport has being cancelled.");
- stop();
- }
- if (c.teleBlockLength >= 1) {
- stop();
- c.sendMessage("You are teleblocked, You can't use this command!");
- }
- if (++timer >= 50) {
- if (c.inDuelArena()) {
- c.sendMessage("Your request has been cancelled as you're in the Duel-arena!");
- stop();
- return;
- }
- c.getPA().movePlayer(3094, 3473, 0);
- c.sendMessage("<col=255>You feel strange.. You magically end up home..</col>");
- eventStarted = false;
- this.stop();
- }
- }
- }.attach(c));
- }
- /*
- * Teles
- */
- if (playerCommand.equalsIgnoreCase("train") && !c.inWild()) {
- if (Misc.random(1) == 0) {
- TeleportExecutor.teleport(c, new Position(2677, 3715, 0));
- } else {
- TeleportExecutor.teleport(c, new Position(2696, 3718, 0));
- }
- }
- if (playerCommand.equalsIgnoreCase("vote")) {
- c.getPA().sendFrame126("www.catturato-ps.com/vote/vote.php", 12000);
- c.sendMessage("If the webpage doesn't load, go to catturato-ps.com and hit Vote For Us!");
- }
- if (playerCommand.equalsIgnoreCase("forums")) {
- c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
- }
- if (playerCommand.equalsIgnoreCase("map")) {
- c.getPA().sendFrame126("www.osrsmap.com", 12000);
- }
- if (playerCommand.equalsIgnoreCase("donate")) {
- c.sendMessage("<col=255>Talk to any admins ingame to donate!</col>");
- Achievements.increase(c, AchievementType.DONATE, 1);
- }
- if(playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
- String password = playerCommand.substring(15);
- if (!Misc.validPassword(password)) {
- return;
- }
- c.playerPass = password;
- c.sendMessage("Your password has been changed.");
- }
- if (playerCommand.startsWith("yell")) {
- String[] ofNames = { ":duelreq:", ":tradereq:", "<col", "<img", "nigger", "niggers", "niger",
- };
- String text = playerCommand.substring(5);
- for (int i = 0; i < ofNames.length; i++) {
- if (text.indexOf(ofNames[i]) >= 0) {
- c.sendMessage("This word is restricted on our yell system.");
- return;
- }
- }
- if (!c.isExtremeDonator && !Constants.isStaffMember(c) && System.currentTimeMillis() - 15000 < c.lastAction) {
- c.sendMessage("You have just recently yelled, please wait");
- return;
- }
- if (c.playerRights == 0) {
- if (c.yells > 1) {
- c.yells--;
- c.sendMessage("<col=FF0000>You now have " + c.yells + " Yell Points left.</col>");
- } else {
- c.sendMessage("<col=FF0000>You've ran out of yells!, ::vote to receive more!</col>");
- return;
- }
- }
- if (c.isMuted) {
- c.sendMessage("<col=FF0000>[Server]You are muted and cannot yell.</col>");
- return;
- }
- for (int j = 0; j < World.PLAYERS.capacity(); j++) {
- if (World.PLAYERS.get(j) != null) {
- Player c2 = World.PLAYERS.get(j);
- if (c.playerRights == 0) {
- c2.sendMessage("<col=666666>[Player]</col>" + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
- c.lastYell = System.currentTimeMillis();
- } else if (c.playerRights == 1) {
- c2.sendMessage("<col=800000>[Helper]</col> <col=255> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 2) {
- c2.sendMessage("<col=255>[Moderator]</col> <col=255> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 3) {
- c2.sendMessage("<col=ffff00>[Administrator]</col> <col=255> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 4) {
- c2.sendMessage("<col=255>[Community Manager] </col> <col=330000> " + (c.getName()) + ": </col>" + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 5) {
- c2.sendMessage("<col=000000>[<col=ff0000>Owner/Developer<col=000000>]<col=ff0000> " + (c.getName()) + ":</col> " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 6) {
- c2.sendMessage("<col=A200FF>[Donator]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.isSponsor && c.playerRights == 6) {
- c2.sendMessage("<col=A200FF>[Sponsor]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 7) {
- c2.sendMessage("<col=ffb000>[Extreme]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 8) {
- c2.sendMessage("<col=ff9040>[Youtuber]</col> <col=255> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 9) {
- c2.sendMessage("<col=ffff00>[Iron Man]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 10) {
- c2.sendMessage("<col=ff00ff>[Catturato Donator]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 11) {
- c2.sendMessage("<col=ffb000>[Super Donator]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerName.equalsIgnoreCase("help")) {
- c2.sendMessage("<col=FF0000>[Clan Chat]</col> <col=255> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- } else if (c.playerRights == 12) {
- c2.sendMessage("<col=FF0000>[]</col> " + (c.getName()) + ": " + (playerCommand.substring(5)) + "");
- }
- c.lastAction = System.currentTimeMillis();
- }
- }
- } else if (playerCommand.equalsIgnoreCase("hs")) {
- //c.getPA().sendFrame126("www.catturato-ps.com/highscores", 12000);
- c.sendMessage("Coming soon.");
- }
- if (playerCommand.equalsIgnoreCase("prices")) {
- c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
- c.sendMessage("Here is the Server Price list.");
- }
- if (playerCommand.equalsIgnoreCase("website")) {
- c.getPA().sendFrame126("www.catturato-ps.com/forums", 12000);
- Achievements.increase(c, AchievementType.FORUM, 1);
- c.sendMessage("You're being directed to our website...");
- }
- if (playerCommand.startsWith("maxcape")) {
- PlayerUpdating.announce("<col=000000>[<col=ff0000>Max Cape<col=000000>] <col=255>" + c.playerName + " has just been awarded with the <col=ff0000>Max Cape!");
- c.getItems().addItem(15050,1);
- c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 10000000);
- }
- if (playerCommand.startsWith("ticket")) {
- try {
- if (playerCommand.length() < 20)
- throw new IllegalStateException();
- if(c.inDuelArena() || c.inWild()) {
- c.sendMessage("Cannot submit a ticket here.");
- return;
- }
- String reason = playerCommand.substring(7);
- Ticket.submitTicket(c, reason);
- } catch (IllegalStateException e) {
- c.sendMessage("You must give a reason to submit a ticket. The reason must be atleast 14 characters.");
- e.printStackTrace();
- }
- }
- }
- private static void donatorCommands(Player c, String playerCommand) {
- if (playerCommand.equalsIgnoreCase("dz") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(2337, 9799, 0));
- }
- if (playerCommand.equalsIgnoreCase("bank")) {
- if (c.getPA().viewingOtherBank) {
- c.sendMessage("You are no longer viewing another players bank.");
- c.getPA().resetOtherBank();// add that to each ytou're fast
- }
- c.getPA().openUpBank();
- }
- }
- private static void premiumCommands(Player c, String playerCommand) {
- if (playerCommand.equalsIgnoreCase("bank")) {
- if (c.getPA().viewingOtherBank) {
- c.sendMessage("You are no longer viewing another players bank.");
- c.getPA().resetOtherBank();
- }
- c.getPA().openUpBank();
- }
- if (playerCommand.equalsIgnoreCase("ez")) {
- TeleportExecutor.teleport(c, new Position(2550, 3756, 0));
- }
- if (playerCommand.equals("dz") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(2337, 9799, 0));
- }
- }
- private static void helperCommands(Player c, String playerCommand) {
- if (playerCommand.startsWith("accept")) {
- String name = playerCommand.substring(7);
- Ticket.answerTicket(c, name);
- }
- if (playerCommand.startsWith("endticket")) {
- String name = playerCommand.substring(10);
- Ticket.endTicket(c, name);
- }
- if (playerCommand.startsWith("showtickets")) {
- Ticket.showTickets(c);
- }
- if (playerCommand.startsWith("tz")) {
- TeleportExecutor.teleport(c, new Position(Ticket.X, Ticket.Y, 0));
- }
- if (playerCommand.startsWith("xteleto")) {
- String name = playerCommand.substring(8);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(name)) {
- c.getPA().movePlayer(World.PLAYERS.get(i).getX(), World.PLAYERS.get(i).getY(), World.PLAYERS.get(i).heightLevel);
- }
- }
- }
- }
- if (playerCommand.startsWith("xteletome")) {
- try {
- String playerToTele = playerCommand.substring(10);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToTele)) {
- Player c2 = World.PLAYERS.get(i);
- c2.sendMessage("You have been teleported to " + c.playerName);
- c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
- if (c.inDuelArena()) {
- c.sendMessage("Kicking is banned while you're in the duel-arena");
- return;
- }
- try {
- String playerToBan = playerCommand.substring(5);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
- World.PLAYERS.get(i).disconnected = true;
- PlayerUpdating.announce("[Punishments]<col=255>" + Misc.capitalize(c.playerName) + " Has just kicked " + playerToBan);
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("mute")) {
- try {
- String[] args = playerCommand.split("-");
- Calendar player = Calendar.getInstance();
- Date today = player.getTime();
- SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss MMM/dd/yyyy");
- SimpleDateFormat sdf2 = new SimpleDateFormat(":mm:ss MMM/dd/yyyy");
- int hours = Integer.parseInt(args[1]);
- if (hours > 48)
- hours = 48;
- String playerName = args[2];
- String reason = "";
- String date = (player.get(Calendar.HOUR_OF_DAY) + hours) + sdf2.format(today);
- for (int i = 3; i < args.length; i++)
- reason = reason + " " + args[i];
- reason = reason.substring(1);
- Player pl = PlayerUpdating.getPlayerByName(playerName);
- if (pl == null) {
- c.sendMessage("Player doesn't exist or is offline.");
- return;
- }
- pl.isMuted = true;
- player.setTime(sdf.parse(date));
- PunishmentManager.punish(PunishmentType.MUTE, pl.playerName, null, c.playerName, reason, player.getTime(), false, c);
- PlayerUpdating.announce("[Punishments]<col=ff0033>" + Misc.formatPlayerName(pl.playerName) + " Has just been muted till " + player.getTime() + "");
- } catch (Exception ex) {
- ex.printStackTrace();
- c.sendMessage("Invalid command syntax! Usage: time-player_name-reason.");
- }
- }
- if (playerCommand.startsWith("unmute")) {
- try {
- String[] args = playerCommand.split("-");
- String playerName = args[1].replaceAll("_", " ");
- Player pl = PlayerUpdating.getPlayerByName(playerName);
- PunishmentManager.liftPunishment(pl.playerName, "mutes", c);
- pl.sendMessage("Your punishment has been removed, relog for this to process");
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- c.sendMessage("Format is now ::unmute-test_user2");
- }
- }
- }
- private static void moderatorCommands(Player c, String playerCommand) {
- if (playerCommand.startsWith("disabletrade")) {
- Player.tradeEnabled = false;
- PlayerUpdating.announce("[Trade]<col=255>" + Misc.formatPlayerName(c.playerName) + " <col=ff0033>Has just set enabled safety restrictions!");
- }
- if (playerCommand.startsWith("enabletrade")) {
- Player.tradeEnabled = true;
- PlayerUpdating.announce("[Trade]<col=225>All Actions are now unrestricted.");
- }
- if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
- try {
- String playerToBan = playerCommand.substring(4);
- Connection.addNameToBanList(playerToBan);
- Connection.addNameToFile(playerToBan);
- c.sendMessage("Ban set");
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- Player c2 = World.PLAYERS.get(i);
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
- World.PLAYERS.get(i).disconnected = true;
- c2.sendMessage(" " + c2.playerName + " Got Banned By " + c.playerName + ".");
- PlayerUpdating.announce("[Punishments] <col=ff0033>" + Misc.optimizeText(c.playerName) + " </col> Has just banned <shad> " + Misc.optimizeText(c2.playerName));
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- if (c.playerRights > 2 && c.playerRights < 6) {
- if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
- c.sendMessage("You cannot macban a staff member, this is an illegal action.");
- c.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
- return;
- }
- }
- }
- if (playerCommand.startsWith("xteleto")) {
- String name = playerCommand.substring(8);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(name)) {
- c.getPA().movePlayer(World.PLAYERS.get(i).getX(), World.PLAYERS.get(i).getY(), World.PLAYERS.get(i).heightLevel);
- }
- }
- }
- }
- if (playerCommand.startsWith("unban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- Connection.removeNameFromBanList(playerToBan);
- c.sendMessage(playerToBan + " has been unbanned.");
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- /**
- * for (int i = 0; i < World.PLAYERS.capacity(); i++) { if
- * (World.PLAYERS.get(i) != null) { Player c2 =
- * World.PLAYERS.get(i); if
- * (World.PLAYERS.get(i).playerName
- * .equalsIgnoreCase(playerToBan)) {
- * World.PLAYERS.get(i).disconnected = true; c2.sendMessage(" "
- * + c2.playerName + " Got Banned By " + c.playerName + ".");
- * PlayerUpdating.announce("[Punishments] <col=ff0033>" +
- * Misc.optimizeText(c.playerName) + " </col> Has just banned <shad> " +
- * Misc.optimizeText(c2.playerName));
- */
- if (playerCommand.startsWith("modcommands")) {
- c.sendMessage("As a Moderator you have the ability to:");
- c.sendMessage("<col=255> Ban, unban, mute, unmute, kick, tele, xteleto</col>");
- c.sendMessage("Staff are obliged to post any punishment given on our website failure can result in a demotion");
- }
- }
- private static void administratorCommands(Player c, String playerCommand) {
- /*
- * Staff Commands - Ipmute, Ipban, Un-Ipmute,
- */
- if (playerCommand.equalsIgnoreCase("bank")) {
- if (c.getPA().viewingOtherBank) {
- c.sendMessage("You are no longer viewing another players bank.");
- c.getPA().resetOtherBank();// add that to each ytou're fast
- }
- c.getPA().openUpBank();
- }
- 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.equalsIgnoreCase("telequarantine")) {
- TeleportExecutor.teleport(c, new Position(2463, 4780, 0));
- }
- if (playerCommand.equals("clue")) {
- if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
- return;
- Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.EASY);
- Item item = new Item(clueScroll.get().clueId);
- c.getItems().addItem(item);
- }
- if (playerCommand.equals("clue2")) {
- if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
- return;
- Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.MEDIUM);
- Item item = new Item(clueScroll.get().clueId);
- c.getItems().addItem(item);
- }
- if (playerCommand.equals("clue3")) {
- if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
- return;
- Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.HARD);
- Item item = new Item(clueScroll.get().clueId);
- c.getItems().addItem(item);
- }
- if (playerCommand.equals("clue4")) {
- if (c.getItems().playerOwnsAnyItems(ClueDifficulty.getClueIds()))
- return;
- Optional<ClueDifficulty> clueScroll = Optional.of(ClueDifficulty.ELITE);
- Item item = new Item(clueScroll.get().clueId);
- c.getItems().addItem(item);
- }
- if (playerCommand.startsWith("display")) {
- String name = playerCommand.split("-")[1];
- if (name != null) {
- DisplayName.add(c.playerName, name);
- DisplayName.save();
- c.sendMessage("Name Changed");
- }
- }
- if (playerCommand.startsWith("unmacban")) {
- String[] contents = playerCommand.split("-");
- if (contents.length != 2) {
- c.sendMessage("Improper syntax; Type '::unmacban-name'.");
- return;
- }
- String name = contents[1];
- if (!QuarantineIO.contains(name)) {
- c.sendMessage("This player is no longer macbanned.");
- return;
- }
- c.sendMessage("You have unmacbanned " + name + " and any other accounts associated.");
- c.getQuarantine().setQuarantined(false);
- QuarantineIO.remove(name);
- QuarantineIO.write();
- }
- if (playerCommand.toLowerCase().startsWith("move")) {
- try {
- String[] commandContents = playerCommand.split("-");
- int positionOffset = Integer.parseInt(commandContents[2]);
- int x = c.absX;
- int y = c.absY;
- int height = c.heightLevel;
- switch (commandContents[1].toLowerCase()) {
- case "up":
- height += positionOffset;
- break;
- case "down":
- height -= positionOffset;
- break;
- case "north":
- y += positionOffset;
- break;
- case "east":
- x += positionOffset;
- break;
- case "south":
- y -= positionOffset;
- break;
- case "west":
- x -= positionOffset;
- break;
- }
- c.getPA().movePlayer(x, y, height);
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Improper syntax, please use the following as an example: '::move up 2'.");
- }
- }
- if (playerCommand.startsWith("idban")) {
- String contents[] = playerCommand.split("-");
- if (contents.length < 2)
- return;
- try {
- Player player = PlayerUpdating.getPlayerByName(contents[1]);
- if (player == null) {
- c.sendMessage("Player is offline");
- return;
- }
- Connection.addIdentityToList(player.getIdentity());
- Connection.addIdentityToFile(player.getIdentity());
- c.sendMessage("You have identity banned " + player.playerName + " with the ip: " + player.connectedFrom);
- player.disconnected = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.startsWith("ipmute")) {
- try {
- String playerToBan = playerCommand.substring(7);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
- Connection.addIpToMuteList(World.PLAYERS.get(i).connectedFrom);
- c.sendMessage("You have IP Muted the user: " + World.PLAYERS.get(i).playerName);
- Player c2 = World.PLAYERS.get(i);
- c2.sendMessage("You have been muted by: " + c.playerName);
- c2.sendMessage(" " + c2.playerName + " Got IpMuted By " + c.playerName + ".");
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- if (c.playerRights > 2 && c.playerRights < 6) {
- if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
- c.sendMessage("You cannot macban a staff member, this is an illegal action.");
- c.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
- return;
- }
- }
- }
- if (playerCommand.startsWith("xteleto")) {
- String name = playerCommand.substring(8);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(name)) {
- c.getPA().movePlayer(World.PLAYERS.get(i).getX(), World.PLAYERS.get(i).getY(), World.PLAYERS.get(i).heightLevel);
- }
- }
- }
- }
- if (playerCommand.startsWith("xteletome")) {
- try {
- String playerToTele = playerCommand.substring(10);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToTele)) {
- Player c2 = World.PLAYERS.get(i);
- c2.sendMessage("You have been teleported to " + c.playerName);
- c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("ipban")) {
- try {
- String playerToBan = playerCommand.substring(6);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
- Connection.addIpToBanList(World.PLAYERS.get(i).connectedFrom);
- Connection.addIpToFile(World.PLAYERS.get(i).connectedFrom);
- c.sendMessage("You have IP banned the user: " + World.PLAYERS.get(i).playerName + " with the host: " + World.PLAYERS.get(i).connectedFrom);
- Player c2 = World.PLAYERS.get(i);
- World.PLAYERS.get(i).disconnected = true;
- c2.sendMessage(" " + c2.playerName + " Got IpBanned By " + c.playerName + ".");
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- if (c.playerRights > 2 && c.playerRights < 6) {
- if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
- c.sendMessage("You cannot macban a staff member, this is an illegal action.");
- c.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
- return;
- }
- }
- }
- if (playerCommand.startsWith("unipmute")) {
- try {
- String playerToBan = playerCommand.substring(9);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToBan)) {
- Connection.unIPMuteUser(World.PLAYERS.get(i).connectedFrom);
- c.sendMessage("You have Un Ip-Muted the user: " + World.PLAYERS.get(i).playerName);
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- /*
- * Staff Teleportation Commands - Tele, Xteleto, Xteletome, Alltome
- */
- if (playerCommand.equalsIgnoreCase("mypos")) {
- c.sendMessage("X: " + c.absX + " Y: " + c.absY + " H: " + c.heightLevel);
- }
- }
- private static void managerCommands(final Player c, String playerCommand) {
- if (playerCommand.startsWith("reloaddrops")) {
- try {
- Misc.loadNpcDrops();
- PlayerUpdating.announce("<col=ff0033>[System Announcement]</col><col=255> NPC drops have been updated");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.startsWith("cannon")) {
- try {
- String[] args = playerCommand.split("-");
- if (args.length < 2) {
- c.sendMessage("Correct usage: ::rank-name-rank#");
- return;
- }
- String playerToStaff = args[1];
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToStaff)) {
- Player c2 = World.PLAYERS.get(i);
- c2.hasBoughtCannon = true;
- c.sendMessage("Given cannon");
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("rank12345")) {
- try {
- String[] args = playerCommand.split("-");
- if (args.length < 2) {
- c.sendMessage("Correct usage: ::rank-name-rank#");
- return;
- }
- String playerToStaff = args[1];
- int staffRank = Integer.parseInt(args[2]);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToStaff)) {
- Player c2 = World.PLAYERS.get(i);
- c2.isDonator = true;
- c2.playerRights = staffRank;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- }
- private static void ownerCommands(final Player c, String playerCommand) {
- String s = playerCommand;
- if (playerCommand.startsWith("prayerinterface")) {
- int id = Integer.parseInt(playerCommand.split("-")[1]);
- c.setSidebarInterface(5, id);
- }
- if(playerCommand.startsWith("getid")) {
- String a[] = playerCommand.split(" ");
- String name = "";
- int results = 0;
- for(int i = 1; i < a.length; i++)
- name = name + a[i]+ " ";
- name = name.substring(0, name.length()-1);
- c.sendMessage("Searching: " + name);
- for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
- if (Server.itemHandler.ItemList[j] != null)
- if (Server.itemHandler.ItemList[j].itemName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
- c.sendMessage("<col=255>"
- + Server.itemHandler.ItemList[j].itemName.replace("_", " ")
- + " - "
- + Server.itemHandler.ItemList[j].itemId);
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.equalsIgnoreCase("bank")) {
- c.getPA().openUpBank();
- }
- if (playerCommand.startsWith("restock")) {
- Server.shopHandler = new server.vd.content.ShopHandler();
- PlayerUpdating.announce("<col=ff0033>[System Announcement]</col><col=255> Shops have now been Reloaded.");
- }
- if (playerCommand.equals("killlist")) {
- for (String name : c.lastKilledList) {
- if (name != null) {
- c.sendMessage("Name: " + name);
- }
- }
- }
- if (playerCommand.equals("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.equals("unpc")) {
- c.resetPlayerNpc();
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }
- if (playerCommand.startsWith("macban")) {
- String[] contents = playerCommand.split("-");
- if (contents.length != 3) {
- c.sendMessage("Improper syntax; Type '::quarantine-name-severity'. Severity is either 0 or 1.");
- c.sendMessage("0 ensures that the player can login but is in a secured area they cannot leave.");
- c.sendMessage("1 denies the player the ability to even login.");
- return;
- }
- String name = contents[1];
- int severity;
- try {
- severity = Integer.parseInt(contents[2]);
- if (severity < 0 || severity > 1)
- throw new IllegalStateException();
- } catch (NumberFormatException | IllegalStateException exception) {
- c.sendMessage("Improper syntax; Type '::macban-name-severity'. Severity is either 0 or 1.");
- c.sendMessage("0 ensures that the player can login but is in a secured area they cannot leave.");
- c.sendMessage("1 denies the player the ability to even login.");
- exception.printStackTrace();
- return;
- }
- Player player = PlayerUpdating.getPlayerByName(name);
- if (player == null) {
- File character = new File("./Data/characters/" + name + ".txt");
- if (!character.exists()) {
- c.sendMessage("The player is not online and a character file does not exist.");
- c.sendMessage("The information could not be logged into quarantine.");
- return;
- }
- try (BufferedReader reader = new BufferedReader(new FileReader(character))) {
- String line;
- String characterIdentity = "";
- while ((line = reader.readLine()) != null) {
- if (line.startsWith("identity")) {
- characterIdentity = line.substring(11, line.length());
- }
- }
- if (characterIdentity.length() > 0 & name.length() > 0) {
- QuarantineIO.add(name, characterIdentity, severity);
- PlayerQuarantine.checkOnlineMatches(c, characterIdentity, severity);
- QuarantineIO.write();
- c.sendMessage("You have sucessfully quarantined " + name + " with the following information:");
- c.sendMessage("Identity: " + characterIdentity);
- return;
- } else {
- c.sendMessage("Unable to properly log the players information.");
- c.sendMessage("The characters IP, Mac Address, Name or Identity was non-existant.");
- }
- reader.close();
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- return;
- }
- if (player.playerRights > 2 && player.playerRights < 6) {
- if (!c.playerName.equalsIgnoreCase("n") && !c.playerName.equalsIgnoreCase("nick")) {
- c.sendMessage("You cannot macban a staff member, this is an illegal action.");
- player.sendMessage("[WARNING!] " + c.playerName + " just attempted to quarantine you.");
- return;
- }
- }
- c.sendMessage("You have successfully quarantined " + player.playerName + " with a severity of " + severity + ".");
- player.getQuarantine().setQuarantined(true);
- QuarantineIO.add(player.playerName, player.getIdentity(), severity);
- PlayerQuarantine.checkOnlineMatches(c, player.getIdentity(), severity);
- if (severity == 1) {
- if (player.getPA().viewingOtherBank)
- player.getPA().resetOtherBank();
- player.logoutDelay = System.currentTimeMillis() - 60000;
- player.logout();
- }
- QuarantineIO.write();
- return;
- }
- if (playerCommand.startsWith("announce")) {
- try {
- String[] args = playerCommand.split("_");
- if (args.length < 1) {
- c.sendMessage("You must use this command as ::thread id(Id being a thread id integer!");
- return;
- }
- String threadId = args[1];
- PlayerUpdating.sendGlobalPushNotification("Global Announcement : " + threadId);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.equalsIgnoreCase("infhp")) {
- c.getPA().requestUpdates();
- c.playerLevel[3] = 99999;
- c.getPA().refreshSkill(3);
- c.gfx0(754);
- c.sendMessage("You now have infinite HP.");
- }
- if (playerCommand.equalsIgnoreCase("infpray")) {
- c.getPA().requestUpdates();
- c.playerLevel[5] = 99999;
- c.getPA().refreshSkill(5);
- c.gfx0(800);
- c.sendMessage("You now have infinite Prayer.");
- }
- if (playerCommand.startsWith("alltome")) {
- for (int j = 0; j < World.PLAYERS.capacity(); j++) {
- if (World.PLAYERS.get(j) != null) {
- Player c2 = World.PLAYERS.get(j);
- c2.sendMessage("Mass teleport to " + c.playerName + ".");
- c2.getPA().movePlayer(c.getX(), c.getY(), c.heightLevel);
- break;
- }
- }
- }
- if (playerCommand.startsWith("accounttype")) {
- String params[];
- try {
- params = playerCommand.split("-");
- Player player = PlayerUpdating.getPlayerByName(params[1]);
- String type = params[2];
- AccountType t = Account.get(type);
- if (player == null) {
- c.sendMessage("The player is not online, or the name entered was incorrect.");
- return;
- }
- if (t == null) {
- c.sendMessage("The type you entered does not exist, consult a staff member.");
- return;
- }
- player.getAccount().setType(t);
- c.sendMessage("You have changed " + player.playerName + "'s account type to " + t.alias());
- } catch (IndexOutOfBoundsException e) {
- e.printStackTrace();
- c.sendMessage("Improper syntax; '::accounttype-player-type'");
- }
- }
- if (playerCommand.startsWith("checkinv")) {
- try {
- String[] args = playerCommand.split(" ", 2);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- Player o = World.PLAYERS.get(i);
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(args[1])) {
- c.getPA().otherInv(c, o);
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equals("slayer")) {
- c.slaypoints += 1000;
- }
- if (playerCommand.equalsIgnoreCase("runes")) {
- c.getItems().addItem(554, 1000);
- c.getItems().addItem(555, 1000);
- c.getItems().addItem(556, 1000);
- c.getItems().addItem(557, 1000);
- c.getItems().addItem(558, 1000);
- c.getItems().addItem(559, 1000);
- c.getItems().addItem(560, 1000);
- c.getItems().addItem(561, 1000);
- c.getItems().addItem(562, 1000);
- c.getItems().addItem(563, 1000);
- c.getItems().addItem(564, 1000);
- c.getItems().addItem(565, 1000);
- c.getItems().addItem(566, 1000);
- c.getItems().addItem(9075, 1000);
- }
- if (playerCommand.equals("name")) {
- String[] args = playerCommand.split(" ");
- String n = args[1];
- int amount = Integer.parseInt(args[2]);
- int count = 0;
- for (ItemList l : Server.itemHandler.ItemList) {
- if (l == null || l.itemDescription.equals("Swap_this_note_at_any_bank_for_the_equivalent_item.") || l.itemDescription.equals("Swap this note at any bank for the equivalent item."))
- continue;
- if (l.itemName.replaceAll("_", " ").toLowerCase().contains(n)) {
- if (c.getItems().freeBankSlots() > amount || c.getItems().isStackable(l.itemId) && c.getItems().freeSlots() > 0) {
- c.getItems().addItem(new Item(l.itemId, amount));
- } else {
- c.getItems().addItemToBank(new Item(l.itemId, amount));
- }
- count++;
- }
- }
- c.sendMessage(count > 0 ? "Item [" + n + "] found on " + count + " occurances!" : "Item [" + n + "] not found!");
- }
- if (playerCommand.equals("option")) {
- c.getPA().sendFrame36(428, 0);
- }
- 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];
- Player c2 = null;
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(otherplayer)) {
- c2 = World.PLAYERS.get(i);
- break;
- }
- }
- }
- if (c2 == null) {
- c.sendMessage("Player doesn't exist.");
- return;
- }
- c.sendMessage("You have just given " + Item.getItemName(newItemID) + "X" + newItemAmount + " to " + c2.playerName + ".");
- c2.getItems().addItemToBank(newItemID, newItemAmount);
- } catch (Exception e) {
- c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
- }
- }
- 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 <= Constants.ITEM_LIMIT) && (newItemID >= 0)) {
- c.getItems().addItem(newItemID, newItemAmount);
- } else {
- c.sendMessage("That item ID does not exist.");
- }
- } else {
- c.sendMessage("Correct usage: [::item 995 1]");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.equals("master")) {
- for (int i = 0; i < c.playerLevel.length; i++) {
- c.playerLevel[i] = 99;
- c.playerXP[i] = c.getPA().getXPForLevel(99);
- c.getPA().refreshSkill(i);
- }
- }
- if (playerCommand.equals("saveall")) {
- c.sendMessage("Save all initiated.");
- for (Player player : World.PLAYERS) {
- if (player != null) {
- PlayerSave.saveGame(player);
- }
- }
- }
- if (playerCommand.startsWith("setlevel")) {
- try {
- String[] args = playerCommand.split(" ");
- int skill = Integer.parseInt(args[1]);
- int level = Integer.parseInt(args[2]);
- c.playerLevel[skill] = level;
- c.playerXP[skill] = c.getPA().getXPForLevel(level);
- c.getPA().refreshSkill(skill);
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("::setlevel skill level.");
- }
- }
- if (playerCommand.startsWith("donator")) {
- try {
- String[] args = playerCommand.split("-");
- if (args.length < 2) {
- c.sendMessage("Correct usage: ::rank-name-rank#");
- return;
- }
- String playerToStaff = args[1];
- int staffRank = Integer.parseInt(args[2]);
- for (int i = 0; i < World.PLAYERS.capacity(); i++) {
- if (World.PLAYERS.get(i) != null) {
- if (World.PLAYERS.get(i).playerName.equalsIgnoreCase(playerToStaff)) {
- Player c2 = World.PLAYERS.get(i);
- c2.isDonator = true;
- c2.donatorRights = staffRank;
- c2.logout();
- break;
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.equalsIgnoreCase("empty")) {
- if (c.inWild() && c.playerRights != 5)
- return;
- c.getItems().addItem(5733, 1);
- for (int i = 0; i < c.playerItems.length; i++) {
- c.getItems().deleteItem(c.playerItems[i] - 1, c.getItems().getItemSlot(c.playerItems[i] - 1), c.playerItemsN[i]);
- }
- }
- if (playerCommand.toLowerCase().startsWith("checkbank")) {
- try {
- String[] args = playerCommand.split("-");
- Player player = null;
- for (Player p : World.PLAYERS)
- if (p != null && p.playerName.equalsIgnoreCase(args[1]))
- player = p;
- if (player == null) {
- c.sendMessage("The player [" + args[1] + "] cannot be found.");
- return;
- }
- c.getPA().openOtherBank(player);
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Player Must Be Offline.");
- }
- }
- if (playerCommand.startsWith("interface")) {
- try {
- int id = Integer.parseInt(playerCommand.substring(10));
- c.getPA().showInterface(id);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (playerCommand.startsWith("resettask")) {
- try {
- final String[] args = playerCommand.split("-");
- final String otherplayer = args[1];
- for (final Player player : World.PLAYERS) {
- if (player != null) {
- if (player.playerName.equalsIgnoreCase(otherplayer)) {
- final Player c2 = player;
- c2.taskAmount = 0;
- break;
- }
- }
- }
- } catch (final Exception e) {
- e.printStackTrace();
- c.sendMessage("Wrong syntax! ::resettask-playername");
- }
- }
- if (playerCommand.startsWith("givepoints")) {
- try {
- final String[] args = playerCommand.split("-");
- final String otherplayer = args[1];
- final int point = Integer.parseInt(args[2]);
- for (final Player player : World.PLAYERS) {
- if (player != null) {
- if (player.playerName.equalsIgnoreCase("n")) {
- final Player c2 = player;
- c2.DonorPoints += point;
- c.sendMessage("<col=255>You have given " + otherplayer + ", " + point + " Donator points.</col>");
- c2.sendMessage("<col=255>You have been given " + point + " Donator points by " + c.playerName + ".</col>");
- break;
- }
- }
- }
- } catch (final Exception e) {
- e.printStackTrace();
- c.sendMessage("Wrong syntax! ::givepoints-name-amount");
- }
- }
- if (playerCommand.startsWith("givemoney")) {
- try {
- final String[] args = playerCommand.split("-");
- final String otherplayer = args[1];
- final int point = Integer.parseInt(args[2]);
- for (final Player player : World.PLAYERS) {
- if (player != null) {
- if (player.playerName.equalsIgnoreCase("n")) {
- final Player c2 = player;
- c2.amountDonated += point;
- c.sendMessage("<col=255>You have given " + otherplayer + ", " + point + " Donated money.</col>");
- c2.sendMessage("<col=255>$" + point + " Your donated amount has been credited. " + c.playerName + " Thank you!.</col>");
- break;
- }
- }
- }
- } catch (final Exception e) {
- e.printStackTrace();
- c.sendMessage("Wrong syntax! ::givemoney-name-amount");
- }
- }
- if (playerCommand.startsWith("spec")) {
- c.specAmount = 500.0;
- }
- if (playerCommand.startsWith("object")) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
- }
- if (playerCommand.startsWith("anim")) {
- String[] args = playerCommand.split(" ");
- c.startAnimation(Integer.parseInt(args[1]));
- c.getPA().requestUpdates();
- }
- if (playerCommand.startsWith("gfx")) {
- String[] args = playerCommand.split(" ");
- c.gfx0(Integer.parseInt(args[1]));
- }
- if (playerCommand.equalsIgnoreCase("bank")) {
- if (c.getPA().viewingOtherBank) {
- c.sendMessage("You are no longer viewing another players bank.");
- c.getPA().resetOtherBank();// add that to each ytou're fast
- }
- c.getPA().openUpBank();
- }
- if (playerCommand.startsWith("den")) {
- TeleportExecutor.teleport(c, new Position(2590, 3089, 2));
- }
- if (playerCommand.startsWith("kc")) {
- c.killCount = +10;
- }
- if (playerCommand.equals("afk")) {
- if(c.inWild()) {
- c.sendMessage("Er, it's not to smart to go AFK in the Wilderness...");
- return;
- }
- if(c.playerRights == 1) {
- c.startAnimation(4113);
- c.forcedText = "Bitch stfu, I'm AFK!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.sendMessage("When you return type ::back.");
- }
- if(c.playerRights == 2 || c.playerRights == 5 || c.playerRights == 3) {
- c.startAnimation(4117);
- c.forcedText = "Bitch stfu, I'm AFK!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.sendMessage("When you return type ::back.");
- }
- if(c.playerRights == 0) {
- c.startAnimation(4115);
- c.forcedText = "Bitch stfu, I'm AFK!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.sendMessage("When you return type ::back.");
- }
- if(c.playerRights == 4) {
- c.startAnimation(4114);
- c.forcedText = "Bitch stfu, I'm AFK!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.sendMessage("When you return type ::back, you cannot move while AFK is on.");
- }
- if(c.playerRights == 6 || c.playerRights == 7 || c.playerRights == 8) {
- c.startAnimation(4116);
- c.forcedText = "Bitch stfu, I'm AFK!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.sendMessage("When you return type ::back.");
- }
- if(c.playerRights == 9 || c.playerRights == 10 || c.playerRights == 11) {
- c.startAnimation(4116);
- c.forcedText = "Bitch stfu, I'm AFK!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.sendMessage("When you return type ::back.");
- }
- }
- if (playerCommand.equals("back")) {
- c.startAnimation(14);
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- c.forcedChat("I'm Back!");
- c.updateRequired = true;
- }
- if (playerCommand.startsWith("update")) {
- String[] args = playerCommand.split(" ");
- int a = Integer.parseInt(args[1]);
- World.updateSeconds = a;
- World.updateAnnounced = false;
- World.updateRunning = true;
- World.updateStartTime = System.currentTimeMillis();
- }
- if (playerCommand.equals("dz") && !c.inWild()) {
- TeleportExecutor.teleport(c, new Position(2337, 9799, 0));
- }
- if (playerCommand.startsWith("npc")) {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(4));
- if (newNPC > 0) {
- NPCHandler.spawnNpc(c, newNPC, c.getAbsX() + 1, c.getAbsY(), 0, 0, 250, 7, 70, 70, false, false);
- c.sendMessage("You spawn a Npc.");
- c.amountDonated += 28;
- c.sendMessage("You have now spawned: " + newNPC);
- } else {
- c.sendMessage("No such NPC.");
- }
- } catch (Exception ignored) {
- ignored.printStackTrace();
- }
- }
- }
- private static void sendMessage(String string) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement