Search in sources :

Example 21 with InventoryContents

use of fr.minuskube.inv.content.InventoryContents in project WereWolfPlugin by Ph1Lou.

the class Stuffs method init.

@Override
public void init(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    WereWolfAPI game = main.getWereWolfAPI();
    contents.set(0, 0, ClickableItem.of((new ItemBuilder(UniversalMaterial.COMPASS.getType()).setDisplayName(game.translate("werewolf.menu.return")).build()), e -> Config.INVENTORY.open(player)));
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) SmartInventory(fr.minuskube.inv.SmartInventory) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) IStuffManager(fr.ph1lou.werewolfapi.game.IStuffManager) Player(org.bukkit.entity.Player) UUID(java.util.UUID) Inventory(org.bukkit.inventory.Inventory) ItemStack(org.bukkit.inventory.ItemStack) TextComponent(net.md_5.bungee.api.chat.TextComponent) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) GameMode(org.bukkit.GameMode) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) Prefix(fr.ph1lou.werewolfapi.enums.Prefix) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) PlayerInventory(org.bukkit.inventory.PlayerInventory) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) Bukkit(org.bukkit.Bukkit) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main)

Example 22 with InventoryContents

use of fr.minuskube.inv.content.InventoryContents in project WereWolfPlugin by Ph1Lou.

the class TrollChoice method update.

@Override
public void update(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    WereWolfAPI game = main.getWereWolfAPI();
    IConfiguration config = game.getConfig();
    Pagination pagination = contents.pagination();
    UUID uuid = player.getUniqueId();
    contents.set(5, 1, ClickableItem.of((new ItemBuilder(Category.WEREWOLF == this.categories.getOrDefault(uuid, Category.WEREWOLF) ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate(Camp.WEREWOLF.getKey())).build()), e -> this.categories.put(uuid, Category.WEREWOLF)));
    contents.set(5, 3, ClickableItem.of((new ItemBuilder(Category.VILLAGER == this.categories.getOrDefault(uuid, Category.WEREWOLF) ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate(Camp.VILLAGER.getKey())).build()), e -> this.categories.put(uuid, Category.VILLAGER)));
    contents.set(5, 5, ClickableItem.of((new ItemBuilder(Category.NEUTRAL == this.categories.getOrDefault(uuid, Category.WEREWOLF) ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate(Camp.NEUTRAL.getKey())).build()), e -> this.categories.put(uuid, Category.NEUTRAL)));
    contents.set(5, 7, ClickableItem.of((new ItemBuilder(Category.ADDONS == this.categories.getOrDefault(uuid, Category.WEREWOLF) ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate("werewolf.categories.addons")).build()), e -> this.categories.put(uuid, Category.ADDONS)));
    List<ClickableItem> items = new ArrayList<>();
    for (RoleRegister roleRegister : main.getRegisterManager().getRolesRegister()) {
        if (roleRegister.getCategories().contains(categories.getOrDefault(uuid, Category.WEREWOLF))) {
            String key = roleRegister.getKey();
            List<String> lore = roleRegister.getLoreKey().stream().map(game::translate).collect(Collectors.toList());
            if (config.getTrollKey().equals(key)) {
                items.add(ClickableItem.empty(new ItemBuilder(UniversalMaterial.GREEN_TERRACOTTA.getStack()).setLore(lore).setDisplayName(game.translate(roleRegister.getKey())).build()));
            } else {
                items.add(ClickableItem.of((new ItemBuilder(UniversalMaterial.RED_TERRACOTTA.getStack()).setLore(lore).setDisplayName(game.translate(roleRegister.getKey())).build()), event -> config.setTrollKey(roleRegister.getKey())));
            }
        }
    }
    if (items.size() > 36) {
        pagination.setItems(items.toArray(new ClickableItem[0]));
        pagination.setItemsPerPage(27);
        pagination.addToIterator(contents.newIterator(SlotIterator.Type.HORIZONTAL, 1, 0));
        int page = pagination.getPage() + 1;
        contents.set(4, 2, ClickableItem.of(new ItemBuilder(Material.ARROW).setDisplayName(game.translate("werewolf.menu.roles.previous", Formatter.format("&current&", page), Formatter.format("&previous&", pagination.isFirst() ? page : page - 1))).build(), e -> INVENTORY.open(player, pagination.previous().getPage())));
        contents.set(4, 6, ClickableItem.of(new ItemBuilder(Material.ARROW).setDisplayName(game.translate("werewolf.menu.roles.next", Formatter.format("&current&", page), Formatter.format("&next&", pagination.isLast() ? page : page + 1))).build(), e -> INVENTORY.open(player, pagination.next().getPage())));
        contents.set(4, 4, ClickableItem.empty(new ItemBuilder(UniversalMaterial.SIGN.getType()).setDisplayName(game.translate("werewolf.menu.roles.current", Formatter.format("&current&", page), Formatter.format("&sum&", items.size() / 27 + 1))).build()));
    } else {
        int i = 0;
        for (ClickableItem clickableItem : items) {
            contents.set(i / 9 + 1, i % 9, clickableItem);
            i++;
        }
        for (int k = i; k < 36; k++) {
            contents.set(k / 9 + 1, k % 9, null);
        }
    }
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) SmartInventory(fr.minuskube.inv.SmartInventory) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) HashMap(java.util.HashMap) Player(org.bukkit.entity.Player) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) SlotIterator(fr.minuskube.inv.content.SlotIterator) Category(fr.ph1lou.werewolfapi.enums.Category) List(java.util.List) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) RoleRegister(fr.ph1lou.werewolfapi.registers.impl.RoleRegister) InventoryContents(fr.minuskube.inv.content.InventoryContents) Map(java.util.Map) Camp(fr.ph1lou.werewolfapi.enums.Camp) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) Pagination(fr.minuskube.inv.content.Pagination) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) ClickableItem(fr.minuskube.inv.ClickableItem) ArrayList(java.util.ArrayList) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Pagination(fr.minuskube.inv.content.Pagination) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) RoleRegister(fr.ph1lou.werewolfapi.registers.impl.RoleRegister) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) UUID(java.util.UUID) Main(fr.ph1lou.werewolfplugin.Main)

