Search in sources :

Example 6 with InventoryContents

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

the class TrollChoice method init.

@Override
public void init(Player player, InventoryContents contents) {
    WereWolfAPI game = JavaPlugin.getPlugin(Main.class).getWereWolfAPI();
    contents.set(0, 0, ClickableItem.of((new ItemBuilder(UniversalMaterial.COMPASS.getType()).setDisplayName(game.translate("werewolf.menu.return")).build()), e -> AdvancedConfig.INVENTORY.open(player)));
}
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) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main)

Example 7 with InventoryContents

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

the class WhiteList 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) 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) Main(fr.ph1lou.werewolfplugin.Main)

Example 8 with InventoryContents

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

the class Maps 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 + "maps");
    File[] files = repertoire.listFiles();
    if (files == null)
        return;
    int i = 1;
    for (File file : files) {
        contents.set(0, i, ClickableItem.of((new ItemBuilder(UniversalMaterial.MAP.getType()).setDisplayName(game.translate("werewolf.menu.maps.map", Formatter.format("&world&", file.getName()))).build()), e -> {
            if (!game.isState(StateGame.LOBBY)) {
                player.sendMessage(game.translate(Prefix.RED.getKey(), "werewolf.check.game_in_progress"));
                return;
            }
            try {
                game.getMapManager().loadMap(file);
            } catch (IOException ioException) {
                ioException.printStackTrace();
            }
        }));
        i++;
    }
    contents.set(1, 1, ClickableItem.of((new ItemBuilder(UniversalMaterial.LAVA_BUCKET.getType()).setDisplayName(game.translate("werewolf.menu.maps.new")).build()), e -> BukkitUtils.scheduleSyncDelayedTask(() -> {
        if (!game.isState(StateGame.LOBBY)) {
            player.sendMessage(game.translate(Prefix.RED.getKey(), "werewolf.check.game_in_progress"));
            return;
        }
        try {
            player.closeInventory();
            game.getMapManager().loadMap(null);
        } catch (IOException ignored) {
        }
    })));
}
Also used : UniversalMaterial(fr.ph1lou.werewolfapi.enums.UniversalMaterial) SmartInventory(fr.minuskube.inv.SmartInventory) StateGame(fr.ph1lou.werewolfapi.enums.StateGame) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) IOException(java.io.IOException) Player(org.bukkit.entity.Player) BukkitUtils(fr.ph1lou.werewolfapi.utils.BukkitUtils) File(java.io.File) 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) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) ClickableItem(fr.minuskube.inv.ClickableItem) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) IOException(java.io.IOException) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main) File(java.io.File)

Example 9 with InventoryContents

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

the class Maps 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) StateGame(fr.ph1lou.werewolfapi.enums.StateGame) Main(fr.ph1lou.werewolfplugin.Main) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) IOException(java.io.IOException) Player(org.bukkit.entity.Player) BukkitUtils(fr.ph1lou.werewolfapi.utils.BukkitUtils) File(java.io.File) 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) Formatter(fr.ph1lou.werewolfapi.player.utils.Formatter) ClickableItem(fr.minuskube.inv.ClickableItem) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) WereWolfAPI(fr.ph1lou.werewolfapi.game.WereWolfAPI) Main(fr.ph1lou.werewolfplugin.Main)

Example 10 with InventoryContents

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

the class Roles method init.

@Override
public void init(Player player, InventoryContents contents) {
    Main main = JavaPlugin.getPlugin(Main.class);
    GameManager game = (GameManager) main.getWereWolfAPI();
    IConfiguration config = game.getConfig();
    contents.set(0, 0, ClickableItem.of((new ItemBuilder(UniversalMaterial.COMPASS.getType()).setDisplayName(game.translate("werewolf.menu.return")).build()), e -> Config.INVENTORY.open(player)));
    contents.set(0, 8, ClickableItem.of((new ItemBuilder(UniversalMaterial.BARRIER.getType()).setDisplayName(game.translate("werewolf.menu.roles.zero")).build()), e -> {
        for (RoleRegister roleRegister : main.getRegisterManager().getRolesRegister()) {
            config.setRole(roleRegister.getKey(), 0);
        }
        config.setLoverCount(LoverType.LOVER.getKey(), 0);
        config.setLoverCount(LoverType.AMNESIAC_LOVER.getKey(), 0);
        config.setLoverCount(LoverType.CURSED_LOVER.getKey(), 0);
        game.setRoleInitialSize(0);
    }));
}
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) ItemBuilder(fr.ph1lou.werewolfapi.utils.ItemBuilder) GameManager(fr.ph1lou.werewolfplugin.game.GameManager) RoleRegister(fr.ph1lou.werewolfapi.registers.impl.RoleRegister) IConfiguration(fr.ph1lou.werewolfapi.game.IConfiguration) 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