8000 Check objective visibility on displaying mode change messages by CoWinkKeyDinkInc · Pull Request #941 · PGMDev/PGM · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Check objective visibility on displaying mode change messages #941

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

Merged
merged 4 commits into from
Nov 25, 2021

Conversation

CoWinkKeyDinkInc
Copy link
Contributor

This PR fixes an ongoing issue that started strangely happening without any idea how. The mode change message in the chat would be repeated for each objective that changed mode, and would still appear even when the objective's show attribute is false. This adds a proper checker to make sure the mode message is only sent out once per mode change, and that it won't send the message if all objectives that use the mode has show=false. I first seen this yesterday when the message repeated 8 times on Death DeNile.

From the code this issue should've been a problem for a long time but has seemed to popup about two weeks ago 🤷‍♂️

Signed-off-by: Patrick <cowinkkeydinkinc@gmail.com>
Copy link
Member
@Pablete1234 Pablete1234 left a comment

Choose a reason for hiding this comment

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

Add a getAffectedObjectives or similar to the event, and use that on the event handler to find if any are non-hidden

Trying to iterate all objectives here is a mess

Alternatively you can add a boolean show field to the event, which the handler sets to true if any core/destroyable changed has show=true

Signed-off-by: Patrick <cowinkkeydinkinc@gmail.com>
Copy link
Member
@Pablete1234 Pablete1234 left a comment

Choose a reason for hiding this comment

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

https://github.com/PGMDev/PGM/blob/dev/core/src/main/java/tc/oc/pgm/destroyable/DestroyableMatchModule.java#L125

https://github.com/PGMDev/PGM/blob/dev/core/src/main/java/tc/oc/pgm/core/CoreMatchModule.java#L155

Edit both of those event handlers, make them HIGHEST priority instead of monitor, and make it so:
if (core.isVisible()) event.setVisible(true);, and similarly for monuments

Make ObjectiveModeEvent's visible non-final, and add the setVisible setter

Signed-off-by: Patrick <cowinkkeydinkinc@gmail.com>
Signed-off-by: Patrick <cowinkkeydinkinc@gmail.com>
Copy link
Member
@Pablete1234 Pablete1234 left a comment

Choose a reason for hiding this comment

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

Looks much cleaner now, nice work

@Electroid Electroid merged commit 0560918 into PGMDev:dev Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0