Search in sources :

Example 36 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.

the class Menu method blacklistSlotPane.

/**
 * Opens the Pane for the Player.
 *
 * @param player - The Player to have the Pane opened.
 */
private static void blacklistSlotPane(final Player player) {
    Interface slotPane = new Interface(true, 6, GUIName, player);
    Interface craftingPane = new Interface(false, 4, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        slotPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the blacklist menu."), event -> blacklistPane(player)));
        String[] blacklist = ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Blacklist").split(",");
        List<String> slots = new ArrayList<String>();
        List<String> saveList = new ArrayList<String>();
        try {
            if (blacklist != null) {
                for (String value : blacklist) {
                    String valType = (StringUtils.containsIgnoreCase(value, "{id") ? "id" : (StringUtils.containsIgnoreCase(value, "{slot") ? "slot" : (StringUtils.containsIgnoreCase(value, "{name") ? "name" : "")));
                    String inputResult = org.apache.commons.lang.StringUtils.substringBetween(value, "{" + valType + ":", "}");
                    if (valType.equalsIgnoreCase("slot")) {
                        slots.add(inputResult.trim().toUpperCase());
                    } else if (!value.isEmpty()) {
                        saveList.add(value.trim());
                    }
                }
            }
        } catch (Exception e) {
        }
        craftingPane.addButton(new Button(fillerPaneGItem), 3);
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, StringUtils.containsValue(slots, "CRAFTING[1]"), "&9&lSlot: &7&lCRAFTING&a&l[1]", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "CRAFTING[1]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "CRAFTING[1]")) {
                slots.add("CRAFTING[1]");
            } else {
                slots.remove("CRAFTING[1]");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        craftingPane.addButton(new Button(fillerPaneGItem));
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 2, StringUtils.containsValue(slots, "CRAFTING[2]"), "&9&lSlot: &7&lCRAFTING&a&l[2]", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "CRAFTING[2]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "CRAFTING[2]")) {
                slots.add("CRAFTING[2]");
            } else {
                slots.remove("CRAFTING[2]");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        craftingPane.addButton(new Button(fillerPaneGItem), 10);
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, StringUtils.containsValue(slots, "CRAFTING[0]"), "&9&lSlot: &7&lCRAFTING&a&l[0]", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "CRAFTING[0]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "CRAFTING[0]")) {
                slots.add("CRAFTING[0]");
            } else {
                slots.remove("CRAFTING[0]");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        craftingPane.addButton(new Button(fillerPaneGItem), 4);
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 3, StringUtils.containsValue(slots, "CRAFTING[3]"), "&9&lSlot: &7&lCRAFTING&a&l[3]", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "CRAFTING[3]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "CRAFTING[3]")) {
                slots.add("CRAFTING[3]");
            } else {
                slots.remove("CRAFTING[3]");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        craftingPane.addButton(new Button(fillerPaneGItem));
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 4, StringUtils.containsValue(slots, "CRAFTING[4]"), "&9&lSlot: &7&lCRAFTING&a&l[4]", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "CRAFTING[4]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "CRAFTING[4]")) {
                slots.add("CRAFTING[4]");
            } else {
                slots.remove("CRAFTING[4]");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        craftingPane.addButton(new Button(fillerPaneGItem), 3);
        craftingPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", "&7the slot blacklist menu"), event -> blacklistSlotPane(player)));
        craftingPane.addButton(new Button(fillerPaneBItem), 7);
        craftingPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", "&7the slot blacklist menu"), event -> blacklistSlotPane(player)));
        slotPane.addButton(new Button(fillerPaneGItem));
        slotPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, false, "&9&lSlot: &a&lCRAFTING", "&7", "&7*Click to see a list of crafting slots"), event -> craftingPane.open(player)));
        slotPane.addButton(new Button(fillerPaneGItem));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_HELMET", 1, StringUtils.containsValue(slots, "HELMET"), "&9&lSlot: &a&lHELMET", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "HELMET") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "HELMET")) {
                slots.add("HELMET");
            } else {
                slots.remove("HELMET");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_CHESTPLATE", 1, StringUtils.containsValue(slots, "CHESTPLATE"), "&9&lSlot: &a&lCHESTPLATE", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "CHESTPLATE") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "CHESTPLATE")) {
                slots.add("CHESTPLATE");
            } else {
                slots.remove("CHESTPLATE");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_LEGGINGS", 1, StringUtils.containsValue(slots, "LEGGINGS"), "&9&lSlot: &a&lLEGGINGS", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "LEGGINGS") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "LEGGINGS")) {
                slots.add("LEGGINGS");
            } else {
                slots.remove("LEGGINGS");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_BOOTS", 1, StringUtils.containsValue(slots, "BOOTS"), "&9&lSlot: &a&lBOOTS", "&7", "&7*Click to prevent this slot", "&7from having its items cleared.", (StringUtils.containsValue(slots, "BOOTS") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (!StringUtils.containsValue(slots, "BOOTS")) {
                slots.add("BOOTS");
            } else {
                slots.remove("BOOTS");
            }
            for (String slot : slots) {
                saveList.add("{slot:" + slot + "}");
            }
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
        }));
        if (ServerUtils.hasSpecificUpdate("1_9")) {
            slotPane.addButton(new Button(ItemHandler.getItem("SHIELD", 1, StringUtils.containsValue(slots, "OFFHAND"), "&9&lSlot: &a&lOFFHAND", "&7", "&7*Click to prevent this slot", "&7from having its item cleared.", (StringUtils.containsValue(slots, "OFFHAND") ? "&9&lENABLED: &aTRUE" : "")), event -> {
                if (!StringUtils.containsValue(slots, "OFFHAND")) {
                    slots.add("OFFHAND");
                } else {
                    slots.remove("OFFHAND");
                }
                for (String slot : slots) {
                    saveList.add("{slot:" + slot + "}");
                }
                File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
                FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
                dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
                ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
                ConfigHandler.getConfig().softReload();
                SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
            }));
        } else {
            slotPane.addButton(new Button(fillerPaneGItem));
        }
        slotPane.addButton(new Button(fillerPaneGItem));
        for (int i = 9; i < 36; i++) {
            final int slot = i;
            slotPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LIGHT_BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:3"), i, (StringUtils.containsValue(slots, String.valueOf(slot))), "&9&lSlot: &a&l" + i, "&7", "&7*Click to prevent this slot", "&7from having its item cleared.", (StringUtils.containsValue(slots, String.valueOf(slot)) ? "&9&lENABLED: &aTRUE" : "")), event -> {
                if (!StringUtils.containsValue(slots, String.valueOf(slot))) {
                    slots.add(String.valueOf(slot));
                } else {
                    slots.remove(String.valueOf(slot));
                }
                for (String slotS : slots) {
                    saveList.add("{slot:" + slotS + "}");
                }
                File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
                FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
                dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
                ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
                ConfigHandler.getConfig().softReload();
                SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
            }));
        }
        for (int j = 0; j < 9; j++) {
            final int slot = j;
            int count = j;
            if (slot == 0) {
                count = 1;
            }
            slotPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), count, (StringUtils.containsValue(slots, String.valueOf(slot))), "&9&lSlot: &a&l" + j, "&7", "&7*Click to prevent this slot", "&7from having its item cleared.", (StringUtils.containsValue(slots, String.valueOf(slot)) ? "&9&lENABLED: &aTRUE" : "")), event -> {
                if (!StringUtils.containsValue(slots, String.valueOf(slot))) {
                    slots.add(String.valueOf(slot));
                } else {
                    slots.remove(String.valueOf(slot));
                }
                for (String slotS : slots) {
                    saveList.add("{slot:" + slotS + "}");
                }
                File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
                FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
                dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
                ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
                ConfigHandler.getConfig().softReload();
                SchedulerUtils.runLater(2L, () -> blacklistSlotPane(player));
            }));
        }
        slotPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the blacklist menu."), event -> blacklistPane(player)));
        slotPane.addButton(new Button(fillerPaneBItem), 7);
        slotPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the blacklist menu."), event -> blacklistPane(player)));
    });
    slotPane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ArrayList(java.util.ArrayList) File(java.io.File) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 37 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.

