Search in sources :

Example 81 with Button

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

the class Menu method designPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for selecting a Firework Type.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void designPane(final Player player, final ItemMap itemMap) {
    Interface designPane = new Interface(true, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        designPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the special settings menu."), event -> otherPane(player, itemMap)));
        for (Type type : Type.values()) {
            designPane.addButton(new Button(ItemHandler.getItem("EGG", 1, false, "&f" + type.name(), "&7", "&7*This will be the type (pattern)", "&7of your firework."), event -> {
                itemMap.setFireworkType(type);
                otherPane(player, itemMap);
            }));
        }
    });
    designPane.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) PatternType(org.bukkit.block.banner.PatternType) EntityType(org.bukkit.entity.EntityType) PotionEffectType(org.bukkit.potion.PotionEffectType) Type(org.bukkit.FireworkEffect.Type) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 82 with Button

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

the class Menu method activeCommands.

/**
 * Opens the Pane for the Player.
 *
 * @param player - The Player to have the Pane opened.
 */
private static void activeCommands(final Player player) {
    Interface activePane = new Interface(false, 3, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        final String triggers = ConfigHandler.getConfig().getFile("config.yml").getString("Active-Commands.triggers");
        final String enabledList = ConfigHandler.getConfig().getFile("config.yml").getString("Active-Commands.enabled-worlds");
        activePane.addButton(new Button(fillerPaneBItem), 4);
        activePane.addButton(new Button(ItemHandler.getItem("BOOK", 1, ConfigHandler.getConfig().getFile("config.yml").getStringList("Active-Commands.commands").size() != 0, "&b&l&nCommands", "&7", "&7*Specify a list of commands to be", "&7executed upon performing a trigger.", "&9&lENABLED: &a" + (ConfigHandler.getConfig().getFile("config.yml").getStringList("Active-Commands.commands").size() != 0 ? "YES" : "NO")), event -> altCommandPane(player, null, 4)));
        activePane.addButton(new Button(fillerPaneBItem), 6);
        activePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "REPEATER" : "356"), 1, false, "&a&lSequence", "&7", "&7*The order that the command lines", "&7will be executed in.", "&9&lCOMMANDS-SEQUENCE: &a" + StringUtils.nullCheck(ConfigHandler.getConfig().getFile("config.yml").getString("Active-Commands.commands-sequence") + "")), event -> sequencePane(player, null, 4)));
        activePane.addButton(new Button(fillerPaneBItem));
        activePane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&bTriggers", "&7", "&7*This will be the triggers", "&7that will cause the command lines", "&7to execute.", "&9&lENABLED: &a" + String.valueOf((triggers != null && !triggers.isEmpty() && !StringUtils.containsIgnoreCase(triggers, "DISABLE")) ? triggers : "FALSE").toUpperCase()), event -> triggerPane(player, 4)));
        activePane.addButton(new Button(fillerPaneBItem));
        activePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GRASS_BLOCK" : "2"), 1, false, "&b&lEnabled Worlds", "&7", "&7*Define the world(s) that the", "&7commands will be executed in.", "&9&lENABLED-WORLDS: &a" + (StringUtils.nullCheck(enabledList) != "NONE" ? "&a" + enabledList : "NONE")), event -> worldPane(player, null, 4)));
        activePane.addButton(new Button(fillerPaneBItem), 2);
        activePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the config settings menu."), event -> configSettings(player)));
        activePane.addButton(new Button(fillerPaneBItem), 7);
        activePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the config settings menu."), event -> configSettings(player)));
    });
    activePane.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 83 with Button

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

