From 27326b43dea926c6c20556f69cad08e750d357ec Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 6 Apr 2023 23:22:15 +0200 Subject: [PATCH] Add count to gui --- src/de/steamwar/lobby/LobbySystem.properties | 2 +- src/de/steamwar/lobby/LobbySystem_de.properties | 2 +- src/de/steamwar/lobby/special/easter/EggHuntCommand.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index f51e4e1..31a6d49 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -112,7 +112,7 @@ DIFFICULTY_HARD = §cHard DIFFICULTY_EXTREME = §5Extreme DIFFICULTY_ADVANCED = §5Advanced -EASTER_EGG_MENU = §0Easter Egg Hunt +EASTER_EGG_MENU = §0Easter Egg Hunt {0}/{1} EASTER_EGG_SELECTION_ALL = §eAll EASTER_EGG_SELECTION_FOUND = §aFound diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index c2a3225..fb31e07 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -106,7 +106,7 @@ DIFFICULTY_HARD = §cHart DIFFICULTY_EXTREME = §5Extrem DIFFICULTY_ADVANCED = §5Advanced -EASTER_EGG_MENU = §0Oster Eierer Suche +EASTER_EGG_MENU = §0Oster Eier Suche {0}/{1} EASTER_EGG_SELECTION_ALL = §eAlle EASTER_EGG_SELECTION_FOUND = §aGefunden diff --git a/src/de/steamwar/lobby/special/easter/EggHuntCommand.java b/src/de/steamwar/lobby/special/easter/EggHuntCommand.java index eeab79f..93597bf 100644 --- a/src/de/steamwar/lobby/special/easter/EggHuntCommand.java +++ b/src/de/steamwar/lobby/special/easter/EggHuntCommand.java @@ -24,10 +24,12 @@ public class EggHuntCommand extends SWCommand { public void genericCommand(Player player, @OptionalValue("ALL") Selection selection) { AtomicInteger atomicInteger = new AtomicInteger(); String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY); + AtomicInteger foundCount = new AtomicInteger(); List> entries = EggHunt.getEggList().stream() .map(egg -> { int index = atomicInteger.getAndIncrement(); boolean isFound = found != null && found.length() > index && found.charAt(index) == '1'; + if (isFound) foundCount.getAndIncrement(); if (selection == Selection.FOUND && !isFound) return null; if (selection == Selection.NOT_FOUND && isFound) return null; SWItem swItem = egg.getItem(player, isFound); @@ -37,7 +39,7 @@ public class EggHuntCommand extends SWCommand { .filter(Objects::nonNull) .sorted(Comparator.comparing(eggSWListEntry -> eggSWListEntry.getObject().getDifficulty())) .collect(Collectors.toList()); - SWListInv inv = new SWListInv<>(player, LobbySystem.getMessage().parse("EASTER_EGG_MENU", player), false, entries, (clickType, egg) -> { + SWListInv inv = new SWListInv<>(player, LobbySystem.getMessage().parse("EASTER_EGG_MENU", player, foundCount.get(), EggHunt.getEggList().size()), false, entries, (clickType, egg) -> { }); inv.setItem(49, new SWItem(SWItem.getDye(15), (byte) 15, LobbySystem.getMessage().parse(Selection.ALL.key, player), Collections.emptyList(), selection == Selection.ALL, clickType -> { genericCommand(player, Selection.ALL);