Skip to content

Commit

Permalink
Simplify the parameters of retrieving the chat messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas committed Jun 3, 2024
1 parent 43fe277 commit b21e33d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static String getMapFolder (ReplayContainer replayContainer) throws Illeg
* @param events A list of events
* @return A list of events that are chat messages
*/
public static List<ChatMessage> getChatMessages(List<Source> sources, List<RegisteredEvent> events) {
public static List<ChatMessage> getChatMessages(List<RegisteredEvent> events) {
return events.stream().map((registeredEvent) -> switch (registeredEvent.event()) {

// TODO: the fact that we piggy-back on the 'GiveResourcesToPlayer' callback to embed chat messages is all wrong! We should instead introduce an alternative callback with the sole purpose to send messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void parseBinary01() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("neroxis_map_generator_1.11.0_wvmzfgnlgiebu_bqgaeb3bgzldwstbaa", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(106, chatMessages.size());
}
);
Expand All @@ -63,7 +63,7 @@ public void parseBinary02() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_039", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(2, chatMessages.size());
}
);
Expand All @@ -81,7 +81,7 @@ public void parseBinary03() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("dualgap_fix_adaptive.v0007", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(1, chatMessages.size());
}
);
Expand All @@ -99,7 +99,7 @@ public void parseBinary04() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_009", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(7, chatMessages.size());
}
);
Expand All @@ -117,7 +117,7 @@ public void parseBinary05() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(0, chatMessages.size());
}
);
Expand All @@ -135,7 +135,7 @@ public void parseBinary06() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(0, chatMessages.size());
}
);
Expand All @@ -153,7 +153,7 @@ public void parseBinary07() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(3, chatMessages.size());
}
);
Expand All @@ -178,7 +178,7 @@ public void parseBinary08() throws CompressorException, IOException {
assertNoErrorTokens(fafReplayContainer);
assertEquals("project_tumulus.v0004", ReplaySemantics.getMapFolder(fafReplayContainer));

List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents());
List<ChatMessage> chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents());
assertEquals(0, chatMessages.size());
}
);
Expand Down

0 comments on commit b21e33d

Please sign in to comment.