Skip to content

Commit

Permalink
sort options before sending them
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Nov 25, 2024
1 parent 96a5a3b commit b032d29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ authors=ModFest
contributors=Prospector, Sisby folk, acikek
license=MIT
# Mod Version
baseVersion=0.4.2
baseVersion=0.4.3
# Branch Metadata
branch=1.21
tagBranch=1.21
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/modfest/ballotbox/BallotBoxNetworking.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.modfest.ballotbox.packet.S2CVoteScreenData;

import java.util.ArrayList;
import java.util.Map;

public class BallotBoxNetworking {
public static void init() {
Expand All @@ -26,7 +27,7 @@ public static void init() {

public static void sendVoteScreenData(ServerPlayerEntity player) {
if (!BallotBox.isOpen()) return;
BallotBoxPlatformClient.getSelections(player.getUuid()).thenAccept(selections -> ServerPlayNetworking.send(player, new S2CVoteScreenData(new ArrayList<>(BallotBoxPlatformClient.categories.values()), new ArrayList<>(BallotBoxPlatformClient.options.values()), selections)));
BallotBoxPlatformClient.getSelections(player.getUuid()).thenAccept(selections -> ServerPlayNetworking.send(player, new S2CVoteScreenData(new ArrayList<>(BallotBoxPlatformClient.categories.values()), new ArrayList<>(BallotBoxPlatformClient.options.entrySet().stream().sorted(Map.Entry.comparingByKey()).map(Map.Entry::getValue).toList()), selections)));
}

private static void handleOpenVoteScreen(OpenVoteScreen packet, ServerPlayNetworking.Context context) {
Expand Down

0 comments on commit b032d29

Please sign in to comment.