Search in sources :

Example 11 with Interface

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

the class Menu method modelDataPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for an items model data.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void modelDataPane(final Player player, final ItemMap itemMap) {
    Interface texturePane = new Interface(true, 6, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        texturePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
            dataPane(player, itemMap);
        }));
        texturePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Model Data", "&7", "&7*Click to set the custom mode data", "&7value for the item."), event -> {
            player.closeInventory();
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "MODEL DATA";
            placeHolders[15] = "1193";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
        }, event -> {
            if (StringUtils.isInt(ChatColor.stripColor(event.getMessage()))) {
                itemMap.setModelData(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "MODEL DATA";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            } else {
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = ChatColor.stripColor(event.getMessage());
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
            }
            dataPane(event.getPlayer(), itemMap);
        }));
        for (int i = 1; i <= 2000; i++) {
            final int k = i;
            texturePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PINK_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:6"), 1, false, "&9&lModel Data: &a&l" + k, "&7", "&7*Click to set the", "&7custom model data for the item."), event -> {
                itemMap.setModelData(k);
                dataPane(player, itemMap);
            }));
        }
    });
    texturePane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Example 12 with Interface

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

the class Menu method animateMaterialPane.

// ============================================== //
// Animation Definition Menus            //
// ============================================== //
/**
 * Opens the Pane for the Player.
 * This Pane is for modifying animated material.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void animateMaterialPane(final Player player, final ItemMap itemMap) {
    Interface animateMaterialPane = new Interface(true, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        animateMaterialPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animation menu."), event -> {
            if (!itemMap.getDynamicMaterials().isEmpty()) {
                itemMap.setAnimate(true);
                if (ItemHandler.cutDelay(itemMap.getDynamicMaterials().get(0)).contains(":")) {
                    String[] material = ItemHandler.cutDelay(itemMap.getDynamicMaterials().get(0)).split(":");
                    itemMap.setMaterial(ItemHandler.getMaterial(material[0], null));
                    itemMap.setDataValue((short) Integer.parseInt(material[1]));
                } else {
                    itemMap.setMaterial(ItemHandler.getMaterial(ItemHandler.cutDelay(itemMap.getDynamicMaterials().get(0)), null));
                }
            }
            animationPane(player, itemMap);
        }));
        animateMaterialPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&eNew Material", "&7", "&7*Add a new material", "&7to be animated between."), event -> selectMaterialPane(player, itemMap, 0, true)));
        for (int i = 1; i <= itemMap.getDynamicMaterials().size(); i++) {
            final int k = i;
            animateMaterialPane.addButton(new Button(ItemHandler.getItem(ItemHandler.cutDelay(itemMap.getDynamicMaterials().get(k - 1)), 1, false, "&fMaterial " + k, "&7", "&7*Click modify this animated material.", "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat(itemMap.getDynamicMaterials().get(k - 1)))), event -> modifyMaterialPane(player, itemMap, k - 1)));
        }
    });
    animateMaterialPane.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 13 with Interface

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

the class Menu method limitPane.

// ===========================================================================================================================================================================================================================================================
/**
 * Opens the Pane for the Player.
 * This Pane is for setting the Limit Gamemodes.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void limitPane(final Player player, final ItemMap itemMap) {
    Interface limitPane = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        List<String> limitModes = new ArrayList<String>();
        if (StringUtils.containsIgnoreCase(itemMap.getLimitModes(), "ADVENTURE")) {
            limitModes.add("ADVENTURE");
        }
        if (StringUtils.containsIgnoreCase(itemMap.getLimitModes(), "SURVIVAL")) {
            limitModes.add("SURVIVAL");
        }
        if (StringUtils.containsIgnoreCase(itemMap.getLimitModes(), "CREATIVE")) {
            limitModes.add("CREATIVE");
        }
        limitPane.addButton(new Button(fillerPaneGItem), 3);
        limitPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "FILLED_MAP" : "MAP"), 1, limitModes.contains("ADVENTURE"), "&a&l&nADVENTURE", "&7", "&7*Limits the item to ADVENTURE mode.", "&9&lENABLED: &a" + (limitModes.contains("ADVENTURE") + "").toUpperCase()), event -> {
            if (limitModes.contains("ADVENTURE")) {
                limitModes.remove("ADVENTURE");
            } else {
                limitModes.add("ADVENTURE");
            }
            itemMap.setLimitModes(limitModes.toString().substring(0, limitModes.toString().length() - 1).substring(1));
            limitPane(player, itemMap);
        }));
        limitPane.addButton(new Button(ItemHandler.getItem("STONE_SWORD", 1, limitModes.contains("SURVIVAL"), "&b&l&nSURVIVAL", "&7", "&7*Limits the item to SURVIVAL mode.", "&9&lENABLED: &a" + (limitModes.contains("SURVIVAL") + "").toUpperCase()), event -> {
            if (limitModes.contains("SURVIVAL")) {
                limitModes.remove("SURVIVAL");
            } else {
                limitModes.add("SURVIVAL");
            }
            itemMap.setLimitModes(limitModes.toString().substring(0, limitModes.toString().length() - 1).substring(1));
            limitPane(player, itemMap);
        }));
        limitPane.addButton(new Button(ItemHandler.getItem(limitModes.contains("CREATIVE") ? (ServerUtils.hasSpecificUpdate("1_13") ? "ENCHANTED_GOLDEN_APPLE" : "322:1") : "GOLDEN_APPLE", 1, false, "&6&l&nCREATIVE", "&7", "&7*Limits the item to CREATIVE mode.", "&9&lENABLED: &a" + (limitModes.contains("CREATIVE") + "").toUpperCase()), event -> {
            if (limitModes.contains("CREATIVE")) {
                limitModes.remove("CREATIVE");
            } else {
                limitModes.add("CREATIVE");
            }
            itemMap.setLimitModes(limitModes.toString().substring(0, limitModes.toString().length() - 1).substring(1));
            limitPane(player, itemMap);
        }));
        limitPane.addButton(new Button(fillerPaneGItem), 3);
        limitPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
        limitPane.addButton(new Button(fillerPaneBItem), 7);
        limitPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
    });
    limitPane.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 14 with Interface

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

the class Menu method conditionsPane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting the item conditions.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void conditionsPane(final Player player, final ItemMap itemMap) {
    Interface conditionsPane = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        conditionsPane.addButton(new Button(fillerPaneBItem), 3);
        conditionsPane.addButton(new Button(ItemHandler.getItem("BOOK", 1, false, "&b&l&nCommand&b&l Conditions", "&7", "&7*Condition(s) that must be met", "&7in order to execute item commands.", "&7", "&9&lENABLED: " + String.valueOf((StringUtils.nullCheck(itemMap.getCommandConditions() + "") != "NONE")).toUpperCase()), event -> commandActionPane(player, itemMap)));
        conditionsPane.addButton(new Button(ItemHandler.getItem("CACTUS", 1, false, "&b&l&nDisposable&b&l Conditions", "&7", "&7*Condition(s) that must be met", "&7in order for the disposable", "&7itemflag to function.", "&7", "&c&l&nNOTE:&7 The disposable itemflag", "&7must be defined for this", "&7condition to function.", "&7", "&9&lENABLED: " + String.valueOf((StringUtils.nullCheck(itemMap.getDisposableConditions() + "") != "NONE")).toUpperCase()), event -> disposableCPane(player, itemMap)));
        conditionsPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&b&l&nTrigger&b&l Conditions", "&7", "&7*Condition(s) that must be met", "&7in order to to receive the", "&7item when performing a trigger.", "&7", "&9&lENABLED: " + String.valueOf((StringUtils.nullCheck(itemMap.getTriggerConditions() + "") != "NONE")).toUpperCase()), event -> triggerCPane(player, itemMap)));
        conditionsPane.addButton(new Button(fillerPaneBItem), 3);
        conditionsPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
        conditionsPane.addButton(new Button(fillerPaneBItem), 7);
        conditionsPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
    });
    conditionsPane.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 15 with Interface

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

the class Menu method togglePane.

/**
 * Opens the Pane for the Player.
 * This Pane is for setting the custom toggle commands.
 *
 * @param player - The Player to have the Pane opened.
 * @param itemMap - The ItemMap currently being modified.
 */
