Search in sources :

Example 86 with Interface

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

the class Menu method modifyLorePane.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying animated lore.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void modifyLorePane(final Player player, final ItemMap itemMap, final int position) {
    Interface modifyLorePane = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        modifyLorePane.addButton(new Button(fillerPaneGItem), 3);
        modifyLorePane.addButton(new Button(ItemHandler.getItem("WRITABLE_BOOK", 1, false, "&a&l&nLore", "&7", "&7*Change the animated lore line.", "&9&lLore: &a" + ItemHandler.cutDelay(itemMap.getDynamicLores().get(position))), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "ANIMATED LORE";
            placeHolders[15] = "&bThis is line 1, &cThis is line 2, &6This is line 3";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
        }, event -> {
            List<List<String>> lores = itemMap.getDynamicLores();
            lores.set(position, StringUtils.split("<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(lores.get(position).get(0))) + ">" + ChatColor.stripColor(event.getMessage())));
            itemMap.setDynamicLores(lores);
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "ANIMATED LORE";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            modifyLorePane(event.getPlayer(), itemMap, position);
        }));
        modifyLorePane.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(itemMap.getDynamicLores().get(position).get(0)))), event -> durationLorePane(player, itemMap, position, false, "")));
        modifyLorePane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this animated lore."), event -> {
            List<List<String>> lores = itemMap.getDynamicLores();
            lores.remove(position);
            itemMap.setDynamicLores(lores);
            animatedLorePane(player, itemMap);
        }));
        modifyLorePane.addButton(new Button(fillerPaneGItem), 3);
        modifyLorePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated lore menu."), event -> animatedLorePane(player, itemMap)));
        modifyLorePane.addButton(new Button(fillerPaneBItem), 7);
        modifyLorePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated lore menu."), event -> animatedLorePane(player, itemMap)));
    });
    modifyLorePane.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 87 with Interface

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

the class Menu method startModify.

/**
 * Opens the MODIFY PANE for the Player.
 *
 * @param player - The Player to have the Pane opened.
 */
private static void startModify(final Player player, final ItemMap itemMap, final int k) {
    Interface modifyPane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        setPage(player, modifyPane, ItemUtilities.getUtilities().copyItems(), null, itemMap, k);
    });
    modifyPane.open(player);
}
Also used : Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 88 with Interface

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

the class Menu method slotPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting the an items slot.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 * @param stage - The stage in the modification.
 * @param type - The type of slot being defined, single or multiple.
 */
