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

fix: make commandPrefixes non-final in builders #523

Merged
merged 1 commit into from Jan 29, 2022

Conversation

iProdigy
Copy link
Member

Prerequisites for Code Changes

  • This pull request follows the code style of the project
  • I have tested this feature

Issues Fixed

Since commandPrefixes as marked as final, it was not included in @AllArgsConstructor. As a result, @With calls were not copying this field to new instances. Thus, after calling withCommandTrigger, other builder withX calls would result in commandPrefixes being reset to an empty collection.

Changes Proposed

  • Make commandPrefixes non-final (so it is added to the builder private constructor)
  • Make commandPrefixes a Set in TwitchChatBuilder to avoid dupes (in TwitchChat it is stored as a List for faster iteration)
  • Use setCommandPrefixes to reduce collection operations (e.g. addAll)

Additional Information

Thanks to Hiya#3921 for reporting

@iProdigy iProdigy merged commit dd728b6 into develop Jan 29, 2022
@iProdigy iProdigy deleted the fix/command-prefix-builder branch January 29, 2022 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants