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

Since 'abilities' is of type 'ImmutableMap', it cannot be added dynamically #1294

Open
Aiden-777 opened this issue Dec 21, 2023 · 1 comment
Labels
Abilities Bugs related to abilities module enhancement

Comments

@Aiden-777
Copy link

abilities = Stream.concat(defaultAbsStream,
extensions.stream()
.flatMap(ext -> stream(ext.getClass().getMethods())
.filter(checkReturnType(Ability.class))
.map(returnAbility(ext))))
// Abilities are immutable, build it respectively
.collect(ImmutableMap::<String, Ability>builder,
(b, a) -> b.put(a.name(), a),
(b1, b2) -> b1.putAll(b2.build()))
.build();

@Haarolean
Copy link

I guess it's on purpose. But the bigger question I have is why is this collected via reflection at all rather than implementing a method like Set<Ability> getAbilities in the BaseAbilityBot interface.

@rubenlagus rubenlagus added enhancement Abilities Bugs related to abilities module labels Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abilities Bugs related to abilities module enhancement
Projects
None yet
Development

No branches or pull requests

3 participants