<commit_before>package xyz.tehneon.plugins.staffdisplay.builder;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import ru.tehkode.permissions.PermissionGroup;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import xyz.tehneon.plugins.staffdisplay.StaffDisplay;

import java.util.ArrayList;
import java.util.List;

/**
 * @author TehNeon
 * @since 1/21/2017
 * <p>
 * Class which handles all the creation and building of the menu
 */
public class MenuBuilder {
    private StaffDisplay plugin;
    private Inventory inventory;
    private List<TargetUser> targetUserList = new ArrayList<>();

    public MenuBuilder(StaffDisplay plugin) {
        this.plugin = plugin;

        updateMenu();
    }

    /**
     * Builds/Creates the menu/inventory.
     */
    private void buildMenu() {
        // Create the inventory menu, and the size based off of how many people are viewed/registered as staff
        inventory = Bukkit.createInventory(null, 9 * roundUp(targetUserList.size() / 9d), ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("menu.title")));

        for (TargetUser targetUser : targetUserList) {
            String configSection = "default";
            if (plugin.getConfig().get("menu.items." + targetUser.getRankName()) != null) {
                configSection = targetUser.getRankName();
            }

            ItemStack itemStack = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
            SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
            skullMeta.setOwner(targetUser.getUsername());
            skullMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("menu.items." + configSection + ".display").replace("{username}", targetUser.getUsername())));


            itemStack.setItemMeta(skullMeta);
            inventory.addItem(itemStack);
        }<commit_msg>Finished the item building component<commit_after>package xyz.tehneon.plugins.staffdisplay.builder;

import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import ru.tehkode.permissions.PermissionGroup;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import xyz.tehneon.plugins.staffdisplay.StaffDisplay;

import java.util.ArrayList;
import java.util.List;

/**
 * @author TehNeon
 * @since 1/21/2017
 * <p>
 * Class which handles all the creation and building of the menu
 */
public class MenuBuilder {
    private StaffDisplay plugin;
    private Inventory inventory;
    private List<TargetUser> targetUserList = new ArrayList<>();

    public MenuBuilder(StaffDisplay plugin) {
        this.plugin = plugin;

        updateMenu();
    }

    /**
     * Builds/Creates the menu/inventory.
     */
    private void buildMenu() {
        // Create the inventory menu, and the size based off of how many people are viewed/registered as staff
        inventory = Bukkit.createInventory(null, 9 * roundUp(targetUserList.size() / 9d), ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("menu.title")));

        for (TargetUser targetUser : targetUserList) {
            String configSection = "default";
            if (plugin.getConfig().get("menu.items." + targetUser.getRankName()) != null) {
                configSection = targetUser.getRankName();
            }

            ItemStack itemStack = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
            SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
            skullMeta.setOwner(targetUser.getUsername());
            skullMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("menu.items." + configSection + ".display").replace("{username}", targetUser.getUsername())));

            List<String> itemLore = new ArrayList<>();

            for (String loreItem : plugin.getConfig().getStringList("menu.items." + configSection + ".lore")) {
                loreItem = loreItem.replace("{username}", targetUser.getUsername());
                loreItem = loreItem.replace("{rank}", targetUser.getRankName());

                itemLore.add(ChatColor.translateAlternateColorCodes('&', loreItem));
            }
            skullMeta.setLore(itemLore);

            itemStack.setItemMeta(skullMeta);
            inventory.addItem(itemStack);
        }
{'fraction_non_alphanumeric': 0.1175365344467641, 'fraction_numerical': 0.004592901878914405, 'mean_word_length': 3.4526022304832713, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2771036', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1357, 'n_words': 275}