Search in sources :

Example 26 with InventoryContents

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

the class RandomEvents method update.

@Override
public void update(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    GameManager game = (GameManager) main.getWereWolfAPI();
    IConfiguration config = game.getConfig();
    Pagination pagination = contents.pagination();
    List<ClickableItem> items = new ArrayList<>();
    main.getRegisterManager().getRandomEventsRegister().forEach(randomEventRegister -> {
        String key = randomEventRegister.getKey();
        ItemStack itemStack = getItemStack(game, randomEventRegister);
        items.add(ClickableItem.of((itemStack), e -> {
            if (e.isLeftClick()) {
                int probability = config.getProbability(key);
                config.setProbability(key, (probability + 1) % 101);
                if (probability == 0) {
                    if (!game.isState(StateGame.LOBBY)) {
                        randomEventRegister.getRandomEvent().register(game.getRandom().nextDouble() * 100 < game.getConfig().getProbability(key));
                    }
                }
                e.setCurrentItem(getItemStack(game, randomEventRegister));
            }
            if (e.isRightClick()) {
                int probability = config.getProbability(key);
                config.setProbability(key, ((probability - 1) + 101) % 101);
                if (probability == 1) {
                    randomEventRegister.getRandomEvent().register(false);
                }
                e.setCurrentItem(getItemStack(game, randomEventRegister));
            }
        }));
        if (items.size() > 45) {
            pagination.setItems(items.toArray(new ClickableItem[0]));
            pagination.setItemsPerPage(36);
            pagination.addToIterator(contents.newIterator(SlotIterator.Type.HORIZONTAL, 1, 0));
            int page = pagination.getPage() + 1;
            contents.set(5, 0, null);
            contents.set(5, 1, null);
            contents.set(5, 3, null);
            contents.set(5, 5, null);
            contents.set(5, 7, null);
            contents.set(5, 8, null);
            contents.set(5, 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(5, 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(5, 4, ClickableItem.empty(new ItemBuilder(UniversalMaterial.SIGN.getType()).setDisplayName(game.translate("werewolf.menu.roles.current", Formatter.format("&current&", page), Formatter.format("&sum&", items.size() / 36 + 1))).build()));
        } else {
            int i = 0;
            for (ClickableItem clickableItem : items) {
                contents.set(i / 9 + 1, i % 9, clickableItem);
                i++;
            }
            for (int k = i; k < (i / 9 + 1) * 9; k++) {
                contents.set(k / 9 + 1, k % 9, null);
            }
        }
    });
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) Arrays(java.util.Arrays) SmartInventory(fr.minuskube.inv.SmartInventory) StateGame(fr.ph1lou.werewolfapi.enums.StateGame) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) Collectors(java.util.stream.Collectors) GameManager(fr.ph1lou.werewolfplugin.game.GameManager) ItemStack(org.bukkit.inventory.ItemStack) ArrayList(java.util.ArrayList) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) SlotIterator(fr.minuskube.inv.content.SlotIterator) List(java.util.List) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) RandomEventRegister(fr.ph1lou.werewolfapi.registers.impl.RandomEventRegister) 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) Pagination(fr.minuskube.inv.content.Pagination) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) GameManager(fr.ph1lou.werewolfplugin.game.GameManager) ClickableItem(fr.minuskube.inv.ClickableItem) ArrayList(java.util.ArrayList) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) ItemStack(org.bukkit.inventory.ItemStack) Main(fr.ph1lou.werewolfplugin.Main)

Example 27 with InventoryContents

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

the class RandomEvents 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) Arrays(java.util.Arrays) SmartInventory(fr.minuskube.inv.SmartInventory) StateGame(fr.ph1lou.werewolfapi.enums.StateGame) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) Collectors(java.util.stream.Collectors) GameManager(fr.ph1lou.werewolfplugin.game.GameManager) ItemStack(org.bukkit.inventory.ItemStack) ArrayList(java.util.ArrayList) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) SlotIterator(fr.minuskube.inv.content.SlotIterator) List(java.util.List) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) RandomEventRegister(fr.ph1lou.werewolfapi.registers.impl.RandomEventRegister) 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) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main)

Example 28 with InventoryContents

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

the class Roles method update.