the class Menu method durationMaterialPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying animated material duration.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void durationMaterialPane(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 -> animateMaterialPane(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> mats = itemMap.getDynamicMaterials();
                if (isNew) {
                    if (itemMap.getDynamicMaterials().isEmpty()) {
                        mats.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + itemMap.getMaterial());
                    }
                    mats.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + value);
                } else {
                    mats.set(position, "<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + ItemHandler.cutDelay(mats.get(position)));
                }
                itemMap.setDynamicMaterials(mats);
                if (isNew) {
                    animateMaterialPane(player, itemMap);
                } else {
                    modifyMaterialPane(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);
                durationMaterialPane(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> mats = itemMap.getDynamicMaterials();
                if (isNew) {
                    if (itemMap.getDynamicMaterials().isEmpty()) {
                        mats.add("<delay:" + k + ">" + itemMap.getMaterial());
                    }
                    mats.add("<delay:" + k + ">" + value);
                } else {
                    mats.set(position, "<delay:" + k + ">" + ItemHandler.cutDelay(mats.get(position)));
                }
                itemMap.setDynamicMaterials(mats);
                if (isNew) {
                    animateMaterialPane(player, itemMap);
                } else {
                    modifyMaterialPane(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 84 with Button

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

the class Menu method otherPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for modifying special items.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void otherPane(final Player player, final ItemMap itemMap) {
    Interface otherPane = new Interface(false, 3, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        otherPane.addButton(new Button(fillerPaneGItem), 4);
        otherPane.addButton(new Button(headerStack(player, itemMap)));
        otherPane.addButton(new Button(fillerPaneGItem), 4);
        if (itemMap.getMaterial().toString().contains("WRITTEN_BOOK")) {
            otherPane.addButton(new Button(fillerPaneGItem), 3);
            otherPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WRITABLE_BOOK" : "386"), 1, false, "&e&lPages", "&7", "&7*Define custom pages for the book.", "&9&lPages: &a" + (StringUtils.nullCheck(itemMap.getPages() + "") != "NONE" ? "YES" : "NONE")), event -> pagePane(player, itemMap)));
            otherPane.addButton(new Button(fillerPaneGItem));
            otherPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, false, "&a&lAuthor", "&7", "&7*Define the author of the book.", "&9&lAuthor: &a" + StringUtils.nullCheck(itemMap.getAuthor())), event -> {
                if (StringUtils.nullCheck(itemMap.getAuthor()) != "NONE") {
                    itemMap.setAuthor(null);
                    otherPane(player, itemMap);
                } else {
                    player.closeInventory();
                    String[] placeHolders = LanguageAPI.getLang(false).newString();
                    placeHolders[16] = "AUTHOR";
                    placeHolders[15] = "RockinChaos";
                    LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
                    LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
                }
            }, event -> {
                itemMap.setAuthor(ChatColor.stripColor(event.getMessage()));
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "AUTHOR";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                otherPane(event.getPlayer(), itemMap);
            }));
            otherPane.addButton(new Button(fillerPaneGItem), 3);
        } else if (itemMap.getMaterial().toString().contains("PLAYER_HEAD") || itemMap.getMaterial().toString().contains("SKULL_ITEM")) {
            String potionList = "";
            String potionString = "";
            if (StringUtils.nullCheck(itemMap.getPotionEffect().toString()) != "NONE") {
                for (PotionEffect potions : itemMap.getPotionEffect()) {
                    potionString += potions.getType().getName().toUpperCase() + ":" + potions.getAmplifier() + ":" + potions.getDuration() + ", ";
                }
                for (String split : StringUtils.softSplit(StringUtils.nullCheck(potionString.substring(0, potionString.length())))) {
                    potionList += "&a" + split + " /n ";
                }
            }
            otherPane.addButton(new Button(fillerPaneGItem), 2);
            otherPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_HELMET" : "314"), 1, false, "&b&lSkull Owner", "&7", "&7*Define a skull owner for the", "&7head adding that persons skin.", "&7", "&7You can only define skull owner", "&7or skull texture, this will", "&7remove any skull textures.", "&9&lSkull-Owner: &a" + StringUtils.nullCheck(itemMap.getSkull())), event -> {
                if (itemMap.getDynamicOwners() != null && !itemMap.getDynamicOwners().isEmpty()) {
                    animatedSkullPane(player, itemMap, true);
                } else {
                    if (StringUtils.nullCheck(itemMap.getSkull()) != "NONE") {
                        itemMap.setSkull(null);
                        otherPane(player, itemMap);
                    } else {
                        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 -> {
                itemMap.setSkull(ChatColor.stripColor(event.getMessage()));
                itemMap.setSkullTexture(null);
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL OWNER";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                otherPane(event.getPlayer(), itemMap);
            }));
            otherPane.addButton(new Button(fillerPaneGItem));
            otherPane.addButton(new Button(ItemHandler.getItem("STRING", 1, false, "&a&lSkull Texture", "&7", "&7*Add a skull texture for the", "&7head as a custom skin.", "&7", "&7You can only define skull texture", "&7or skull owner, this will", "&7remove any skull owners.", "&7", "&7Skull textures can be found", "&7at websites like &aminecraft-heads.com", "&7and the value is listed under", "&7the OTHER section.", "&9&lSkull-Texture: &a" + (StringUtils.nullCheck(itemMap.getSkullTexture()) != "NONE" ? (itemMap.getSkullTexture().length() > 40 ? itemMap.getSkullTexture().substring(0, 40) : itemMap.getSkullTexture()) : "")), event -> {
                if (itemMap.getDynamicTextures() != null && !itemMap.getDynamicTextures().isEmpty()) {
                    animatedSkullPane(player, itemMap, false);
                } else {
                    if (StringUtils.nullCheck(itemMap.getSkullTexture()) != "NONE") {
                        itemMap.setSkullTexture(null);
                        otherPane(player, itemMap);
                    } else {
                        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 -> {
                itemMap.setSkullTexture(ChatColor.stripColor(event.getMessage()));
                itemMap.setSkull(null);
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "SKULL TEXTURE";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                otherPane(event.getPlayer(), itemMap);
            }));
            otherPane.addButton(new Button(fillerPaneGItem));
            otherPane.addButton(new Button(ItemHandler.getItem("POTION", 1, false, "&e&lEffects", "&7", "&7*Add custom effects after", "&7consuming the item.", "&9&lPotion-Effects: &a" + StringUtils.nullCheck(potionList)), event -> potionPane(player, itemMap, 1)));
            otherPane.addButton(new Button(fillerPaneGItem), 2);
        } else if (itemMap.getMaterial().toString().contains("TIPPED_ARROW")) {
            String potionList = "";
            String potionString = "";
            if (StringUtils.nullCheck(itemMap.getPotionEffect().toString()) != "NONE") {
                for (PotionEffect potions : itemMap.getPotionEffect()) {
                    potionString += potions.getType().getName().toUpperCase() + ":" + potions.getAmplifier() + ":" + potions.getDuration() + ", ";
                }
                for (String split : StringUtils.softSplit(StringUtils.nullCheck(potionString.substring(0, potionString.length())))) {
                    potionList += "&a" + split + " /n ";
                }
            }
            otherPane.addButton(new Button(fillerPaneGItem), 3);
            otherPane.addButton(new Button(ItemHandler.getItem("BLAZE_POWDER", 1, false, "&e&lEffects", "&7", "&7*Add custom effects", "&7to the arrow tip.", "&9&lTipped-Effect: &a" + StringUtils.nullCheck(potionList)), event -> potionPane(player, itemMap, 1)));
            otherPane.addButton(new Button(fillerPaneGItem));
            otherPane.addButton(new Button(ItemHandler.getItem("ENDER_PEARL", 1, false, "&e&lTeleport", "&7", "&7*Set the arrow to teleport", "&7the player upon landing.", "&9&lEnabled: &a" + String.valueOf(itemMap.isTeleport()).toUpperCase()), event -> teleportPane(player, itemMap, 1)));
            otherPane.addButton(new Button(fillerPaneGItem), 3);
        } else if (itemMap.getMaterial().toString().equalsIgnoreCase("FIREWORK") || itemMap.getMaterial().toString().equalsIgnoreCase("FIREWORK_ROCKET")) {
            String colorList = "";
            if (StringUtils.nullCheck(itemMap.getFireworkColor().toString()) != "NONE") {
                for (String split : StringUtils.softSplit(StringUtils.nullCheck(itemMap.getFireworkColor().toString()))) {
                    colorList += "&a" + split + " /n ";
                }
            }
            otherPane.addButton(new Button(fillerPaneGItem), 2);
            otherPane.addButton(new Button(ItemHandler.getItem("EGG", 1, false, "&a&lType", "&7", "&7*Set the style of the explosion.", "&9&lType: &a" + StringUtils.nullCheck(itemMap.getFireworkType() + "")), event -> {
                if (StringUtils.nullCheck(itemMap.getFireworkType() + "") != "NONE") {
                    itemMap.setFireworkType(null);
                    otherPane(player, itemMap);
                } else {
                    designPane(player, itemMap);
                }
            }));
            otherPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, itemMap.getFireworkFlicker(), "&a&lFlicker", "&7", "&7*Show the flicker effect as", "&7the firework particles dissipate", "&7after the explosion.", "&9&lENABLED: &a" + itemMap.getFireworkFlicker()), event -> {
                if (itemMap.getFireworkFlicker()) {
                    itemMap.setFireworkFlicker(false);
                } else {
                    itemMap.setFireworkFlicker(true);
                }
                otherPane(player, itemMap);
            }));
            otherPane.addButton(new Button(ItemHandler.getItem("EMERALD", 1, itemMap.getFireworkTrail(), "&a&lTrail", "&7", "&7*Show the trail (smoke) of", "&7the firework when launched.", "&9&lENABLED: &a" + itemMap.getFireworkTrail()), event -> {
                if (itemMap.getFireworkTrail()) {
                    itemMap.setFireworkTrail(false);
                } else {
                    itemMap.setFireworkTrail(true);
                }
                otherPane(player, itemMap);
            }));
            otherPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&a&lPower", "&7", "&7*Set the power (distance)", "&7that the firework travels.", "&9&lPower: &a" + StringUtils.nullCheck(itemMap.getFireworkPower() + "&7")), event -> {
                if (StringUtils.nullCheck(itemMap.getFireworkPower() + "&7") != "NONE") {
                    itemMap.setFireworkPower(0);
                    otherPane(player, itemMap);
                } else {
                    powerPane(player, itemMap);
                }
            }));
            otherPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LIME_DYE" : "351:10"), 1, false, "&a&lColor(s)", "&7", "&7*Define the individual colors of the", "&7firework effect type.", "&9&lColor(s): &a" + (StringUtils.nullCheck(colorList) != "NONE" ? colorList : "NONE")), event -> colorPane(player, itemMap)));
            otherPane.addButton(new Button(fillerPaneGItem), 2);
        } else if (itemMap.getMaterial().toString().contains("LEATHER_")) {
            Interface colorPane = new Interface(true, 6, GUIName, player);
            colorPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the special settings menu."), event -> otherPane(player, itemMap)));
            for (DyeColor color : DyeColor.values()) {
                colorPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GRAY_DYE" : "351:8"), 1, false, "&f" + color.name(), "&7", "&7*This will be the color", "&7of your leather armor."), event -> {
                    itemMap.setLeatherColor(color.name());
                    itemMap.setLeatherHex(null);
                    otherPane(player, itemMap);
                }));
            }
            otherPane.addButton(new Button(fillerPaneGItem), 3);
            otherPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_DYE" : "351:11"), 1, false, "&a&lDye", "&7", "&7*Add a custom color to", "&7your leather armor.", "&9&lLeather-Color: &a" + (StringUtils.nullCheck(itemMap.getLeatherColor()) != "NONE" ? StringUtils.nullCheck(itemMap.getLeatherColor()) : StringUtils.nullCheck(itemMap.getLeatherHex()))), event -> {
                if (itemMap.getLeatherColor() != null) {
                    itemMap.setLeatherColor(null);
                    otherPane(player, itemMap);
                } else {
                    colorPane.open(player);
                }
            }));
            if (!ItemHandler.getDesignatedSlot(itemMap.getMaterial()).equalsIgnoreCase("noslot")) {
                String attributeList = "";
                String attributeString = "";
                if (StringUtils.nullCheck(itemMap.getAttributes().toString()) != "NONE") {
                    for (String attribute : itemMap.getAttributes().keySet()) {
                        attributeString += attribute + ":" + itemMap.getAttributes().get(attribute) + ", ";
                    }
                    for (String split : StringUtils.softSplit(StringUtils.nullCheck(attributeString.substring(0, attributeString.length())))) {
                        attributeList += "&a" + split + " /n ";
                    }
                }
                otherPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTED_GOLDEN_APPLE" : "322:1"), 1, false, "&a&lAttributes", "&7", "&7*Add a custom attribute to", "&7your armor or weapon.", (StringUtils.nullCheck(attributeList) != "NONE" ? "&9&lAttributes: &a" + attributeList : "")), event -> {
                    attributePane(player, itemMap, true);
                }));
            } else {
                otherPane.addButton(new Button(fillerPaneGItem));
            }
            otherPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WRITABLE_BOOK" : "386"), 1, false, "&a&lHex Color", "&7", "&7*Add a custom hex color", "&7to your leather armor.", "&9&lLeather-Color: &a" + (StringUtils.nullCheck(itemMap.getLeatherHex()) != "NONE" ? StringUtils.nullCheck(itemMap.getLeatherHex()) : StringUtils.nullCheck(itemMap.getLeatherColor()))), event -> {
                if (itemMap.getLeatherHex() != null) {
                    itemMap.setLeatherHex(null);
                    otherPane(player, itemMap);
                } else {
                    player.closeInventory();
                    String[] placeHolders = LanguageAPI.getLang(false).newString();
                    placeHolders[16] = "HEX COLOR";
                    placeHolders[15] = "#033dfc";
                    LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
                    LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
                }
            }, event -> {
                if (itemMap.getLeatherHex() == null) {
                    itemMap.setLeatherHex(ChatColor.stripColor(event.getMessage()));
                    itemMap.setLeatherColor(null);
                    String[] placeHolders = LanguageAPI.getLang(false).newString();
                    placeHolders[16] = "HEX COLOR";
                    LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
                    otherPane(event.getPlayer(), itemMap);
                }
            }));
            otherPane.addButton(new Button(fillerPaneGItem), 3);
        }
        otherPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
        otherPane.addButton(new Button(fillerPaneBItem), 7);
        otherPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
    });
    otherPane.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) PotionEffect(org.bukkit.potion.PotionEffect) DyeColor(org.bukkit.DyeColor) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 85 with Button

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