the class Menu method setPage.

/**
 * Adds the ItemMaps to the PagedPane for viewing.
 *
 * @param player - The Player.
 * @param modifyPane - The PagedPane to have buttons added.
 * @param items - The items to be added to the Pane.
 */
private static void setPage(final Player player, final Interface modifyPane, final List<ItemMap> items, final ItemMap contents, final ItemMap itemMap, final int k) {
    ItemMap currentItem = null;
    boolean crafting = false;
    boolean arbitrary = false;
    if (contents != null) {
        modifyPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to the item definition menu."), event -> creatingPane(player, contents)));
    } else if (itemMap != null) {
        modifyPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to the recipe menu."), event -> recipePane(player, itemMap)));
    }
    Interface craftingPane = new Interface(false, 4, GUIName, player);
    craftingPane.addButton(new Button(fillerPaneGItem), 3);
    currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[1]", items);
    if (currentItem != null) {
        crafting = true;
        setButton(player, currentItem, craftingPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        craftingPane.addButton(new Button(fillerPaneGItem));
    }
    craftingPane.addButton(new Button(fillerPaneGItem));
    currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[2]", items);
    if (currentItem != null) {
        crafting = true;
        setButton(player, currentItem, craftingPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        craftingPane.addButton(new Button(fillerPaneGItem));
    }
    craftingPane.addButton(new Button(fillerPaneGItem), 10);
    currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[0]", items);
    if (currentItem != null) {
        crafting = true;
        setButton(player, currentItem, craftingPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        craftingPane.addButton(new Button(fillerPaneGItem));
    }
    craftingPane.addButton(new Button(fillerPaneGItem), 4);
    currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[3]", items);
    if (currentItem != null) {
        crafting = true;
        setButton(player, currentItem, craftingPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        craftingPane.addButton(new Button(fillerPaneGItem));
    }
    craftingPane.addButton(new Button(fillerPaneGItem));
    currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[4]", items);
    if (currentItem != null) {
        crafting = true;
        setButton(player, currentItem, craftingPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        craftingPane.addButton(new Button(fillerPaneGItem));
    }
    craftingPane.addButton(new Button(fillerPaneGItem), 3);
    String lore = (contents == null ? "&7the modifying selection menu" : "&7the contents selection menu.");
    craftingPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", lore), event -> modifyPane.open(player)));
    craftingPane.addButton(new Button(fillerPaneBItem), 7);
    craftingPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", lore), event -> modifyPane.open(player)));
    Interface arbitraryPane = new Interface(true, 6, GUIName, player);
    arbitraryPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", lore), event -> modifyPane.open(player)));
    List<ItemMap> tempList = new ArrayList<ItemMap>();
    tempList.addAll(items);
    for (final ItemMap item : tempList) {
        if (item.getSlot().equalsIgnoreCase("ARBITRARY")) {
            setButton(player, item, arbitraryPane, contents, itemMap, k);
            items.remove(item);
            arbitrary = true;
        }
    }
    modifyPane.addButton(new Button(fillerPaneGItem));
    if (arbitrary == true) {
        modifyPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&fArbitrary", "&7", "&7*Click to view the existing", "&7Arbitrary slot items."), event -> arbitraryPane.open(player)));
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    if (crafting == true) {
        modifyPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, false, "&fCrafting", "&7", "&7*Click to view the existing", "&7crafting slot items."), event -> craftingPane.open(player)));
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    currentItem = ItemUtilities.getUtilities().getItemMap("HELMET", items);
    if (currentItem != null) {
        setButton(player, currentItem, modifyPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    currentItem = ItemUtilities.getUtilities().getItemMap("CHESTPLATE", items);
    if (currentItem != null) {
        setButton(player, currentItem, modifyPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    currentItem = ItemUtilities.getUtilities().getItemMap("LEGGINGS", items);
    if (currentItem != null) {
        setButton(player, currentItem, modifyPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    currentItem = ItemUtilities.getUtilities().getItemMap("BOOTS", items);
    if (currentItem != null) {
        setButton(player, currentItem, modifyPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    currentItem = ItemUtilities.getUtilities().getItemMap("OFFHAND", items);
    if (currentItem != null) {
        setButton(player, currentItem, modifyPane, contents, itemMap, k);
        items.remove(currentItem);
    } else {
        modifyPane.addButton(new Button(fillerPaneGItem));
    }
    modifyPane.addButton(new Button(fillerPaneGItem));
    for (int i = 9; i < 36; i++) {
        currentItem = ItemUtilities.getUtilities().getItemMap(i + "", items);
        if (currentItem != null) {
            setButton(player, currentItem, modifyPane, contents, itemMap, k);
            items.remove(currentItem);
        } else {
            modifyPane.addButton(new Button(fillerPaneGItem));
        }
    }
    for (int j = 0; j < 9; j++) {
        currentItem = ItemUtilities.getUtilities().getItemMap(j + "", items);
        if (currentItem != null) {
            setButton(player, currentItem, modifyPane, contents, itemMap, k);
            items.remove(currentItem);
        } else {
            modifyPane.addButton(new Button(fillerPaneGItem));
        }
    }
    if (!items.isEmpty()) {
        setPage(player, modifyPane, items, contents, itemMap, k);
    }
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ArrayList(java.util.ArrayList) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 38 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.

the class Menu method modifySkullPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting the skull owner or skull texture.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void modifySkullPane(final Player player, final ItemMap itemMap, final int position, boolean owner) {
    Interface modifySkullPane = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        modifySkullPane.addButton(new Button(fillerPaneGItem), 3);
        if (owner) {
            modifySkullPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_HELMET" : "314"), 1, false, "&a&l&nSkull Owner", "&7", "&7*Change the animated skull owner.", "&9&lSkull Owner: &a" + ItemHandler.cutDelay(itemMap.getDynamicOwners().get(position))), event -> {
                player.closeInventory();
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL OWNER";
                placeHolders[15] = "RockinChaos";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
            }, event -> {
                List<String> skulls = itemMap.getDynamicOwners();
                skulls.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(skulls.get(position))) + ">" + ChatColor.stripColor(event.getMessage()));
                itemMap.setDynamicOwners(skulls);
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL OWNER";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                modifySkullPane(event.getPlayer(), itemMap, position, owner);
            }));
        } else {
            modifySkullPane.addButton(new Button(ItemHandler.getItem("STRING", 1, false, "&a&l&nSkull Texture", "&7", "&7*Change the animated skull texture.", "&9&lSkull Texture: &a" + ItemHandler.cutDelay(itemMap.getDynamicTextures().get(position))), event -> {
                player.closeInventory();
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL TEXTURE";
                placeHolders[15] = "eyJ0ZXh0dYMGQVlN2FjZmU3OSJ9fX0=";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
            }, event -> {
                List<String> skulls = itemMap.getDynamicTextures();
                skulls.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(skulls.get(position))) + ">" + ChatColor.stripColor(event.getMessage()));
                itemMap.setDynamicTextures(skulls);
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL TEXTURE";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                modifySkullPane(event.getPlayer(), itemMap, position, owner);
            }));
        }
        modifySkullPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CLOCK" : "347"), 1, false, "&e&l&nDuration", "&7", "&7*Change the duration of the animation.", "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat((owner ? itemMap.getDynamicOwners().get(position) : itemMap.getDynamicTextures().get(position))))), event -> durationSkullPane(player, itemMap, position, false, ItemHandler.cutDelay((owner ? itemMap.getDynamicOwners().get(position) : itemMap.getDynamicTextures().get(position))), owner)));
        modifySkullPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this animated skull " + (owner ? "owner." : "texture.")), event -> {
            List<String> skulls = itemMap.getDynamicOwners();
            if (!owner) {
                skulls = itemMap.getDynamicTextures();
            }
            skulls.remove(position);
            if (owner) {
                itemMap.setDynamicOwners(skulls);
            } else {
                itemMap.setDynamicTextures(skulls);
            }
            animatedSkullPane(player, itemMap, owner);
        }));
        modifySkullPane.addButton(new Button(fillerPaneGItem), 3);
        modifySkullPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated skull menu."), event -> animatedSkullPane(player, itemMap, owner)));
        modifySkullPane.addButton(new Button(fillerPaneBItem), 7);
        modifySkullPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated skull menu."), event -> animatedSkullPane(player, itemMap, owner)));
    });
    modifySkullPane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) List(java.util.List) ArrayList(java.util.ArrayList) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 39 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.