@Override
public void update(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    GameManager game = (GameManager) main.getWereWolfAPI();
    IConfiguration config = game.getConfig();
    Pagination pagination = contents.pagination();
    List<String> lore = new ArrayList<>(Arrays.asList(game.translate("werewolf.menu.left"), game.translate("werewolf.menu.right")));
    if (config.getLoverCount(LoverType.LOVER.getKey()) > 0) {
        contents.set(0, 2, ClickableItem.of((new ItemBuilder(UniversalMaterial.GREEN_TERRACOTTA.getStack(config.getLoverCount(LoverType.LOVER.getKey()))).setDisplayName(game.translate(LoverType.LOVER.getKey()) + game.translate("werewolf.role.lover.random")).setLore(lore).build()), e -> {
            if (e.isLeftClick()) {
                config.addOneLover(LoverType.LOVER.getKey());
            } else if (e.isRightClick()) {
                int LoverNumber = config.getLoverCount(LoverType.LOVER.getKey());
                if (LoverNumber > 0) {
                    config.removeOneLover(LoverType.LOVER.getKey());
                }
            }
        }));
    } else
        contents.set(0, 2, ClickableItem.of((new ItemBuilder(UniversalMaterial.RED_TERRACOTTA.getStack()).setDisplayName(game.translate(LoverType.LOVER.getKey()) + game.translate("werewolf.role.lover.random")).setLore(lore).build()), e -> {
            if (e.isLeftClick()) {
                config.addOneLover(LoverType.LOVER.getKey());
            }
        }));
    if (config.getLoverCount(LoverType.AMNESIAC_LOVER.getKey()) > 0) {
        contents.set(0, 4, ClickableItem.of((new ItemBuilder(UniversalMaterial.GREEN_TERRACOTTA.getStack(config.getLoverCount(LoverType.AMNESIAC_LOVER.getKey()))).setDisplayName(game.translate(LoverType.AMNESIAC_LOVER.getKey())).setLore(lore).build()), e -> {
            if (e.isLeftClick()) {
                config.addOneLover(LoverType.AMNESIAC_LOVER.getKey());
            } else if (e.isRightClick()) {
                int AmnesiacLoverNumber = config.getLoverCount(LoverType.AMNESIAC_LOVER.getKey());
                if (AmnesiacLoverNumber > 0) {
                    config.removeOneLover(LoverType.AMNESIAC_LOVER.getKey());
                }
            }
        }));
    } else
        contents.set(0, 4, ClickableItem.of((new ItemBuilder(UniversalMaterial.RED_TERRACOTTA.getStack()).setDisplayName(game.translate(LoverType.AMNESIAC_LOVER.getKey())).setLore(lore).build()), e -> {
            if (e.isLeftClick()) {
                config.addOneLover(LoverType.AMNESIAC_LOVER.getKey());
            }
        }));
    if (config.getLoverCount(LoverType.CURSED_LOVER.getKey()) > 0) {
        contents.set(0, 6, ClickableItem.of((new ItemBuilder(UniversalMaterial.GREEN_TERRACOTTA.getStack(config.getLoverCount(LoverType.CURSED_LOVER.getKey()))).setDisplayName(game.translate(LoverType.CURSED_LOVER.getKey())).setLore(lore).build()), e -> {
            if (e.isLeftClick()) {
                config.addOneLover(LoverType.CURSED_LOVER.getKey());
            } else if (e.isRightClick()) {
                int cursedLoverNumber = config.getLoverCount(LoverType.CURSED_LOVER.getKey());
                if (cursedLoverNumber > 0) {
                    config.removeOneLover(LoverType.CURSED_LOVER.getKey());
                }
            }
        }));
    } else
        contents.set(0, 6, ClickableItem.of((new ItemBuilder(UniversalMaterial.RED_TERRACOTTA.getStack()).setDisplayName(game.translate(LoverType.CURSED_LOVER.getKey())).setLore(lore).build()), e -> {
            if (e.isLeftClick()) {
                config.addOneLover(LoverType.CURSED_LOVER.getKey());
            }
        }));
    contents.set(5, 1, ClickableItem.of((new ItemBuilder(Category.WEREWOLF == this.category ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate(Camp.WEREWOLF.getKey())).setAmount(Math.max(1, count(main, Category.WEREWOLF))).build()), e -> this.category = Category.WEREWOLF));
    contents.set(5, 3, ClickableItem.of((new ItemBuilder(Category.VILLAGER == this.category ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate(Camp.VILLAGER.getKey())).setAmount(Math.max(1, count(main, Category.VILLAGER))).build()), e -> this.category = Category.VILLAGER));
    contents.set(5, 5, ClickableItem.of((new ItemBuilder(Category.NEUTRAL == this.category ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate(Camp.NEUTRAL.getKey())).setAmount(Math.max(1, count(main, Category.NEUTRAL))).build()), e -> this.category = Category.NEUTRAL));
    contents.set(5, 7, ClickableItem.of((new ItemBuilder(Category.ADDONS == this.category ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK).setDisplayName(game.translate("werewolf.categories.addons")).setAmount(Math.max(1, count(main, Category.ADDONS))).build()), e -> this.category = Category.ADDONS));
    lore.add(game.translate("werewolf.menu.shift"));
    List<ClickableItem> items = new ArrayList<>();
    for (RoleRegister roleRegister : main.getRegisterManager().getRolesRegister()) {
        if (roleRegister.getCategories().contains(this.category)) {
            String key = roleRegister.getKey();
            AtomicBoolean unRemovable = new AtomicBoolean(false);
            List<String> lore2 = new ArrayList<>(lore);
            roleRegister.getLoreKey().stream().map(game::translate).map(s -> Arrays.stream(s.split("\\n")).collect(Collectors.toList())).forEach(lore2::addAll);
            roleRegister.getRequireRole().ifPresent(roleKey -> lore2.add(game.translate("werewolf.menu.roles.need", Formatter.role(game.translate(roleKey)))));
            main.getRegisterManager().getRolesRegister().stream().filter(roleRegister1 -> roleRegister1.getRequireRole().isPresent()).filter(roleRegister1 -> game.getConfig().getRoleCount(roleRegister1.getKey()) > 0).filter(roleRegister1 -> roleRegister1.getRequireRole().get().equals(key)).map(RoleRegister::getKey).findFirst().ifPresent(role -> {
                lore2.add(game.translate("werewolf.menu.roles.dependant_load", Formatter.role(game.translate(role))));
                unRemovable.set(true);
            });
            Optional<String> incompatible = roleRegister.getIncompatibleRoles().stream().filter(s -> game.getConfig().getRoleCount(s) > 0).map(game::translate).findFirst();
            incompatible.ifPresent(role -> lore2.add(game.translate("werewolf.menu.roles.incompatible", Formatter.role(role))));
            if (config.getRoleCount(key) > 0) {
                items.add(ClickableItem.of((new ItemBuilder(roleRegister.getItem().isPresent() ? roleRegister.getItem().get() : UniversalMaterial.GREEN_TERRACOTTA.getStack()).setAmount(config.getRoleCount(key)).setLore(lore2).setDisplayName(game.translate(roleRegister.getKey())).build()), e -> {
                    if (e.isShiftClick()) {
                        AdvancedRoleMenu.getInventory(roleRegister).open(player);
                    } else if (e.isLeftClick()) {
                        selectPlus(game, key);
                    } else if (e.isRightClick()) {
                        int count = game.getConfig().getRoleCount(key);
                        if (!unRemovable.get() || count > 1) {
                            if (roleRegister.isRequireDouble() && count == 2) {
                                selectMinus(game, key);
                            }
                            selectMinus(game, key);
                        }
                    }
                }));
            } else {
                if (roleRegister.getItem().isPresent()) {
                    lore2.add(0, game.translate("werewolf.utils.none"));
                }
                items.add(ClickableItem.of((new ItemBuilder(roleRegister.getItem().isPresent() ? roleRegister.getItem().get() : UniversalMaterial.RED_TERRACOTTA.getStack()).setAmount(1).setLore(lore2).setDisplayName(game.translate(roleRegister.getKey())).build()), e -> {
                    if (e.isShiftClick()) {
                        AdvancedRoleMenu.getInventory(roleRegister).open(player);
                    } else if (e.isLeftClick()) {
                        if (incompatible.isPresent()) {
                            return;
                        }
                        if (roleRegister.getRequireRole().isPresent()) {
                            if (game.getConfig().getRoleCount(roleRegister.getRequireRole().get()) == 0) {
                                return;
                            }
                        }
                        if (roleRegister.isRequireDouble()) {
                            selectPlus(game, key);
                        }
                        selectPlus(game, key);
                    }
                }));
            }
        }
    }
    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, 0, null);
        contents.set(4, 1, null);
        contents.set(4, 3, null);
        contents.set(4, 5, null);
        contents.set(4, 7, null);
        contents.set(4, 8, null);
        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 -> getInventory(player, this.category).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 -> getInventory(player, this.category).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 : Arrays(java.util.Arrays) SmartInventory(fr.minuskube.inv.SmartInventory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) GetWereWolfAPI(fr.ph1lou.werewolfapi.GetWereWolfAPI) Player(org.bukkit.entity.Player) GameManager(fr.ph1lou.werewolfplugin.game.GameManager) ArrayList(java.util.ArrayList) SlotIterator(fr.minuskube.inv.content.SlotIterator) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) RoleRegister(fr.ph1lou.werewolfapi.registers.impl.RoleRegister) InventoryContents(fr.minuskube.inv.content.InventoryContents) 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) UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) LoverType(fr.ph1lou.werewolfapi.enums.LoverType) Main(fr.ph1lou.werewolfplugin.Main) Collectors(java.util.stream.Collectors) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) Category(fr.ph1lou.werewolfapi.enums.Category) List(java.util.List) Optional(java.util.Optional) GameManager(fr.ph1lou.werewolfplugin.game.GameManager) ArrayList(java.util.ArrayList) ClickableItem(fr.minuskube.inv.ClickableItem) Pagination(fr.minuskube.inv.content.Pagination) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) RoleRegister(fr.ph1lou.werewolfapi.registers.impl.RoleRegister) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) Main(fr.ph1lou.werewolfplugin.Main)