the class Menu method itemSettings.

/**
 * Opens the ITEM SETTINGS PANE for the Player.
 *
 * @param player - The Player to have the Pane opened.
 */
private static void itemSettings(final Player player) {
    Interface itemPane = new Interface(false, 3, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CLOCK" : "347"), 1, false, "&bTrigger Delay", "&7", "&7*This is the delay in half-seconds", "&7that ItemJoin will wait", "&7to give you the items.", "&7", "&cNOTE: &7It is recommended to", "&7set this to 2 or 3 half-seconds.", "&9&lDELAY: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getString("items-Delay")).toUpperCase() + " half-second(s)"), event -> numberPane(player, 1)));
        itemPane.addButton(new Button(fillerPaneBItem));
        final String defaultTriggers = ConfigHandler.getConfig().getFile("config.yml").getString("Settings.Default-Triggers");
        itemPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&bDefault Triggers", "&7", "&7*This will be the default", "&7triggers used if a custom", "&7item is defined without", "&7specifying any triggers.", "&9&lENABLED: &a" + String.valueOf((defaultTriggers != null && !defaultTriggers.isEmpty() && !StringUtils.containsIgnoreCase(defaultTriggers, "DISABLE")) ? defaultTriggers : "FALSE").toUpperCase()), event -> triggerPane(player, 0)));
        itemPane.addButton(new Button(fillerPaneBItem));
        itemPane.addButton(new Button(ItemHandler.getItem("COOKIE", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items"), "&bItem Permissions", "&7", "&7*If custom items should require", "&7the player to have specific", "&7permissions to receive the item.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Permissions.Obtain-Items", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        itemPane.addButton(new Button(fillerPaneBItem));
        itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PISTON" : "33"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items-OP"), "&bItem Permissions &c&l[OP PLAYERS]", "&7", "&7*If custom items should require", "&7the &c&lOP player(s)&7 to have specific", "&7permissions to receive the item.", "&c&lNOTE: &7This only applies to &c&lOP player(s)&7.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items-OP")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Permissions.Obtain-Items-OP", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Permissions.Obtain-Items-OP"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        itemPane.addButton(new Button(fillerPaneBItem));
        itemPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Overwrite"), "&bOverwrite", "&7", "&7*Setting this to true will allow", "&7all custom items to overwrite", "&7any custom or vanilla items.", "&7", "&cNOTE: &7If set to false, the", "&7overwrite itemflag will still", "&7function normally.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getString("items-Overwrite")).toUpperCase()), event -> overwritePane(player)));
        itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_FENCE" : "85"), 1, ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Spamming"), "&bSpamming", "&7", "&7*Setting this to false will prevent", "&7players from macro spamming", "&7the use of item commands.", "&7", "&cNOTE: &7It is recommended to", "&7leave this set to false.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Spamming")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "items.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("items-Spamming", !ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-Spamming"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "items.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        itemPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-RestrictCount"), "&bRestrict Count", "&7", "&7*Settings this to true will", "&7allow players to have their items", "&7refreshed (topped up) if they have", "&7used/consumed some of the given", "&7stack of custom items.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-RestrictCount")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "items.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("items-RestrictCount", !ConfigHandler.getConfig().getFile("items.yml").getBoolean("items-RestrictCount"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "items.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_WOOD" : "17"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Log-Commands"), "&bLog Commands", "&7", "&7*If the plugin prevent CONSOLE", "&7from logging any executed", "&7comamnd from the custom items.", "&7This only works for item command(s).", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Log-Commands")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("General.Log-Commands", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("General.Log-Commands"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().softReload();
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        itemPane.addButton(new Button(ItemHandler.getItem("IRON_HELMET", 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.HeldItem-Animations"), "&bHeld Item Animations", "&7", "&7*If the animate or dynamic", "&7itemflags should update the item", "&7while the player is holding the item.", "&7", "&7This essentially prevents the", "&7glitchy held item animation", "&7from the item constantly updating.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.HeldItem-Animations")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Settings.HeldItem-Animations", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.HeldItem-Animations"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().reloadConfigs(true);
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        final int heldSlot = ConfigHandler.getConfig().getFile("config.yml").getInt("Settings.HeldItem-Slot");
        itemPane.addButton(new Button(ItemHandler.getItem("DIAMOND_SWORD", (heldSlot > 0 ? heldSlot : 1), false, "&bHeld Item Slot", "&7", "&7*This is the hotbar slot that", "&7the player will automatically", "&7have selected upon performing", "&7one of the held item triggers.", "&9&lSLOT: &a" + String.valueOf((heldSlot >= 0 ? heldSlot : "NONE"))), event -> numberPane(player, 2)));
        final String heldTriggers = ConfigHandler.getConfig().getFile("config.yml").getString("Settings.HeldItem-Triggers");
        itemPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&bHeld Item Triggers", "&7", "&7*When these trigger(s)", "&7are performed, the held item", "&7slot will be set.", "&9&lENABLED: &a" + String.valueOf((heldTriggers != null && !heldTriggers.isEmpty() && !StringUtils.containsIgnoreCase(heldTriggers, "DISABLE")) ? heldTriggers : "FALSE").toUpperCase()), event -> triggerPane(player, 1)));
        itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTING_TABLE" : "116"), 1, ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.DataTags"), "&bDataTags", "&7", "&7*If custom items should use", "&7data tags (NBTTags) to distinguish", "&7each custom item, making them unqiue.", "&c&lNOTE: &7This only works on Minecraft 1.8+", "&7It is recommended to keep", "&7this set to TRUE.", "&9&lENABLED: &a" + String.valueOf(ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.DataTags")).toUpperCase()), event -> {
            File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
            FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
            dataFile.set("Settings.DataTags", !ConfigHandler.getConfig().getFile("config.yml").getBoolean("Settings.DataTags"));
            ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
            ConfigHandler.getConfig().reloadConfigs(true);
            SchedulerUtils.runLater(2L, () -> itemSettings(player));
        }));
        itemPane.addButton(new Button(ItemHandler.getItem("LAVA_BUCKET", 1, false, "&bClear Items", "&7", "&7*Modify settings for clearing", "&7specific items when a player", "&7performed a specified action."), event -> clearPane(player)));
        itemPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "COMMAND_BLOCK" : "137"), 1, false, "&bPrevent Actions", "&7", "&7*Disable certain actions", "&7with items for players."), event -> preventPane(player)));
        itemPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the main menu."), event -> startMenu(player)));
        itemPane.addButton(new Button(fillerPaneBItem), 7);
        itemPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the main menu."), event -> startMenu(player)));
    });
    itemPane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) File(java.io.File) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Aggregations

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 SchedulerUtils (me.RockinChaos.itemjoin.utils.SchedulerUtils)108