13
0

Add count to gui
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-04-06 23:22:15 +02:00
Ursprung 02407e6e88
Commit 27326b43de
3 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -112,7 +112,7 @@ DIFFICULTY_HARD = §cHard
DIFFICULTY_EXTREME = §5Extreme DIFFICULTY_EXTREME = §5Extreme
DIFFICULTY_ADVANCED = §5Advanced 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_ALL = §eAll
EASTER_EGG_SELECTION_FOUND = §aFound EASTER_EGG_SELECTION_FOUND = §aFound

Datei anzeigen

@ -106,7 +106,7 @@ DIFFICULTY_HARD = §cHart
DIFFICULTY_EXTREME = §5Extrem DIFFICULTY_EXTREME = §5Extrem
DIFFICULTY_ADVANCED = §5Advanced 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_ALL = §eAlle
EASTER_EGG_SELECTION_FOUND = §aGefunden EASTER_EGG_SELECTION_FOUND = §aGefunden

Datei anzeigen

@ -24,10 +24,12 @@ public class EggHuntCommand extends SWCommand {
public void genericCommand(Player player, @OptionalValue("ALL") Selection selection) { public void genericCommand(Player player, @OptionalValue("ALL") Selection selection) {
AtomicInteger atomicInteger = new AtomicInteger(); AtomicInteger atomicInteger = new AtomicInteger();
String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY); String found = UserConfig.getConfig(player.getUniqueId(), EggHunt.EGG_HUNT_CONFIG_KEY);
AtomicInteger foundCount = new AtomicInteger();
List<SWListInv.SWListEntry<Egg>> entries = EggHunt.getEggList().stream() List<SWListInv.SWListEntry<Egg>> entries = EggHunt.getEggList().stream()
.map(egg -> { .map(egg -> {
int index = atomicInteger.getAndIncrement(); int index = atomicInteger.getAndIncrement();
boolean isFound = found != null && found.length() > index && found.charAt(index) == '1'; 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.FOUND && !isFound) return null;
if (selection == Selection.NOT_FOUND && isFound) return null; if (selection == Selection.NOT_FOUND && isFound) return null;
SWItem swItem = egg.getItem(player, isFound); SWItem swItem = egg.getItem(player, isFound);
@ -37,7 +39,7 @@ public class EggHuntCommand extends SWCommand {
.filter(Objects::nonNull) .filter(Objects::nonNull)
.sorted(Comparator.comparing(eggSWListEntry -> eggSWListEntry.getObject().getDifficulty())) .sorted(Comparator.comparing(eggSWListEntry -> eggSWListEntry.getObject().getDifficulty()))
.collect(Collectors.toList()); .collect(Collectors.toList());
SWListInv<Egg> inv = new SWListInv<>(player, LobbySystem.getMessage().parse("EASTER_EGG_MENU", player), false, entries, (clickType, egg) -> { SWListInv<Egg> 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 -> { 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); genericCommand(player, Selection.ALL);