the class Menu method durabilityDataPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting an items durability.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void durabilityDataPane(final Player player, final ItemMap itemMap) {
    Interface texturePane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        texturePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
            dataPane(player, itemMap);
        }));
        texturePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Texture", "&7", "&7*Click to set a custom texture", "&7value for the item."), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "DURABILITY DATA";
            placeHolders[15] = "1193";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
        }, event -> {
            if (StringUtils.isInt(ChatColor.stripColor(event.getMessage()))) {
                itemMap.setData(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "DURABILITY DATA";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            } else {
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = ChatColor.stripColor(event.getMessage());
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
            }
            dataPane(event.getPlayer(), itemMap);
        }));
        for (int i = 1; i <= 2000; i++) {
            final int k = i;
            texturePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PINK_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:6"), 1, false, "&9&lData: &a&l" + k, "&7", "&7*Click to set the", "&7durability data of the item."), event -> {
                itemMap.setData(k);
                dataPane(player, itemMap);
            }));
        }
    });
    texturePane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 40 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.

the class Menu method particlePane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting an items command particle.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void particlePane(final Player player, final ItemMap itemMap, final int stage) {
    Interface particlePane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        if (stage != 3) {
            particlePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the teleport menu."), event -> {
                teleportPane(player, itemMap, stage);
            }));
        } else {
            particlePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
                commandPane(player, itemMap);
            }));
        }
        if (stage != 3) {
        } else {
            particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&fFIREWORK_FAKE", "&7", "&7*Click to set the lifetime", "&7commands-particle of the item."), event -> lifePane(player, itemMap, "FIREWORK", 1)));
        }
        if (ServerUtils.hasSpecificUpdate("1_9")) {
            for (org.bukkit.Particle particle : org.bukkit.Particle.values()) {
                if (stage != 3) {
                    particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + particle.name(), "&7", "&7*Click to set the", "&7teleport-effect of the item."), event -> {
                        itemMap.setTeleportEffect(particle.name());
                        teleportPane(player, itemMap, stage);
                    }));
                } else {
                    particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + particle.name(), "&7", "&7*Click to set the", "&7commands-particle of the item."), event -> lifePane(player, itemMap, particle.name(), 0)));
                }
            }
        } else {
            for (org.bukkit.Effect effect : org.bukkit.Effect.values()) {
                if (stage != 3) {
                    particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + effect.name(), "&7", "&7*Click to set the", "&7teleport-effect of the item."), event -> {
                        itemMap.setTeleportEffect(effect.name());
                        teleportPane(player, itemMap, stage);
                    }));
                } else {
                    particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + effect.name(), "&7", "&7*Click to set the", "&7commands-particle of the item."), event -> lifePane(player, itemMap, effect.name(), 0)));
                }
            }
        }
    });
    particlePane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Aggregations

Interface (me.RockinChaos.itemjoin.utils.interfaces.Interface)110 GameProfile (com.mojang.authlib.GameProfile)108 Property (com.mojang.authlib.properties.Property)108 File (java.io.File)108 Field (java.lang.reflect.Field)108 DecimalFormat (java.text.DecimalFormat)108 ArrayList (java.util.ArrayList)108 HashMap (java.util.HashMap)108 List (java.util.List)108 Map (java.util.Map)108 UUID (java.util.UUID)108 ItemJoin (me.RockinChaos.itemjoin.ItemJoin)108 ConfigHandler (me.RockinChaos.itemjoin.handlers.ConfigHandler)108 ItemHandler (me.RockinChaos.itemjoin.handlers.ItemHandler)108 PlayerHandler (me.RockinChaos.itemjoin.handlers.PlayerHandler)108 ItemCommand (me.RockinChaos.itemjoin.item.ItemCommand)108 Action (me.RockinChaos.itemjoin.item.ItemCommand.Action)108 CommandSequence (me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence)108 ItemMap (me.RockinChaos.itemjoin.item.ItemMap)108 ItemUtilities (me.RockinChaos.itemjoin.item.ItemUtilities)108