Skip to content

Commit

Permalink
Refactor 'parseModeratorEvent' with 'player' as 'activeCommandSource' (
Browse files Browse the repository at this point in the history
  • Loading branch information
magge-faf authored and Brutus5000 committed Apr 1, 2024
1 parent 6e46109 commit 804e4e9
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private void parseTicks(LittleEndianDataInputStream dataStream) throws IOExcepti
}

if (Objects.equals("ModeratorEvent", functionName)) {
parseModeratorEvent((Map<String, Object>) lua);
parseModeratorEvent((Map<String, Object>) lua, player);
}

// No idea what this skips
Expand Down Expand Up @@ -378,13 +378,10 @@ private void parseGiveResourcesToPlayer(Map<String, Object> lua) {
}


void parseModeratorEvent(Map<String, Object> lua) {
void parseModeratorEvent(Map<String, Object> lua, Integer player) {
String messageContent = (String) lua.get("Message");
int fromInt = ((Number) lua.get("From")).intValue();
int activeCommandSource = 0; // activeCommandSource is not available in .fafreplay, yet
if (lua.containsKey("activeCommandSource")) {
activeCommandSource = ((Number) lua.get("activeCommandSource")).intValue();
}
int activeCommandSource = player;
moderatorEvents.add(new ModeratorEvent(tickToTime(ticks), Integer.toString(fromInt), messageContent, activeCommandSource));
}

Expand Down

0 comments on commit 804e4e9

Please sign in to comment.