Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#125 enhance parse moderator event to include player names #134

Conversation

magge-faf
Copy link
Contributor

This PR addresses issue #133 by adding the player name to the moderator parser

Outlined Steps:

  1. Renamed fromInt to fromArmy to align with the naming convention used in method parseGiveResourcesToPlayer. This makes it more readable when working with the armies object.
  2. Set default values for playerNameFromArmy and playerNameFromCommandSource.
  3. Retrieved playerNameFromArmy from the armies object (similar to parseGiveResourcesToPlayer).
  4. Retrieved playerNameFromCommandSource via activeCommandSource from the armies object.

This allows us to access the player names in Mordor like in the following image (I locally imported the faf-java-commons into Mordor and tested the output):

Click to reveal images about the output

image

image

@Garanas, the next step would be to bring those events officially to Mordor as seen in the image - I will raise an issue there later/tomorrow. Code is already in the pipeline.

Thanks in advance for your code review @Brutus5000, @Garanas, @Sheikah45

Fixes #133

@Sheikah45
Copy link
Member

Gotta fix conflicts though

Changes include renaming 'fromInt' to 'fromArmy', setting default values for player names, and player name retrieval from 'armies' object'.
@magge-faf magge-faf force-pushed the feature/#125-Enhance-parseModeratorEvent-to-Include-Player-Names branch from bc3b94d to a39e372 Compare April 13, 2024 18:12
@magge-faf
Copy link
Contributor Author

My bad, fork was not in sync and somehow made a mess with the following rebase. I recreated the #125 branch based on the synced develop branch from FAF - This should resolve it, shouldn't?

Copy link
Member

@Garanas Garanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small steps but great progress 👍 , this looks good!

@magge-faf
Copy link
Contributor Author

magge-faf commented Apr 19, 2024

Eh, I changed activeCommandSource by accident as well. I will revert that.

Edit: Or was it wrong, tho? @Garanas Can you confirm if -1 or -2 for activeCommandSource?

@Garanas
Copy link
Member

Garanas commented Apr 19, 2024

I don't think the default value matters, it should always be defined. Observers can not enable the command source, so a value of -1 is not possible. But if you want to be sure-sure, then take a default value of -2

@magge-faf
Copy link
Contributor Author

Thanks for clarification. -2 it is.

@Sheikah45
Copy link
Member

I would make the command source nullable as well for similar reasons the strings were null for the default values. It is better to not have magic numbers when null can do.

@magge-faf
Copy link
Contributor Author

@Sheikah45 Shouldn't we make fromArmy null as well because of similar default reasons, then?

@Sheikah45
Copy link
Member

I would think so yes

…ll check for army related to playerNameFromCommandSource
@magge-faf
Copy link
Contributor Author

Thanks for the insights. Additionally, I have thrown in another null check in case

Map<String, Object> army = armies.get(activeCommandSource); is null before accessing playerNameFromCommandSource - have done the same for playerNameFromArmy

@Sheikah45
Copy link
Member

@magge-faf Sorry kinda of forgot about this. Is this in a good place for you?

@magge-faf
Copy link
Contributor Author

Yes, the PR is finished for me. Don't sweat about it, I know how busy you are with far more important stuff.

I would have made a reminder-ping about this PR in a few days. It wasn't affecting my work in Mordor so far, because I can simply import the changes locally.

@Sheikah45 Sheikah45 merged commit e904344 into FAForever:develop May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance parseModeratorEvent to Include Player Names
4 participants