Example #1
0
  /**
   * Called when the icon representing a member in the middle of the gui is clicked, this opens up a
   * detailed view where you can select what to do (promoting/removing)
   *
   * @param uuid
   */
  public void showDetail(final UUID uuid) {
    if (!validGroup()) {
      showScreen();
      return;
    }
    ClickableInventory ci = new ClickableInventory(27, g.getName());
    String playerName = NameAPI.getCurrentName(uuid);

    ItemStack info = new ItemStack(Material.PAPER);
    ISUtils.setName(info, ChatColor.GOLD + playerName);
    String rankName = getRankName(uuid);
    ISUtils.addLore(info, ChatColor.GOLD + "Current rank: " + rankName);
    ci.setSlot(new DecorationStack(info), 4);

    Clickable memberClick = setupDetailSlot(Material.LEATHER_CHESTPLATE, uuid, PlayerType.MEMBERS);
    ci.setSlot(memberClick, 10);
    Clickable modClick = setupDetailSlot(Material.GOLD_CHESTPLATE, uuid, PlayerType.MODS);
    ci.setSlot(modClick, 12);
    Clickable adminClick = setupDetailSlot(Material.IRON_CHESTPLATE, uuid, PlayerType.ADMINS);
    ci.setSlot(adminClick, 14);
    Clickable ownerClick = setupDetailSlot(Material.DIAMOND_CHESTPLATE, uuid, PlayerType.OWNER);
    ci.setSlot(ownerClick, 16);

    ItemStack backToOverview = new ItemStack(Material.WOOD_DOOR);
    ISUtils.setName(backToOverview, ChatColor.GOLD + "Back to overview");
    ci.setSlot(
        new Clickable(backToOverview) {

          @Override
          public void clicked(Player arg0) {
            showScreen();
          }
        },
        22);
    ci.showInventory(p);
  }
Example #2
0
  /** Shows the main gui overview for a specific group based on the properties of this class */
  public void showScreen() {
    if (!validGroup()) {
      return;
    }
    ClickableInventory ci = new ClickableInventory(54, g.getName());
    final List<Clickable> clicks = constructClickables();
    if (clicks.size() < 45 * currentPage) {
      // would show an empty page, so go to previous
      currentPage--;
      showScreen();
    }
    // fill gui
    for (int i = 36 * currentPage; i < 36 * (currentPage + 1) && i < clicks.size(); i++) {
      ci.setSlot(clicks.get(i), 9 + i - (36 * currentPage));
    }
    // back button
    if (currentPage > 0) {
      ItemStack back = new ItemStack(Material.ARROW);
      ISUtils.setName(back, ChatColor.GOLD + "Go to previous page");
      Clickable baCl =
          new Clickable(back) {

            @Override
            public void clicked(Player arg0) {
              if (currentPage > 0) {
                currentPage--;
              }
              showScreen();
            }
          };
      ci.setSlot(baCl, 45);
    }
    // next button
    if ((45 * (currentPage + 1)) <= clicks.size()) {
      ItemStack forward = new ItemStack(Material.ARROW);
      ISUtils.setName(forward, ChatColor.GOLD + "Go to next page");
      Clickable forCl =
          new Clickable(forward) {

            @Override
            public void clicked(Player arg0) {
              if ((45 * (currentPage + 1)) <= clicks.size()) {
                currentPage++;
              }
              showScreen();
            }
          };
      ci.setSlot(forCl, 53);
    }

    // options

    ci.setSlot(createInheritedMemberToggle(), 46);
    ci.setSlot(createInviteToggle(), 47);
    ci.setSlot(setupMemberTypeToggle(PlayerType.MEMBERS, showMembers), 48);

    ci.setSlot(setupMemberTypeToggle(PlayerType.MODS, showMods), 50);

    ci.setSlot(setupMemberTypeToggle(PlayerType.ADMINS, showAdmins), 51);

    ci.setSlot(setupMemberTypeToggle(PlayerType.OWNER, showOwners), 52);

    // exit button
    ItemStack backToOverview = new ItemStack(Material.WOOD_DOOR);
    ISUtils.setName(backToOverview, ChatColor.GOLD + "Close");
    ci.setSlot(
        new Clickable(backToOverview) {

          @Override
          public void clicked(Player arg0) {
            ClickableInventory.forceCloseInventory(arg0);
          }
        },
        49);

    // options at the top
    ci.setSlot(getInvitePlayerClickable(), 0);
    ci.setSlot(createBlacklistToggle(), 1);
    ci.setSlot(getAddBlackListClickable(), 2);
    ci.setSlot(getLeaveGroupClickable(), 3);
    ci.setSlot(getInfoStack(), 4);
    ci.setSlot(getDefaultGroupStack(), 5);
    ci.setSlot(getPasswordClickable(), 6);
    ci.setSlot(getPermOptionClickable(), 7);
    ci.setSlot(getAdminStuffClickable(), 8);
    ci.showInventory(p);
  }