Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OwnerCommands {
- public static void execute(Client c, String playerCommand, Player p) {
- if (playerCommand.startsWith("object")) {
- String[] args = playerCommand.split(" ");
- c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
- }
- if (playerCommand.startsWith("npc")) {
- try {
- int newNPC = Integer.parseInt(playerCommand.substring(4));
- if (newNPC > 0) {
- Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
- c.heightLevel, 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("scare")) {
- String[] args = playerCommand.split("-");
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- Client c2 = (Client) Server.playerHandler.players[i];
- if (Server.playerHandler.players[i] != null) {
- if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
- c2.getPA().showInterface(18681);
- break;
- }
- }
- }
- }
- if(playerCommand.startsWith("searchi")) {
- 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++;
- System.out.println(Server.itemHandler.ItemList[j].itemName.replace("_", " "));
- System.out.println(Server.itemHandler.ItemList[j].itemId);
- }
- }
- c.sendMessage(results + " results found...");
- }
- if(playerCommand.startsWith("searchn")) {
- 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.npcHandler.NpcList.length; j++) {
- if (Server.npcHandler.NpcList[j] != null)
- if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
- c.sendMessage("<col=255>"
- + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
- + " - "
- + Server.npcHandler.NpcList[j].npcId);
- results++;
- System.out.println(Server.npcHandler.NpcList[j].npcName.replace("_", " "));
- System.out.println(Server.npcHandler.NpcList[j].npcId);
- }
- }
- c.sendMessage(results + " results found...");
- }
- if (playerCommand.startsWith("bank")) {
- c.getPA().openUpBank();
- }
- if (playerCommand.startsWith("setitems")) {
- try {
- String[] args = playerCommand.split("-");
- String playerToGive = args[1];
- String action = args[2];
- int ID = Integer.parseInt(args[3]);
- int amount = Integer.parseInt(args[4]);
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToGive)) {
- Client c2 = (Client)PlayerHandler.players[i];
- if (c2.getStaffPermission().getId() > c.getStaffPermission().getId()) {
- c.sendMessage("You cannot run this command on a higher-up");
- c2.sendMessage(c.playerName + " has attempted to altar player");
- return;
- }
- if (action.equals("addinv")) {
- c2.getItems().addItem(ID, amount);
- c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been added to your inventory.");
- if (c.playerName != c2.playerName) {
- c.sendMessage("You have given " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
- }
- }
- if (action.equals("addbank")) {
- c2.getItems().addItemToBank(ID, amount);
- c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been added to your bank.");
- if (c.playerName != c2.playerName) {
- c.sendMessage("You have given " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
- }
- }
- if (action.equals("removeinv")) {
- c2.getItems().deleteItem(ID, amount);
- c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been removed from your inventory.");
- if (c.playerName != c2.playerName) {
- c.sendMessage("You have removed from " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
- }
- }
- if (action.equals("removebank")) {
- c2.getItems().removeItemFromBank(ID, amount);
- c2.sendMessage("x"+ amount + " "+ c.getItems().getItemName(ID) + " has been removed from your bank.");
- if (c.playerName != c2.playerName) {
- c.sendMessage("You have removed from " + c2.playerName + " x" + amount + " " + c.getItems().getItemName(ID));
- }
- }
- if (action.equals("addground")) {
- Server.itemHandler.createGroundItem(c, ID, c.getX(), c.getY(), amount, c.playerId);
- if (c.playerName != c2.playerName) {
- }
- }
- }
- }
- }
- } catch (Exception e) {
- c.sendMessage("::setitems-player-action id amount");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement