use of com.ebicep.warlords.game.GameMode in project Warlords by ebicep.
the class AchievementsMenu method openChallengeAchievementHistoryMenu.
public static void openChallengeAchievementHistoryMenu(Player player, GameMode gameMode, ChallengeAchievements achievement) {
if (DatabaseManager.playerService == null)
return;
DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
List<ChallengeAchievements.ChallengeAchievementRecord> achievementRecords = databasePlayer.getAchievements().stream().filter(ChallengeAchievements.ChallengeAchievementRecord.class::isInstance).map(ChallengeAchievements.ChallengeAchievementRecord.class::cast).filter(t -> t.getAchievement() == achievement).collect(Collectors.toList());
Menu menu = new Menu("Achievement History", 9 * 6);
int x = 0;
int y = 0;
for (ChallengeAchievements.ChallengeAchievementRecord achievementRecord : achievementRecords) {
menu.setItem(x, y, new ItemBuilder(Material.BOOK).name(ChatColor.GREEN + achievement.name).lore(ChatColor.GRAY + DATE_FORMAT.format(achievementRecord.getDate())).get(), (m, e) -> {
});
x++;
if (x == 9) {
x = 0;
y++;
}
}
menu.setItem(3, 5, MENU_BACK, (m, e) -> openChallengeAchievementsMenu(player, gameMode));
menu.setItem(4, 5, MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
use of com.ebicep.warlords.game.GameMode in project Warlords by ebicep.
the class AchievementsMenu method openTieredAchievementsMenu.
public static void openTieredAchievementsMenu(Player player, GameMode gameMode) {
if (DatabaseManager.playerService == null)
return;
DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
List<TieredAchievements> achievementRecords = databasePlayer.getAchievements().stream().filter(abstractAchievementRecord -> abstractAchievementRecord.getAchievement() instanceof TieredAchievements).map(Achievement.AbstractAchievementRecord::getAchievement).map(TieredAchievements.class::cast).collect(Collectors.toList());
List<TieredAchievements> tieredAchievements = Arrays.stream(TieredAchievements.values()).filter(achievements -> achievements.gameMode == gameMode).collect(Collectors.toList());
Menu menu = new Menu("Challenge Achievements - " + gameMode.name, 9 * 6);
int x = 0;
int y = 0;
for (TieredAchievements achievement : tieredAchievements) {
boolean hasAchievement = achievementRecords.stream().anyMatch(achievements -> achievements == achievement);
ItemBuilder itemBuilder = new ItemBuilder(hasAchievement ? Warlords.getHead(UUID.fromString("9f2b2230-3b2c-4b0f-a141-d7b598e236c7")) : Warlords.getHead(UUID.fromString("70b6981a-6ae8-4e76-8aeb-0fcd510f4be7"))).name(// + " - " + (achievement.spec.name == null ? "General" : achievement.spec.name))
ChatColor.GREEN + achievement.name).lore(ChatColor.WHITE + WordWrap.wrapWithNewline(achievement.description, 200) + (hasAchievement ? "\n\n" + ChatColor.GREEN + "Unlocked!" : "")).flags(ItemFlag.HIDE_ENCHANTS);
if (hasAchievement) {
itemBuilder.enchant(Enchantment.OXYGEN, 1);
}
menu.setItem(x, y, itemBuilder.get(), (m, e) -> openTieredAchievementHistoryMenu(player, gameMode, achievement));
x++;
if (x == 9) {
x = 0;
y++;
}
}
menu.setItem(3, 5, MENU_BACK, (m, e) -> openAchievementsMenu(player));
menu.setItem(4, 5, MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
use of com.ebicep.warlords.game.GameMode in project Warlords by ebicep.
the class AchievementsMenu method openChallengeAchievementsMenu.
public static void openChallengeAchievementsMenu(Player player, GameMode gameMode) {
if (DatabaseManager.playerService == null)
return;
DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
List<ChallengeAchievements> achievementRecords = databasePlayer.getAchievements().stream().filter(abstractAchievementRecord -> abstractAchievementRecord.getAchievement() instanceof ChallengeAchievements).map(Achievement.AbstractAchievementRecord::getAchievement).map(ChallengeAchievements.class::cast).collect(Collectors.toList());
List<ChallengeAchievements> challengeAchievements = Arrays.stream(ChallengeAchievements.values()).filter(achievements -> achievements.gameMode == gameMode).collect(Collectors.toList());
Menu menu = new Menu("Challenge Achievements", 9 * 6);
int x = 0;
int y = 0;
for (ChallengeAchievements achievement : challengeAchievements) {
boolean hasAchievement = achievementRecords.stream().anyMatch(achievements -> achievements == achievement);
ItemBuilder itemBuilder = new ItemBuilder(hasAchievement ? Warlords.getHead(UUID.fromString("9f2b2230-3b2c-4b0f-a141-d7b598e236c7")) : Warlords.getHead(UUID.fromString("70b6981a-6ae8-4e76-8aeb-0fcd510f4be7"))).name(ChatColor.GREEN + achievement.name + " - " + (achievement.spec == null ? "General" : achievement.spec.name)).lore(ChatColor.WHITE + WordWrap.wrapWithNewline(achievement.description, 200) + (hasAchievement ? "\n\n" + ChatColor.GREEN + "Unlocked!" : "")).flags(ItemFlag.HIDE_ENCHANTS);
if (hasAchievement) {
itemBuilder.enchant(Enchantment.OXYGEN, 1);
}
menu.setItem(x, y, itemBuilder.get(), (m, e) -> openChallengeAchievementHistoryMenu(player, gameMode, achievement));
x++;
if (x == 9) {
x = 0;
y++;
}
}
menu.setItem(3, 5, MENU_BACK, (m, e) -> openAchievementsMenu(player));
menu.setItem(4, 5, MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
use of com.ebicep.warlords.game.GameMode in project Warlords by ebicep.
the class AchievementsMenu method openAchievementsMenu.
// GENERAL - CTF - TDM - GAMEMODE - GAMEMODE
// TIERED ACHIEVEMENTS - CHALLENGES
// ACHIEVEMENT HISTORY
public static void openAchievementsMenu(Player player) {
Menu menu = new Menu("Achievements", 9 * 6);
menu.setItem(1, 1, new ItemBuilder(Material.STONE_AXE).name(ChatColor.GREEN + "General").get(), (m, e) -> openAchievementTypeMenu(player, null));
for (int i = 0; i < GameMode.values().length; i++) {
GameMode gameMode = GameMode.values()[i];
if (gameMode.itemStack == null)
continue;
menu.setItem(i + 1, 1, new ItemBuilder(gameMode.itemStack).name(ChatColor.GREEN + gameMode.name).get(), (m, e) -> openAchievementTypeMenu(player, gameMode));
}
menu.setItem(4, 5, MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
use of com.ebicep.warlords.game.GameMode in project Warlords by ebicep.
the class AchievementsMenu method openTieredAchievementHistoryMenu.
public static void openTieredAchievementHistoryMenu(Player player, GameMode gameMode, TieredAchievements achievement) {
if (DatabaseManager.playerService == null)
return;
DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
List<TieredAchievements.TieredAchievementRecord> achievementRecords = databasePlayer.getAchievements().stream().filter(TieredAchievements.TieredAchievementRecord.class::isInstance).map(TieredAchievements.TieredAchievementRecord.class::cast).filter(t -> t.getAchievement() == achievement).collect(Collectors.toList());
Menu menu = new Menu("Achievement History", 9 * 6);
int x = 0;
int y = 0;
for (TieredAchievements.TieredAchievementRecord achievementRecord : achievementRecords) {
menu.setItem(x, y, new ItemBuilder(Material.BOOK).name(ChatColor.GREEN + achievement.name).lore(ChatColor.GRAY + DATE_FORMAT.format(achievementRecord.getDate())).get(), (m, e) -> {
});
x++;
if (x == 9) {
x = 0;
y++;
}
}
menu.setItem(3, 5, MENU_BACK, (m, e) -> openTieredAchievementsMenu(player, gameMode));
menu.setItem(4, 5, MENU_CLOSE, ACTION_CLOSE_MENU);
menu.openForPlayer(player);
}
Aggregations