private static void slotPane(final Player player, final ItemMap itemMap, final int stage, final int type) {
    Interface slotPane = new Interface(false, 6, GUIName, player);
    Interface craftingPane = new Interface(false, 4, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        craftingPane.addButton(new Button(fillerPaneGItem), 3);
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[1]") : false), "&9&lSlot: &7&lCRAFTING&a&l[1]", "&7", "&7*Click to set the custom item", "&7to appear in the &lCRAFTING &7slot &a&l[1]&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[1]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("CRAFTING[1]");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[1]")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("CRAFTING[1]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("CRAFTING[1]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                }
            }
        }));
        craftingPane.addButton(new Button(fillerPaneGItem));
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 2, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[2]") : false), "&9&lSlot: &7&lCRAFTING&a&l[2]", "&7", "&7*Click to set the custom item", "&7to appear in the &lCRAFTING &7slot &a&l[2]&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[2]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("CRAFTING[2]");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[2]")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("CRAFTING[2]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("CRAFTING[2]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                }
            }
        }));
        craftingPane.addButton(new Button(fillerPaneGItem), 10);
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[0]") : false), "&9&lSlot: &7&lCRAFTING&a&l[0]", "&7", "&7*Click to set the custom item", "&7to appear in the &lCRAFTING &7slot &a&l[0]&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[0]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("CRAFTING[0]");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[0]")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("CRAFTING[0]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("CRAFTING[0]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                }
            }
        }));
        craftingPane.addButton(new Button(fillerPaneGItem), 4);
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 3, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[3]") : false), "&9&lSlot: &7&lCRAFTING&a&l[3]", "&7", "&7*Click to set the custom item", "&7to appear in the &lCRAFTING &7slot &a&l[3]&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[3]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("CRAFTING[3]");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[3]")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("CRAFTING[3]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("CRAFTING[3]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                }
            }
        }));
        craftingPane.addButton(new Button(fillerPaneGItem));
        craftingPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 4, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[4]") : false), "&9&lSlot: &7&lCRAFTING&a&l[4]", "&7", "&7*Click to set the custom item", "&7to appear in the &lCRAFTING &7slot &a&l[4]&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[4]") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("CRAFTING[4]");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "CRAFTING[4]")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("CRAFTING[4]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("CRAFTING[4]");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 2);
                }
            }
        }));
        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 main slot selection menu"), event -> slotPane.open(player)));
        if (type > 0) {
            craftingPane.addButton(new Button(fillerPaneBItem), 3);
            craftingPane.addButton(new Button(ItemHandler.getItem("EMERALD", 1, false, "&a&lFinish Selecting", "&7", "&7*Saves the chosen slots", "&7to the item definition."), event -> creatingPane(player, itemMap)));
            craftingPane.addButton(new Button(fillerPaneBItem), 3);
        } else {
            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 main slot selection menu"), event -> slotPane.open(player)));
        slotPane.addButton(new Button(fillerPaneGItem));
        slotPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "ARBITRARY") : false), "&9&lSlot: &a&lARBITRARY", "&7", "&7*Click to set the custom item", "&7to appear in slot &a&lArbitrary&7", "&7", "&7*Arbitrary is defined as giving the", "&7item in the first available slot.", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "ARBITRARY") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("ARBITRARY");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "ARBITRARY")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("ARBITRARY");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("ARBITRARY");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                }
            }
        }));
        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(ItemHandler.getItem("LEATHER_HELMET", 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "HELMET") : false), "&9&lSlot: &a&lHELMET", "&7", "&7*Click to set the custom item", "&7to appear in slot &a&lHELMET&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "HELMET") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("HELMET");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "HELMET")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("HELMET");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("HELMET");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                }
            }
        }));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_CHESTPLATE", 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "CHESTPLATE") : false), "&9&lSlot: &a&lCHESTPLATE", "&7", "&7*Click to set the custom item", "&7to appear in slot &a&lCHESTPLATE&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "CHESTPLATE") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("CHESTPLATE");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "CHESTPLATE")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("CHESTPLATE");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("CHESTPLATE");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                }
            }
        }));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_LEGGINGS", 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "LEGGINGS") : false), "&9&lSlot: &a&lLEGGINGS", "&7", "&7*Click to set the custom item", "&7to appear in slot &a&lLEGGINGS&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "LEGGINGS") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("LEGGINGS");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "LEGGINGS")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("LEGGINGS");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("LEGGINGS");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                }
            }
        }));
        slotPane.addButton(new Button(ItemHandler.getItem("LEATHER_BOOTS", 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "BOOTS") : false), "&9&lSlot: &a&lBOOTS", "&7", "&7*Click to set the custom item", "&7to appear in slot &a&lBOOTS&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "BOOTS") ? "&9&lENABLED: &aTRUE" : "")), event -> {
            if (type == 0) {
                itemMap.setSlot("BOOTS");
                itemMap.setMultipleSlots(new ArrayList<String>());
                creatingPane(player, itemMap);
            } else {
                if (StringUtils.containsValue(itemMap.getMultipleSlots(), "BOOTS")) {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.remove("BOOTS");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                } else {
                    List<String> slots = itemMap.getMultipleSlots();
                    slots.add("BOOTS");
                    itemMap.setMultipleSlots(slots);
                    slotPane(player, itemMap, stage, 1);
                }
            }
        }));
        if (ServerUtils.hasSpecificUpdate("1_9")) {
            slotPane.addButton(new Button(ItemHandler.getItem("SHIELD", 1, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), "OFFHAND") : false), "&9&lSlot: &a&lOFFHAND", "&7", "&7*Click to set the custom item", "&7to appear in slot &a&lOFFHAND&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), "OFFHAND") ? "&9&lENABLED: &aTRUE" : "")), event -> {
                if (type == 0) {
                    itemMap.setSlot("OFFHAND");
                    itemMap.setMultipleSlots(new ArrayList<String>());
                    creatingPane(player, itemMap);
                } else {
                    if (StringUtils.containsValue(itemMap.getMultipleSlots(), "OFFHAND")) {
                        List<String> slots = itemMap.getMultipleSlots();
                        slots.remove("OFFHAND");
                        itemMap.setMultipleSlots(slots);
                        slotPane(player, itemMap, stage, 1);
                    } else {
                        List<String> slots = itemMap.getMultipleSlots();
                        slots.add("OFFHAND");
                        itemMap.setMultipleSlots(slots);
                        slotPane(player, itemMap, stage, 1);
                    }
                }
            }));
        } 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, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), slot + "") : false), "&9&lSlot: &a&l" + i, "&7", "&7*Click to set the custom item", "&7to appear in slot &a&l" + i + "&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), slot + "") ? "&9&lENABLED: &aTRUE" : "")), event -> {
                if (type == 0) {
                    itemMap.setSlot(slot + "");
                    itemMap.setMultipleSlots(new ArrayList<String>());
                    creatingPane(player, itemMap);
                } else {
                    if (StringUtils.containsValue(itemMap.getMultipleSlots(), slot + "")) {
                        List<String> slots = itemMap.getMultipleSlots();
                        slots.remove(slot + "");
                        itemMap.setMultipleSlots(slots);
                        slotPane(player, itemMap, stage, 1);
                    } else {
                        List<String> slots = itemMap.getMultipleSlots();
                        slots.add(slot + "");
                        itemMap.setMultipleSlots(slots);
                        slotPane(player, itemMap, stage, 1);
                    }
                }
            }));
        }
        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, (type > 0 ? StringUtils.containsValue(itemMap.getMultipleSlots(), slot + "") : false), "&9&lSlot: &a&l" + j, "&7", "&7*Click to set the custom item", "&7to appear in slot &a&l" + j + "&7", (type > 0 && StringUtils.containsValue(itemMap.getMultipleSlots(), slot + "") ? "&9&lENABLED: &aTRUE" : "")), event -> {
                if (type == 0) {
                    itemMap.setSlot(slot + "");
                    itemMap.setMultipleSlots(new ArrayList<String>());
                    creatingPane(player, itemMap);
                } else {
                    if (StringUtils.containsValue(itemMap.getMultipleSlots(), slot + "")) {
                        List<String> slots = itemMap.getMultipleSlots();
                        slots.remove(slot + "");
                        itemMap.setMultipleSlots(slots);
                        slotPane(player, itemMap, stage, 1);
                    } else {
                        List<String> slots = itemMap.getMultipleSlots();
                        slots.add(slot + "");
                        itemMap.setMultipleSlots(slots);
                        slotPane(player, itemMap, stage, 1);
                    }
                }
            }));
        }
        slotPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", "&7the slot(s) selection menu."), event -> switchPane(player, itemMap, stage)));
        if (type > 0) {
            slotPane.addButton(new Button(fillerPaneBItem), 3);
            slotPane.addButton(new Button(ItemHandler.getItem("EMERALD", 1, false, "&a&lFinish Selecting", "&7", "&7*Saves the chosen slots", "&7to the item definition."), event -> creatingPane(player, itemMap)));
            slotPane.addButton(new Button(fillerPaneBItem), 3);
        } else {
            slotPane.addButton(new Button(fillerPaneBItem), 7);
        }
        slotPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", "&7the slot(s) selection menu."), event -> switchPane(player, itemMap, stage)));
    });
    if (type == 2) {
        craftingPane.open(player);
    } else {
        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) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 89 with Interface

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