Example 23 with InventoryContents

use of fr.minuskube.inv.content.InventoryContents in project WereWolfPlugin by Ph1Lou.

the class WhiteList method update.

@Override
public void update(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    WereWolfAPI game = main.getWereWolfAPI();
    IConfiguration config = game.getConfig();
    contents.set(0, 2, ClickableItem.of((new ItemBuilder(UniversalMaterial.MAP.getType()).setDisplayName(config.isWhiteList() ? game.translate("werewolf.menu.whitelist.close") : game.translate("werewolf.menu.whitelist.open")).build()), e -> {
        config.setWhiteList(!config.isWhiteList());
        game.getModerationManager().checkQueue();
    }));
    contents.set(1, 1, ClickableItem.of((new ItemBuilder(UniversalMaterial.SKELETON_SKULL.getStack()).setDisplayName(game.translate("werewolf.menu.whitelist.spectator_mode")).setLore(Collections.singletonList(Arrays.asList(game.translate("werewolf.menu.whitelist.disable"), game.translate("werewolf.menu.whitelist.death_only"), game.translate("werewolf.menu.whitelist.enable")).get(config.getSpectatorMode()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setSpectatorMode((config.getSpectatorMode() + 1) % 3);
        } else
            config.setSpectatorMode((config.getSpectatorMode() + 2) % 3);
    }));
    contents.set(1, 3, ClickableItem.of((new ItemBuilder(UniversalMaterial.PLAYER_HEAD.getStack()).setDisplayName(game.translate("werewolf.menu.whitelist.max", Formatter.number(config.getPlayerMax()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setPlayerMax(config.getPlayerMax() + 1);
            game.getModerationManager().checkQueue();
        } else if (config.getPlayerMax() - 1 > 0)
            config.setPlayerMax(config.getPlayerMax() - 1);
    }));
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) Arrays(java.util.Arrays) SmartInventory(fr.minuskube.inv.SmartInventory) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) Collections(java.util.Collections) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) ClickableItem(fr.minuskube.inv.ClickableItem) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) Main(fr.ph1lou.werewolfplugin.Main)

Example 24 with InventoryContents

use of fr.minuskube.inv.content.InventoryContents in project WereWolfPlugin by Ph1Lou.

the class AdvancedConfig method update.

@Override
public void update(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    WereWolfAPI game = main.getWereWolfAPI();
    IConfiguration config = game.getConfig();
    List<String> lore = Arrays.asList(game.translate("werewolf.menu.left"), game.translate("werewolf.menu.right"));
    contents.set(0, 2, ClickableItem.of((new ItemBuilder(Material.APPLE).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.apple", Formatter.number(config.getAppleRate()))).build()), e -> {
        if (e.isLeftClick()) {
            if (config.getAppleRate() + 5 <= 100) {
                config.setAppleRate(config.getAppleRate() + 5);
            }
        } else if (config.getAppleRate() - 5 >= 0) {
            config.setAppleRate(config.getAppleRate() - 5);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate("werewolf.menu.advanced_tool.apple", Formatter.number(config.getAppleRate()))).build());
    }));
    contents.set(0, 4, ClickableItem.of((new ItemBuilder(Material.FLINT).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.flint", Formatter.number(config.getFlintRate()))).build()), e -> {
        if (e.isLeftClick()) {
            if (config.getFlintRate() + 5 <= 100) {
                config.setFlintRate(config.getFlintRate() + 5);
            }
        } else if (config.getFlintRate() - 5 >= 0) {
            config.setFlintRate(config.getFlintRate() - 5);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate("werewolf.menu.advanced_tool.flint", Formatter.number(config.getFlintRate()))).build());
    }));
    contents.set(0, 6, ClickableItem.of((new ItemBuilder(Material.ENDER_PEARL).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.ender_pearl", Formatter.number(config.getPearlRate()))).build()), e -> {
        if (e.isLeftClick()) {
            if (config.getPearlRate() + 5 <= 100) {
                config.setPearlRate(config.getPearlRate() + 5);
            }
        } else if (config.getPearlRate() - 5 >= 0) {
            config.setPearlRate(config.getPearlRate() - 5);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate("werewolf.menu.advanced_tool.ender_pearl", Formatter.number(config.getPearlRate()))).build());
    }));
    contents.set(0, 8, ClickableItem.of((new ItemBuilder(Material.DIAMOND).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.diamond", Formatter.number(config.getDiamondLimit()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setDiamondLimit(config.getDiamondLimit() + 1);
        } else if (config.getDiamondLimit() > 0) {
            config.setDiamondLimit(config.getDiamondLimit() - 1);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate("werewolf.menu.advanced_tool.diamond", Formatter.number(config.getDiamondLimit()))).build());
    }));
    contents.set(1, 1, ClickableItem.of((new ItemBuilder(UniversalMaterial.EXPERIENCE_BOTTLE.getType()).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.xp", Formatter.number(config.getXpBoost()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setXpBoost(config.getXpBoost() + 10);
        } else if (config.getXpBoost() - 10 >= 0) {
            config.setXpBoost(config.getXpBoost() - 10);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate("werewolf.menu.advanced_tool.xp", Formatter.number(config.getXpBoost()))).build());
    }));
    contents.set(1, 3, ClickableItem.of((new ItemBuilder(UniversalMaterial.PLAYER_HEAD.getStack()).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.vote", Formatter.number(config.getPlayerRequiredVoteEnd()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setPlayerRequiredVoteEnd(config.getPlayerRequiredVoteEnd() + 1);
        } else if (config.getPlayerRequiredVoteEnd() > 0) {
            config.setPlayerRequiredVoteEnd(config.getPlayerRequiredVoteEnd() - 1);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.vote", Formatter.number(config.getPlayerRequiredVoteEnd()))).build());
    }));
    contents.set(1, 5, ClickableItem.of((new ItemBuilder(Material.POTION).setDisplayName(game.translate("werewolf.menu.advanced_tool.strength", Formatter.number(config.getStrengthRate()))).setLore(lore).build()), e -> {
        if (e.isLeftClick()) {
            config.setStrengthRate(config.getStrengthRate() + 10);
        } else if (config.getStrengthRate() - 10 >= 0) {
            config.setStrengthRate(config.getStrengthRate() - 10);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.strength", Formatter.number(config.getStrengthRate()))).build());
    }));
    contents.set(1, 7, ClickableItem.of((new ItemBuilder(Material.POTION).setDisplayName(game.translate("werewolf.menu.advanced_tool.resistance", Formatter.number(config.getResistanceRate()))).setLore(lore).build()), e -> {
        if (e.isLeftClick()) {
            config.setResistanceRate(config.getResistanceRate() + 2);
        } else if (config.getResistanceRate() - 2 >= 0) {
            config.setResistanceRate(config.getResistanceRate() - 2);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setLore(lore).setDisplayName(game.translate("werewolf.menu.advanced_tool.resistance", Formatter.number(config.getResistanceRate()))).build());
    }));
    contents.set(2, 0, ClickableItem.of((new ItemBuilder(UniversalMaterial.BOOK.getStack()).setLore(lore).setDisplayName(game.translate("werewolf.commands.admin.ww_chat.number", Formatter.number(config.getWereWolfChatMaxMessage()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setWereWolfChatMaxMessage(config.getWereWolfChatMaxMessage() + 1);
        } else if (config.getWereWolfChatMaxMessage() > 1) {
            config.setWereWolfChatMaxMessage(config.getWereWolfChatMaxMessage() - 1);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setLore(lore).setDisplayName(game.translate("werewolf.commands.admin.ww_chat.number", Formatter.number(config.getWereWolfChatMaxMessage()))).build());
    }));
    contents.set(2, 2, ClickableItem.of((new ItemBuilder(Material.BREAD).setDisplayName(game.translate(config.isTrollSV() ? "werewolf.menu.advanced_tool.troll_on" : "werewolf.menu.advanced_tool.troll_off")).setLore(Arrays.asList(game.translate(config.getTrollKey()), game.translate("werewolf.menu.advanced_tool.troll_set"))).build()), e -> {
        if (e.isShiftClick()) {
            TrollChoice.INVENTORY.open(player);
        } else {
            config.setTrollSV(!config.isTrollSV());
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate(config.isTrollSV() ? "werewolf.menu.advanced_tool.troll_on" : "werewolf.menu.advanced_tool.troll_off")).setLore(Arrays.asList(game.translate(config.getTrollKey()), game.translate("werewolf.menu.advanced_tool.troll_set"))).build());
    }));
    contents.set(2, 4, ClickableItem.of((new ItemBuilder(Material.GOLD_NUGGET).setDisplayName(game.translate("werewolf.menu.advanced_tool.particles")).setLore(Collections.singletonList(Arrays.asList(game.translate("werewolf.menu.advanced_tool.particles_off"), game.translate("werewolf.menu.advanced_tool.exception"), game.translate("werewolf.menu.advanced_tool.particles_on")).get(config.getGoldenAppleParticles()))).build()), e -> {
        if (e.isLeftClick()) {
            config.setGoldenAppleParticles((config.getGoldenAppleParticles() + 1) % 3);
        } else {
            config.setGoldenAppleParticles((config.getGoldenAppleParticles() + 2) % 3);
        }
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate("werewolf.menu.advanced_tool.particles")).setLore(Collections.singletonList(Arrays.asList(game.translate("werewolf.menu.advanced_tool.particles_off"), game.translate("werewolf.menu.advanced_tool.exception"), game.translate("werewolf.menu.advanced_tool.particles_on")).get(config.getGoldenAppleParticles()))).build());
    }));
    contents.set(2, 6, ClickableItem.of((new ItemBuilder(Material.ARROW).setDisplayName(game.translate(config.isTrollLover() ? "werewolf.menu.advanced_tool.troll_lover_on" : "werewolf.menu.advanced_tool.troll_lover_off")).build()), e -> {
        config.setTrollLover(!config.isTrollLover());
        e.setCurrentItem(new ItemBuilder(e.getCurrentItem()).setDisplayName(game.translate(config.isTrollLover() ? "werewolf.menu.advanced_tool.troll_lover_on" : "werewolf.menu.advanced_tool.troll_lover_off")).build());
    }));
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) Arrays(java.util.Arrays) SmartInventory(fr.minuskube.inv.SmartInventory) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) List(java.util.List) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) Collections(java.util.Collections) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) Main(fr.ph1lou.werewolfplugin.Main)