Example 29 with InventoryContents

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

the class Save 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) Serializer(fr.ph1lou.werewolfplugin.save.Serializer) SmartInventory(fr.minuskube.inv.SmartInventory) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) BukkitUtils(fr.ph1lou.werewolfapi.utils.BukkitUtils) File(java.io.File) ItemStack(org.bukkit.inventory.ItemStack) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) Prefix(fr.ph1lou.werewolfapi.enums.Prefix) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) AnvilGUI(net.wesjd.anvilgui.AnvilGUI) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) FileUtils_(fr.ph1lou.werewolfplugin.save.FileUtils_) Bukkit(org.bukkit.Bukkit) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main)

Example 30 with InventoryContents

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

the class Save method update.

@Override
public void update(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    WereWolfAPI game = main.getWereWolfAPI();
    File repertoire = new File(main.getDataFolder() + File.separator + "configs");
    File[] files = repertoire.listFiles();
    if (files == null)
        return;
    if (j >= files.length) {
        j = Math.max(0, Math.min(8, files.length) - 1);
    }
    for (int i = 0; i < 8; i++) {
        if (i >= Math.min(files.length, 8)) {
            contents.set(0, i + 1, null);
        } else if (i == j) {
            contents.set(0, i + 1, ClickableItem.empty((new ItemBuilder(UniversalMaterial.FEATHER.getType()).setDisplayName(game.translate("werewolf.menu.save.configuration", Formatter.format("&save&", files[i].getName()))).build())));
        } else {
            int finalI = i;
            contents.set(0, i + 1, ClickableItem.of((new ItemBuilder(UniversalMaterial.PAPER.getType()).setDisplayName(game.translate("werewolf.menu.save.configuration", Formatter.format("&save&", files[i].getName()))).build()), e -> j = finalI));
        }
    }
    contents.set(1, 0, ClickableItem.of((new ItemBuilder(Material.EMERALD_BLOCK).setDisplayName(game.translate("werewolf.menu.save.new")).build()), e -> new AnvilGUI.Builder().onComplete((player2, text) -> {
        save(main, text, player);
        return AnvilGUI.Response.close();
    }).preventClose().text(" ").title(game.translate("werewolf.menu.save.save_menu")).itemLeft(new ItemStack(Material.EMERALD_BLOCK)).plugin(main).onClose((player2) -> BukkitUtils.scheduleSyncDelayedTask(() -> Save.INVENTORY.open(player))).open(player)));
    if (files.length != 0) {
        contents.set(1, 3, ClickableItem.of((new ItemBuilder(UniversalMaterial.BED.getType()).setDisplayName(game.translate("werewolf.menu.save.load", Formatter.format("&save&", files[j].getName()))).build()), e -> {
            load(main);
            player.sendMessage(game.translate(Prefix.GREEN.getKey(), "werewolf.menu.save.load_message", Formatter.format("&save&", files[j].getName())));
        }));
        contents.set(1, 5, ClickableItem.of((new ItemBuilder(UniversalMaterial.BARRIER.getType()).setDisplayName(game.translate("werewolf.menu.save.delete", Formatter.format("&save&", files[j].getName()))).build()), e -> {
            player.sendMessage(game.translate(Prefix.RED.getKey(), "werewolf.menu.save.delete_message", Formatter.format("&save&", files[j].getName())));
            erase(main);
        }));
    } else {
        contents.set(1, 3, null);
        contents.set(1, 5, null);
    }
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) Serializer(fr.ph1lou.werewolfplugin.save.Serializer) SmartInventory(fr.minuskube.inv.SmartInventory) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Player(org.bukkit.entity.Player) BukkitUtils(fr.ph1lou.werewolfapi.utils.BukkitUtils) File(java.io.File) ItemStack(org.bukkit.inventory.ItemStack) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) Prefix(fr.ph1lou.werewolfapi.enums.Prefix) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) AnvilGUI(net.wesjd.anvilgui.AnvilGUI) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) FileUtils_(fr.ph1lou.werewolfplugin.save.FileUtils_) Bukkit(org.bukkit.Bukkit) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) ItemStack(org.bukkit.inventory.ItemStack) Main(fr.ph1lou.werewolfplugin.Main) File(java.io.File)

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