Search in sources :

Example 71 with Interface

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

the class Menu method probabilityPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting the item probability.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void probabilityPane(final Player player, final ItemMap itemMap) {
    Interface probabilityPane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        probabilityPane.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 (int i = 1; i < 100; i++) {
            final int k = i;
            probabilityPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), 1, false, "&9&lChance: &a&l" + k + "%", "&7", "&7*Click to set the", "&7probability of the item."), event -> {
                itemMap.setProbability(k);
                creatingPane(player, itemMap);
            }));
        }
    });
    probabilityPane.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 72 with Interface

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

the class Menu method durationNamePane.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying animated name duration.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void durationNamePane(final Player player, final ItemMap itemMap, final int position, final boolean isNew, final String value) {
    Interface durationPane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        durationPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated menu."), event -> animatedNamePane(player, itemMap)));
        durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Duration", "&7", "&7*Click to set a custom duration", "&7value for the animation."), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "ANIMATION DURATION";
            placeHolders[15] = "110";
            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] = "ANIMATION DURATION";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                List<String> names = itemMap.getDynamicNames();
                if (isNew) {
                    if (itemMap.getDynamicNames().isEmpty() && itemMap.getCustomName() != null && !itemMap.getCustomName().isEmpty()) {
                        names.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + itemMap.getCustomName());
                    }
                    names.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + value);
                } else {
                    names.set(position, "<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + ItemHandler.cutDelay(names.get(position)));
                }
                itemMap.setDynamicNames(names);
                if (isNew) {
                    animatedNamePane(player, itemMap);
                } else {
                    modifyNamePane(player, itemMap, position);
                }
            } else {
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = ChatColor.stripColor(event.getMessage());
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
                durationNamePane(player, itemMap, position, isNew, value);
            }
        }));
        for (int i = 1; i <= 64; i++) {
            final int k = i;
            durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lDuration: &a&l" + k + " Ticks(s)", "&7", "&7*Click to set the", "&7duration of the animation."), event -> {
                List<String> names = itemMap.getDynamicNames();
                if (isNew) {
                    if (itemMap.getDynamicNames().isEmpty() && itemMap.getCustomName() != null && !itemMap.getCustomName().isEmpty()) {
                        names.add("<delay:" + k + ">" + itemMap.getCustomName());
                    }
                    names.add("<delay:" + k + ">" + value);
                } else {
                    names.set(position, "<delay:" + k + ">" + ItemHandler.cutDelay(names.get(position)));
                }
                itemMap.setDynamicNames(names);
                if (isNew) {
                    animatedNamePane(player, itemMap);
                } else {
                    modifyNamePane(player, itemMap, position);
                }
            }));
        }
    });
    durationPane.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 73 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface 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 74 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface 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 75 with Interface

use of me.RockinChaos.itemjoin.utils.interfaces.Interface 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)

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