Example 25 with InventoryContents

use of fr.minuskube.inv.content.InventoryContents in project WereWolfPlugin by Ph1Lou.

the class Languages method init.

@Override
public void init(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    WereWolfAPI game = main.getWereWolfAPI();
    contents.set(0, 0, ClickableItem.of((new ItemBuilder(UniversalMaterial.COMPASS.getType()).setDisplayName(game.translate("werewolf.menu.return")).build()), e -> Config.INVENTORY.open(player)));
    ItemBuilder fr = new ItemBuilder(UniversalMaterial.WHITE_BANNER.getStack());
    fr.addPattern(new Pattern(DyeColor.BLUE, PatternType.STRIPE_LEFT));
    fr.addPattern(new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER));
    fr.addPattern(new Pattern(DyeColor.RED, PatternType.STRIPE_RIGHT));
    fr.setDisplayName("Français");
    fr.setLore(Collections.singletonList("Par Ph1Lou"));
    ItemBuilder en = new ItemBuilder(UniversalMaterial.WHITE_BANNER.getStack());
    en.addPattern(new Pattern(DyeColor.BLUE, PatternType.BASE));
    en.addPattern(new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNLEFT));
    en.addPattern(new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT));
    en.addPattern(new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT));
    en.addPattern(new Pattern(DyeColor.RED, PatternType.CROSS));
    en.addPattern(new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER));
    en.addPattern(new Pattern(DyeColor.WHITE, PatternType.STRIPE_MIDDLE));
    en.addPattern(new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS));
    en.setDisplayName("English");
    en.setLore(Collections.singletonList("By Jormunth"));
    contents.set(0, 2, ClickableItem.of((en.build()), e -> {
        main.getConfig().set("lang", "en_EN");
        Bukkit.getPluginManager().callEvent(new UpdateLanguageEvent());
        Languages.INVENTORY.open(player);
    }));
    contents.set(0, 4, ClickableItem.of((fr.build()), e -> {
        main.getConfig().set("lang", "fr_FR");
        Bukkit.getPluginManager().callEvent(new UpdateLanguageEvent());
        Languages.INVENTORY.open(player);
    }));
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) PatternType(org.bukkit.block.banner.PatternType) SmartInventory(fr.minuskube.inv.SmartInventory) Pattern(org.bukkit.block.banner.Pattern) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) UpdateLanguageEvent(fr.ph1lou.werewolfapi.events.UpdateLanguageEvent) DyeColor(org.bukkit.DyeColor) Collections(java.util.Collections) ClickableItem(fr.minuskube.inv.ClickableItem) Bukkit(org.bukkit.Bukkit) Pattern(org.bukkit.block.banner.Pattern) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) UpdateLanguageEvent(fr.ph1lou.werewolfapi.events.UpdateLanguageEvent) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main)

Aggregations

ClickableItem (fr.minuskube.inv.ClickableItem)38 SmartInventory (fr.minuskube.inv.SmartInventory)38 InventoryContents (fr.minuskube.inv.content.InventoryContents)38 InventoryProvider (fr.minuskube.inv.content.InventoryProvider)38 Player (org.bukkit.entity.Player)38 UniversalMaterial (fr.ph1lou.werewolfapi.enums.UniversalMaterial)33 ItemBuilder (fr.ph1lou.werewolfapi.utils.ItemBuilder)33 Main (fr.ph1lou.werewolfplugin.Main)33 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)33 WereWolfAPI (fr.ph1lou.werewolfapi.game.WereWolfAPI)30 Material (org.bukkit.Material)29 Formatter (fr.ph1lou.werewolfapi.player.utils.Formatter)27 List (java.util.List)21 IConfiguration (fr.ph1lou.werewolfapi.game.IConfiguration)20 Arrays (java.util.Arrays)19 ArrayList (java.util.ArrayList)16 Pagination (fr.minuskube.inv.content.Pagination)15 Collectors (java.util.stream.Collectors)15 ItemStack (org.bukkit.inventory.ItemStack)15 SlotIterator (fr.minuskube.inv.content.SlotIterator)14