the class Menu method choicePane.

/**
 * Opens the Pane for the Player.
 * This Pane is for selecting item modification or deletion.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 * @param item - The ItemStack currently being modified.
 */
private static void choicePane(final Player player, final ItemMap itemMap, final ItemStack item) {
    Interface choicePane = new Interface(false, 3, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        choicePane.addButton(new Button(fillerPaneBItem), 4);
        choicePane.addButton(new Button(item));
        choicePane.addButton(new Button(fillerPaneBItem), 4);
        choicePane.addButton(new Button(fillerPaneBItem), 3);
        choicePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, true, "&b&lSettings", "&7", "&7*Change the settings for this item.", "&7Make changes to the item name, lore,", "&7permissions, enabled-worlds, and more."), event -> {
            creatingPane(player, itemMap);
        }));
        choicePane.addButton(new Button(fillerPaneBItem));
        choicePane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, true, "&c&lDelete", "&7", "&7*Delete this item.", "&7This will remove the item from the", "&7items.yml and will no longer be useable.", "&c&lWARNING: &7This &lCANNOT &7be undone!"), event -> {
            itemMap.removeFromConfig();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[3] = itemMap.getConfigName();
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.itemRemoved", player, placeHolders);
            ConfigHandler.getConfig().reloadConfigs(true);
            SchedulerUtils.runLater(6L, () -> {
                startModify(player, null, 0);
            });
        }));
        choicePane.addButton(new Button(fillerPaneBItem), 3);
        choicePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the modify menu"), event -> startModify(player, null, 0)));
        choicePane.addButton(new Button(fillerPaneBItem), 7);
        choicePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the modify menu"), event -> startModify(player, null, 0)));
    });
    choicePane.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 90 with Interface

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

the class Menu method switchPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting single or multiple slots for an item.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 * @param stage - The stage in the modification.
 */
private static void switchPane(final Player player, final ItemMap itemMap, final int stage) {
    Interface switchPane = new Interface(false, 1, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        if (stage == 0) {
            switchPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", "&7the material selection menu."), event -> materialPane(player, itemMap, 0, 0)));
        } else {
            switchPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
        }
        switchPane.addButton(new Button(fillerPaneBItem), 2);
        switchPane.addButton(new Button(ItemHandler.getItem("GLASS", 1, false, "&a&lSingle Slot", "&7", "&7*Define a single dedicated", "&7 slot for the item."), event -> slotPane(player, itemMap, stage, 0)));
        switchPane.addButton(new Button(fillerPaneBItem), 1);
        switchPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "DISPENSER" : "23"), 1, false, "&b&lMultiple Slots", "&7", "&7*Define multiple slots for the item."), event -> slotPane(player, itemMap, stage, 1)));
        switchPane.addButton(new Button(fillerPaneBItem), 2);
        if (stage == 0) {
            switchPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", "&7the material selection menu."), event -> materialPane(player, itemMap, 0, 0)));
        } else {
            switchPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
        }
    });
    switchPane.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