-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
add LinearQueue #1194
add LinearQueue #1194
Conversation
If you'd like, join the support server if you need help and/or want to discuss of the implementation for queue types. You should be able to easily find me there (Michaili#1397). |
Agreed, I have adapted the PR accordingly |
src/main/java/com/jagrosh/jmusicbot/commands/dj/QueueTypeCmd.java
Outdated
Show resolved
Hide resolved
@@ -31,14 +31,15 @@ | |||
*/ | |||
public class SettingsManager implements GuildSettingsManager | |||
{ | |||
private final static String SETTINGS_FILE = "serversettings.json"; |
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.
Having this constant here is actually nice & fine I guess, albeit out of scope of this PR.
If we want to make this truly dynamic (which I kinda do), here is what I would do: 1. Create a supplier function for all the
|
Wow thanks for that answer, most of these things I already implemented earlier today ^^
|
As for 1. I'm not sure if I was clear, but the diff for - LINEAR("\u23E9", "Linear"),
+ LINEAR("\u23E9", "Linear", LinearQueue::new),
- FAIR("\uD83D\uDD22", "Fair");
+ FAIR("\uD83D\uDD22", "Fair", FairQueue::new);
private final String userFriendlyName;
private final String emoji;
+ private final Function<AbstractQueue<?>, ? extends AbstractQueue<?>> supplier;
- QueueType(final String emoji, final String userFriendlyName) {
+ QueueType(final String emoji, final String userFriendlyName, Function<AbstractQueue<?>, ? extends AbstractQueue<?>> supplier) {
this.userFriendlyName = userFriendlyName;
this.emoji = emoji;
+ this.supplier = supplier;
}
+ public AbstractQueue<?> createInstance(AbstractQueue<?> previousInstance)
+ {
+ return supplier.apply(previousInstance);
+ } |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
This looks pretty great now! There are just these nitpicks I have about this PR. Once these are resolved, this PR will reach perfection
src/main/java/com/jagrosh/jmusicbot/commands/dj/QueueTypeCmd.java
Outdated
Show resolved
Hide resolved
src/main/java/com/jagrosh/jmusicbot/commands/dj/QueueTypeCmd.java
Outdated
Show resolved
Hide resolved
src/main/java/com/jagrosh/jmusicbot/commands/dj/QueueTypeCmd.java
Outdated
Show resolved
Hide resolved
src/main/java/com/jagrosh/jmusicbot/commands/dj/QueueTypeCmd.java
Outdated
Show resolved
Hide resolved
Oh yeah, I almost forgot: You should add an entry to the + "\nQueue Type: " (s.getQueueType() == QueueType.FAIR
? s.getQueueType().getUserFriendlyName()
: "**"+s.getQueueType().getUserFriendlyName()+"**") (The fair queue check is there, in case it got changed from the default value. Settings that are changed from default are bold too.) Once the queue type is being displayed in the settings, this should be good to merge! |
One thing I just thought of: I added |
Having this as a DJ command seems the most ideal to me for now. jagrosh will take a look at the PR & optionally give his thoughts. |
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.
Hellooo! I just noticed i missed a few things that should change before this PR is perfect
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.
Looks good! @jagrosh should take a look & merge if all's good.
I would really like a linear queue feature with this please consider adding it thank you. |
Is there way to just add this to my own hosted version of the bot temporarily until it's officially merged (if that even happens)? |
You can basically just build the bot yourself with this feature included. If you need any help with that you can message me on Discord: Wolfgang#3620 |
…fe5/linear-queue # Conflicts: # src/main/java/com/jagrosh/jmusicbot/queue/FairQueue.java # src/main/java/com/jagrosh/jmusicbot/settings/SettingsManager.java
This pull request...
Description
This adds a new type of queue which maintinas the insertion order regardless of the user adding the song.
There is already a MR open about this issue #1165 but it seems to be stale.
Purpose
Personally we have a few designated music people on our discord who add songs in their prefered order but they always get mixed up due to
FairQueue
. The newly addedLinearQueue
would circumvent this problem.Relevant Issue(s)
closes #581