private static void togglePane(final Player player, final ItemMap itemMap) {
    Interface togglePane = new Interface(false, 2, GUIName, player);
    SchedulerUtils.runAsync(() -> {
        togglePane.addButton(new Button(fillerPaneBItem), 2);
        togglePane.addButton(new Button(ItemHandler.getItem("BOOK", 1, false, "&e&lCommands", "&7", "&7*Define specific commands which", "&7players can use to enable or disable", "&7the custom item upon execution."), event -> altCommandPane(player, itemMap, 0)));
        togglePane.addButton(new Button(fillerPaneBItem));
        togglePane.addButton(new Button(ItemHandler.getItem("PAPER", 1, (StringUtils.nullCheck(itemMap.getToggleMessage()) != "NONE"), "&b&lMessage", "&7", "&7*Set a custom message that", "&7will be sent to the player", "&7upon executing a toggle command.", "&9&lMESSAGE: &f" + StringUtils.nullCheck(itemMap.getToggleMessage())), event -> {
            if (StringUtils.nullCheck(itemMap.getToggleMessage()) != "NONE") {
                itemMap.setToggleMessage(null);
                togglePane(player, itemMap);
            } else {
                player.closeInventory();
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "TOGGLE MESSAGE";
                placeHolders[15] = "&a%item% has been toggled!";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
            }
        }, event -> {
            itemMap.setToggleMessage(ChatColor.stripColor(event.getMessage()));
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "TOGGLE MESSAGE";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            togglePane(event.getPlayer(), itemMap);
        }));
        togglePane.addButton(new Button(fillerPaneBItem));
        togglePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, (StringUtils.nullCheck(itemMap.getToggleNode()) != "NONE"), "&b&lPermissions", "&7", "&7*Set a custom permissions node", "&7that each player needs in order", "&7to execute the toggle commands.", "&9&lPERMISSIONS: &f" + StringUtils.nullCheck(itemMap.getToggleNode())), event -> {
            if (StringUtils.nullCheck(itemMap.getToggleNode()) != "NONE") {
                itemMap.setTogglePerm(null);
                togglePane(player, itemMap);
            } else {
                player.closeInventory();
                String[] placeHolders = LanguageAPI.getLang(false).newString();
                placeHolders[16] = "TOGGLE PERMISSION";
                placeHolders[15] = "itemjoin.toggle";
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
                LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
            }
        }, event -> {
            itemMap.setTogglePerm(ChatColor.stripColor(event.getMessage()));
            String[] placeHolders = LanguageAPI.getLang(false).newString();
            placeHolders[16] = "TOGGLE PERMISSION";
            LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
            togglePane(event.getPlayer(), itemMap);
        }));
        togglePane.addButton(new Button(fillerPaneBItem), 2);
        togglePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
        togglePane.addButton(new Button(fillerPaneBItem), 7);
        togglePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
    });
    togglePane.open(player);
}
Also used : ItemHandler(me.RockinChaos.itemjoin.handlers.ItemHandler) PatternType(org.bukkit.block.banner.PatternType) Enchantment(org.bukkit.enchantments.Enchantment) GameProfile(com.mojang.authlib.GameProfile) Player(org.bukkit.entity.Player) LanguageAPI(me.RockinChaos.itemjoin.utils.api.LanguageAPI) Inventory(org.bukkit.inventory.Inventory) DependAPI(me.RockinChaos.itemjoin.utils.api.DependAPI) World(org.bukkit.World) Map(java.util.Map) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) FireworkEffectMeta(org.bukkit.inventory.meta.FireworkEffectMeta) Bukkit(org.bukkit.Bukkit) Action(me.RockinChaos.itemjoin.item.ItemCommand.Action) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) Sound(org.bukkit.Sound) ItemMap(me.RockinChaos.itemjoin.item.ItemMap) EntityType(org.bukkit.entity.EntityType) FireworkMeta(org.bukkit.inventory.meta.FireworkMeta) ItemUtilities(me.RockinChaos.itemjoin.item.ItemUtilities) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) SchedulerUtils(me.RockinChaos.itemjoin.utils.SchedulerUtils) StringUtils(me.RockinChaos.itemjoin.utils.StringUtils) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemJoin(me.RockinChaos.itemjoin.ItemJoin) PotionEffectType(org.bukkit.potion.PotionEffectType) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Pattern(org.bukkit.block.banner.Pattern) BookMeta(org.bukkit.inventory.meta.BookMeta) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface) HashMap(java.util.HashMap) HeadDatabaseAPI(me.arcaniax.hdb.api.HeadDatabaseAPI) BannerMeta(org.bukkit.inventory.meta.BannerMeta) ServerUtils(me.RockinChaos.itemjoin.utils.ServerUtils) ArrayList(java.util.ArrayList) FileConfiguration(org.bukkit.configuration.file.FileConfiguration) Environment(org.bukkit.World.Environment) Property(com.mojang.authlib.properties.Property) ConfigHandler(me.RockinChaos.itemjoin.handlers.ConfigHandler) Color(org.bukkit.Color) Attribute(org.bukkit.attribute.Attribute) Type(org.bukkit.FireworkEffect.Type) PlayerHandler(me.RockinChaos.itemjoin.handlers.PlayerHandler) LegacyAPI(me.RockinChaos.itemjoin.utils.api.LegacyAPI) DecimalFormat(java.text.DecimalFormat) Field(java.lang.reflect.Field) File(java.io.File) PotionEffect(org.bukkit.potion.PotionEffect) CommandSequence(me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ItemCommand(me.RockinChaos.itemjoin.item.ItemCommand) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) Button(me.RockinChaos.itemjoin.utils.interfaces.Button) Interface(me.RockinChaos.itemjoin.utils.interfaces.Interface)

