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)));
}
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)));
}
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) {
}
})));
}
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)));
}
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);
}));
}
Aggregations