Search in sources :

Example 86 with ItemMap

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

the class Menu method enchantPane.

// ============================================================================================================================================================================================================================================================
/**
 * Opens the Pane for the Player.
 * This Pane is for modifying an items enchantment.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void enchantPane(final Player player, final ItemMap itemMap) {
    Interface enchantPane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        enchantPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
            creatingPane(player, itemMap);
        }));
        for (Enchantment enchant : Enchantment.values()) {
            if (ItemHandler.getEnchantName(enchant) != null) {
                boolean containsKey = (itemMap.getEnchantments() != null) ? itemMap.getEnchantments().containsKey(ItemHandler.getEnchantName(enchant).toUpperCase()) : false;
                ItemStack enchantItem = ItemHandler.getItem((containsKey ? "ENCHANTED_BOOK" : "BOOK"), 1, false, "&f" + ItemHandler.getEnchantName(enchant).toUpperCase(), "&7", "&7*Click to add this enchantment", "&7to the custom item.", "&7", "&9&lENABLED: &a" + (containsKey + "").toUpperCase(), (containsKey ? "&7" : ""), (containsKey ? "&9&lLEVEL: &a" + itemMap.getEnchantments().get(ItemHandler.getEnchantName(enchant).toUpperCase()) : ""));
                enchantPane.addButton(new Button(enchantItem, event -> {
                    if (containsKey) {
                        Map<String, Integer> enchantments = itemMap.getEnchantments();
                        enchantments.remove(ItemHandler.getEnchantName(enchant).toUpperCase());
                        itemMap.setEnchantments(enchantments);
                        enchantPane(player, itemMap);
                    } else {
                        enchantLevelPane(player, itemMap, enchant);
                    }
                }));
            }
        }
    });
    enchantPane.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) Enchantment(org.bukkit.enchantments.Enchantment) ItemStack(org.bukkit.inventory.ItemStack) Map(java.util.Map) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) HashMap(java.util.HashMap) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 87 with ItemMap

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

the class Menu method warmPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting an items command warmup duration.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void warmPane(final Player player, final ItemMap itemMap) {
    Interface warmPane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        warmPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
            commandPane(player, itemMap);
        }));
        warmPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Warmup", "&7", "&7*Click to set a custom commands-warmup", "&7value for the item."), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "COMMAND WARMUP";
            placeHolders[15] = "12";
            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.setWarmDelay(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "COMMAND WARMUP";
                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);
            }
            commandPane(event.getPlayer(), itemMap);
        }));
        for (int i = 1; i <= 64; i++) {
            final int k = i;
            warmPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lWarming: &a&l" + k + " Second(s)", "&7", "&7*Click to set the", "&7commands-warmup of the item."), event -> {
                itemMap.setWarmDelay(k);
                commandPane(player, itemMap);
            }));
        }
    });
    warmPane.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 88 with ItemMap

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

the class Menu method animatedSkullPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying animated skull items.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void animatedSkullPane(final Player player, final ItemMap itemMap, boolean owner) {
    Interface animatedSkullPane = new Interface(true, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        if (owner) {
            animatedSkullPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animation menu."), event -> {
                if (!itemMap.getDynamicOwners().isEmpty()) {
                    itemMap.setAnimate(true);
                    itemMap.setSkullTexture("");
                    itemMap.setDynamicTextures(new ArrayList<String>());
                    itemMap.setSkull(ItemHandler.cutDelay(itemMap.getDynamicOwners().get(0)));
                }
                animationPane(player, itemMap);
            }));
            animatedSkullPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&eNew Skull Owner", "&7", "&7*Add a new skull owner", "&7to be animated between."), 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 -> {
                durationSkullPane(player, itemMap, 0, true, ChatColor.stripColor(event.getMessage()), owner);
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL OWNER";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            }));
            for (int i = 1; i <= itemMap.getDynamicOwners().size(); i++) {
                final int k = i;
                animatedSkullPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_HELMET" : "314"), 1, false, "&fSkull Owner " + k, "&7", "&7*Click modify this animated skull owner.", "&9&lSkull Owner: &a" + ItemHandler.cutDelay(itemMap.getDynamicOwners().get(k - 1)), "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat(itemMap.getDynamicOwners().get(k - 1)))), event -> modifySkullPane(player, itemMap, k - 1, owner)));
            }
        } else {
            animatedSkullPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animation menu."), event -> {
                if (!itemMap.getDynamicTextures().isEmpty()) {
                    itemMap.setAnimate(true);
                    itemMap.setSkull("");
                    itemMap.setDynamicOwners(new ArrayList<String>());
                    itemMap.setSkullTexture(ItemHandler.cutDelay(itemMap.getDynamicTextures().get(0)));
                }
                animationPane(player, itemMap);
            }));
            animatedSkullPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&eNew Skull Texture", "&7", "&7*Add a new skull texture", "&7to be animated between."), 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 -> {
                durationSkullPane(player, itemMap, 0, true, ChatColor.stripColor(event.getMessage()), owner);
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL TEXTURE";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            }));
            for (int i = 1; i <= itemMap.getDynamicTextures().size(); i++) {
                final int k = i;
                animatedSkullPane.addButton(new Button(ItemHandler.getItem("STRING", 1, false, "&fSkull Texture " + k, "&7", "&7*Click modify this animated skull texture.", "&9&lSkull Texture: &a" + (ItemHandler.cutDelay(itemMap.getDynamicTextures().get(k - 1)).length() > 40 ? ItemHandler.cutDelay(itemMap.getDynamicTextures().get(k - 1)).substring(0, 40) : ItemHandler.cutDelay(itemMap.getDynamicTextures().get(k - 1))), "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat(itemMap.getDynamicTextures().get(k - 1)))), event -> modifySkullPane(player, itemMap, k - 1, owner)));
            }
        }
    });
    animatedSkullPane.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) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 89 with ItemMap

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

the class Menu method levelPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting the Potion Level.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void levelPane(final Player player, final ItemMap itemMap, final PotionEffectType potion, final int stage) {
    Interface levelPane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        levelPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the potion effect menu."), event -> potionPane(player, itemMap, stage)));
        levelPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Level", "&7", "&7*Click to set a custom level (strength)", "&7value for the potion effect.", "&7", "&c&lNote: &7Any duration LONGER than", "&71800 seconds (30 minutes) will", "&7result in an infinite duration."), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "EFFECT LEVEL";
            placeHolders[15] = "16";
            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()))) {
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "EFFECT LEVEL";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                durationPane(event.getPlayer(), itemMap, potion, Integer.parseInt(ChatColor.stripColor(event.getMessage())), stage);
            } else {
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = ChatColor.stripColor(event.getMessage());
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
                levelPane(event.getPlayer(), itemMap, potion, stage);
            }
        }));
        for (int i = 1; i <= 64; i++) {
            final int k = i;
            levelPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PINK_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:6"), k, false, "&d&lLevel: &a&l" + k + "", "&7", "&7*Click to set the", "&7level (strength) of the potion effect."), event -> {
                itemMap.setInteractCooldown(k);
                durationPane(player, itemMap, potion, k, stage);
            }));
        }
    });
    levelPane.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 ItemMap

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

the class Menu method modifyPagesPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying book pages.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void modifyPagesPane(final Player player, final ItemMap itemMap, final int line, final int page) {
    Interface linePane = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        List<List<String>> pages = itemMap.getListPages();
        List<String> selectPage = pages.get(page);
        linePane.addButton(new Button(fillerPaneGItem), 3);
        linePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&c&l&nModify", "&7", "&7*Modify this line in the page.", "&7", "&9&lLine: &a" + (line + 1) + "    &9&lPage: &a" + (page + 1)), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "PAGE LINE";
            placeHolders[15] = "&eWelcome to the Server!";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
        }, event -> {
            selectPage.set(line, ChatColor.stripColor(event.getMessage()));
            pages.set(page, selectPage);
            itemMap.setListPages(pages);
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "PAGE LINE";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            linePane(event.getPlayer(), itemMap, false, page);
        }));
        linePane.addButton(new Button(fillerPaneGItem));
        linePane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this line in the page.", "&7", "&9&lLine: &a" + (line + 1) + "    &9&lPage: &a" + (page + 1)), event -> {
            selectPage.remove(selectPage.get(line));
            pages.set(page, selectPage);
            itemMap.setListPages(pages);
            linePane(player, itemMap, false, page);
        }));
        linePane.addButton(new Button(fillerPaneGItem), 3);
        linePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the book lines menu."), event -> linePane(player, itemMap, false, page)));
        linePane.addButton(new Button(fillerPaneBItem), 7);
        linePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the book lines menu."), event -> linePane(player, itemMap, false, page)));
    });
    linePane.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)

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