-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
Update DefaultShardManagerBuilder.java #1721
Update DefaultShardManagerBuilder.java #1721
Conversation
Changed access modifier to protected so we can extend the class to add / override some functionality
Is there a particular use case that would require the extending of the DefaultShardManagerBuilder? |
A custom builder |
@@ -95,7 +95,7 @@ | |||
protected ChunkingFilter chunkingFilter; | |||
protected MemberCachePolicy memberCachePolicy = MemberCachePolicy.ALL; | |||
|
|||
private DefaultShardManagerBuilder(@Nullable String token, int intents) | |||
protected DefaultShardManagerBuilder(@Nullable String token, int intents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to add a second constructor which accepts EnumSet<GatewayIntent>
instead of an int. This constructor can be used to set invalid intents which should not be allowed even by subclasses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you intend to let classes extend this, then methods like applyDefault
and applyLight
should also be changed to protected.
Changed access modifier for applyDefault and applyLight to protected
Changed the access modifier for the constructor back to private and added a new constructor taking an EnumSet<GatewayIntent> instead
Can you give me an example of how you would extend this class? |
I am trying to figure out how to prepare a ShardManager which allows to manually start individual shards (0 to n of m) without starting up all of them. |
I mean, give me an actual example implementation of a subclass. |
Oh my bad.
There probably is an easier solution to this. |
A possible workaround for this behaviour would be to tell jda only about the first shardid you would like to run and then call start(...) for all shardids beginning with the first one. |
I think it would be fine to update the shard manager to properly cater to the needs of dynamic clustering. A potential for empty shard managers that are dynamically populated is definitely there and could probably be implemented with no breaking changes. If someone wants to do those changes and make a separate pull request, that would be ideal. Your thoughts? |
That sounds to be the right solution. |
@Horstexplorer Are you planning to open a new PR for that functionality or create an Feature Request issue? |
Sure, I just did not manage to find time to do it properly yet. |
Changed access modifier to protected so we can extend the class to add / override some functionality
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
This pull request changes the access modifier of the DefaultShardManagerBuilder to protected to allow us to extend the class.