Aggregations

Interface (me.RockinChaos.itemjoin.utils.interfaces.Interface)110 GameProfile (com.mojang.authlib.GameProfile)108 Property (com.mojang.authlib.properties.Property)108 File (java.io.File)108 Field (java.lang.reflect.Field)108 DecimalFormat (java.text.DecimalFormat)108 ArrayList (java.util.ArrayList)108 HashMap (java.util.HashMap)108 List (java.util.List)108 Map (java.util.Map)108 UUID (java.util.UUID)108 ItemJoin (me.RockinChaos.itemjoin.ItemJoin)108 ConfigHandler (me.RockinChaos.itemjoin.handlers.ConfigHandler)108 ItemHandler (me.RockinChaos.itemjoin.handlers.ItemHandler)108 PlayerHandler (me.RockinChaos.itemjoin.handlers.PlayerHandler)108 ItemCommand (me.RockinChaos.itemjoin.item.ItemCommand)108 Action (me.RockinChaos.itemjoin.item.ItemCommand.Action)108 CommandSequence (me.RockinChaos.itemjoin.item.ItemCommand.CommandSequence)108 ItemMap (me.RockinChaos.itemjoin.item.ItemMap)108 ItemUtilities (me.RockinChaos.itemjoin.item.ItemUtilities)108