Search in sources :

Example 31 with ItemMap

use of me.RockinChaos.itemjoin.item.ItemMap 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 32 with ItemMap

use of me.RockinChaos.itemjoin.item.ItemMap 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 33 with ItemMap

use of me.RockinChaos.itemjoin.item.ItemMap 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 34 with ItemMap

use of me.RockinChaos.itemjoin.item.ItemMap 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)

Example 35 with ItemMap

use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.

the class Menu method modifyProperty.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying NBT Propterties.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void modifyProperty(final Player player, final ItemMap itemMap, final String key) {
    Interface modifyProperty = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        Map<String, String> properties = itemMap.getNBTValues();
        modifyProperty.addButton(new Button(fillerPaneGItem), 3);
        modifyProperty.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&c&l&nModify", "&7", "&7*Modify this NBT Property.", "&7", "&9&lProperty: &a" + "&f" + key + ":" + properties.get(key)), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "NBT PROPERTY";
            placeHolders[15] = "TranslatableDisplayName:&aUltra &cItem";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
        }, event -> {
            if (ChatColor.stripColor(event.getMessage()).contains(":")) {
                properties.remove(key);
                String[] propertyParts = ChatColor.stripColor(event.getMessage()).split(":");
                properties.put(propertyParts[0], propertyParts[1]);
            }
            itemMap.setNBTValues(properties);
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "NBT PROPERTY";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            nbtPane(event.getPlayer(), itemMap);
        }));
        modifyProperty.addButton(new Button(fillerPaneGItem));
        modifyProperty.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this custom NBT Property.", "&7", "&9&lProperty: &a" + "&f" + key + ":" + properties.get(key)), event -> {
            properties.remove(key);
            itemMap.setNBTValues(properties);
            nbtPane(player, itemMap);
        }));
        modifyProperty.addButton(new Button(fillerPaneGItem), 3);
        modifyProperty.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the NBT Properties menu."), event -> nbtPane(player, itemMap)));
        modifyProperty.addButton(new Button(fillerPaneBItem), 7);
        modifyProperty.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the NBT Properties menu."), event -> nbtPane(player, itemMap)));
    });
    modifyProperty.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

ItemMap (me.RockinChaos.itemjoin.item.ItemMap)140 Player (org.bukkit.entity.Player)124 ItemStack (org.bukkit.inventory.ItemStack)116 ArrayList (java.util.ArrayList)102 World (org.bukkit.World)96 PotionEffect (org.bukkit.potion.PotionEffect)95 HashMap (java.util.HashMap)94 List (java.util.List)94 ItemCommand (me.RockinChaos.itemjoin.item.ItemCommand)92 ChatColor (org.bukkit.ChatColor)92 Color (org.bukkit.Color)92 DyeColor (org.bukkit.DyeColor)92 Material (org.bukkit.Material)92 GameProfile (com.mojang.authlib.GameProfile)91 Property (com.mojang.authlib.properties.Property)91 File (java.io.File)91 Field (java.lang.reflect.Field)91 DecimalFormat (java.text.DecimalFormat)91 Map (java.util.Map)91 UUID (java.util.UUID)91