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)));
}
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("¤t&", 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("¤t&", 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("¤t&", 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);
}
}
}
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);
}));
}
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());
}));
}
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);
}));
}
Aggregations