Package net.citizensnpcs.utils.PageUtils

Examples of net.citizensnpcs.utils.PageUtils.PageInstance


    @CommandPermissions("quester.use.quests.view")
    public static void viewAssignedQuests(CommandContext args, Player player, HumanNPC npc) {
        int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
        if (page < 0)
            page = 1;
        PageInstance instance = PageUtils.newInstance(player);
        Quester quester = npc.getType("quester");
        instance.header(ChatColor.GREEN
                + StringUtils.listify("Completed Quests " + ChatColor.WHITE + "<%x/%y>" + ChatColor.GREEN));
        for (String quest : quester.getQuests()) {
            if (instance.maxPages() > page)
                break;
            instance.push(ChatColor.GREEN + "   - " + StringUtils.wrap(quest));
        }
        if (page > instance.maxPages()) {
            player.sendMessage(ChatColor.GRAY + "Invalid page entered. There are only " + instance.maxPages()
                    + " pages.");
            return;
        }
        instance.process(page);
    }
View Full Code Here


            return;
        }
        int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
        if (page < 0)
            page = 1;
        PageInstance instance = PageUtils.newInstance(player);
        instance.header(ChatColor.GREEN
                + StringUtils.listify("Completed Quests " + ChatColor.WHITE + "<%x/%y>" + ChatColor.GREEN));
        for (CompletedQuest quest : profile.getAllCompleted()) {
            if (instance.maxPages() > page)
                break;
            instance.push(StringUtils.wrap(quest.getName()) + " - taking " + StringUtils.wrap(quest.getMinutes())
                    + " minutes. Completed " + StringUtils.wrap(quest.getTimesCompleted()) + " times.");
        }
        if (page > instance.maxPages()) {
            player.sendMessage(ChatColor.GRAY + "Invalid page entered. There are only " + instance.maxPages()
                    + " pages.");
            return;
        }
        instance.process(page);
    }
View Full Code Here

        } else {
            if (displays.get(player) == null) {
                cycle(player);
                return;
            }
            PageInstance display = displays.get(player);
            if (!pending.contains(player)) {
                display.displayNext();
                if (display.currentPage() == display.maxPages()) {
                    player.sendMessage(ChatColor.GREEN + "Right click again to accept.");
                    pending.add(player);
                }
            } else {
                attemptAssign(player, npc);
View Full Code Here

    private void updateDescription(Player player) {
        Quest quest = getQuest(fetchFromList(player));
        if (quest == null)
            return;
        PageInstance display = PageUtils.newInstance(player);
        display.setSmoothTransition(true);
        display.header(ChatColor.GREEN + StringUtils.listify("Quest %x/%y - " + StringUtils.wrap(quest.getName())));
        for (String push : Splitter.on("<br>").omitEmptyStrings().split(quest.getDescription())) {
            display.push(push);
            if ((display.elements() % 8 == 0 && display.maxPages() == 1) || display.elements() % 9 == 0) {
                display.push(ChatColor.GOLD + "Right click to continue description.");
            }
        }
        display.process(1);
        if (display.maxPages() == 1) {
            player.sendMessage(ChatColor.GOLD + "Right click to accept.");
            pending.add(player);
        }
        displays.put(player, display);
    }
View Full Code Here

            header += "Player Flags";
        } else {
            Messaging.sendError(player, "Specified flag not found.");
            return;
        }
        PageInstance instance = PageUtils.newInstance(player);
        instance.header(ChatColor.GREEN + StringUtils.listify(StringUtils.wrap(header + ChatColor.WHITE + " <%x/%y>")));
        for (String entry : flags.keySet()) {
            instance.push(StringUtils.wrap("  - ") + entry);
        }
        instance.process(page);
    }
View Full Code Here

        if (stock.size() == 0) {
            player.sendMessage(ChatColor.GRAY + "This trader isn't " + (selling ? "selling" : "buying")
                    + " any items.");
            return;
        }
        PageInstance instance = PageUtils.newInstance(player);
        instance.push("");
        for (Stockable stockable : stock) {
            if (stockable == null)
                continue;
            instance.push(ChatColor.GREEN + (selling ? "Selling " : "Buying ")
                    + TraderMessageUtils.getStockableMessage(stockable, ChatColor.GREEN) + ".");
        }
        int page = args.argsLength() == 3 ? args.getInteger(2) : 1;
        if (page <= instance.maxPages()) {
            instance.header(ChatColor.YELLOW
                    + StringUtils.listify(ChatColor.GREEN + "Trader "
                            + StringUtils.wrap(selling ? "Selling" : "Buying") + " List (Page %x/%y)"
                            + ChatColor.YELLOW));
            instance.process(page);
        } else {
            player.sendMessage(MessageUtils.getMaxPagesMessage(page, instance.maxPages()));
        }
    }
View Full Code Here

    public static final String reachedNPCLimitMessage = ChatColor.RED
            + "You have reached the NPC-creation limit.";

    // Display a list of NPCs owned by a player
    public static void displayNPCList(Player sender, Player toDisplay, HumanNPC npc, String passed) {
        PageInstance paginate = PageUtils.newInstance(sender);
        for (HumanNPC hnpc : NPCManager.getList().values()) {
            if (hnpc.getOwner().equals(toDisplay.getName())) {
                paginate.push(ChatColor.GRAY + "" + hnpc.getUID() + ChatColor.YELLOW + " " + hnpc.getName());
            }
        }
        int page = Integer.parseInt(passed);
        if (page == 0) {
            page = 1;
        }
        if (page <= paginate.maxPages()) {
            paginate.header(ChatColor.GREEN
                    + StringUtils.listify("NPC List for " + StringUtils.wrap(toDisplay.getName())
                            + " (%x/%y)"));
            paginate.process(page);
        } else {
            sender.sendMessage(MessageUtils.getMaxPagesMessage(page, paginate.maxPages()));
        }
    }
View Full Code Here

  public static void listModifiers(CommandContext args, Player player,
      HumanNPC npc) {
    int page = args.argsLength() == 2 ? args.getInteger(1) : 1;
    if (page <= 0)
      page = 1;
    PageInstance instance = PageUtils.newInstance(player);
    instance.header(ChatColor.GREEN
        + StringUtils.listify(ChatColor.YELLOW
            + "Waypoint modifiers <%x/%y>" + ChatColor.GREEN));
    for (WaypointModifierType type : WaypointModifierType.values()) {
      instance.push(ChatColor.GREEN + "   - " + ChatColor.YELLOW
          + type.name().toLowerCase());
    }
    if (page > instance.maxPages()) {
      player.sendMessage(ChatColor.GRAY
          + "Invalid page number. There are " + instance.maxPages()
          + " pages.");
      return;
    }
    instance.process(page);
  }
View Full Code Here

  @ServerCommand()
  @CommandPermissions("toggle.help")
  @CommandRequirements()
  public static void toggleHelp(CommandContext args, CommandSender sender,
      HumanNPC npc) {
    PageInstance instance = PageUtils.newInstance(sender);
    int page = 1;
    if (args.argsLength() == 2) {
      page = args.getInteger(1);
    }
    instance.header(ChatColor.YELLOW
        + StringUtils.listify(ChatColor.GREEN
            + "NPC Toggle List <%x/%y>" + ChatColor.YELLOW));
    for (String type : NPCTypeManager.getTypes().keySet()) {
      instance.push(ChatColor.GREEN
          + "    - "
          + StringUtils.wrap(StringUtils.capitalise(type
              .toLowerCase())));
    }
    instance.process(page);
  }
View Full Code Here

TOP

Related Classes of net.citizensnpcs.utils.PageUtils.PageInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.