mirror of
https://github.com/chrisb09/MusicBot.git
synced 2026-11-05 17:02:35 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0912de74e9 | ||
|
|
3752e5b9e0 | ||
|
|
ae62d5771f | ||
|
|
434749a250 |
No files matched your search
@@ -22,5 +22,8 @@ Please see the [Setup Page](https://github.com/jagrosh/MusicBot/wiki/Setup) in t
|
||||
# Questions/Suggestions/Bug Reports
|
||||
If you'd like to suggest changes to how the bot functions, recommend more customization options, or report bugs, feel free to either open an [Issue](https://github.com/jagrosh/MusicBot/issues) on this repository, or join [my Discord server](https://discord.gg/0p9LSGoRLu6Pet0k). If you like this bot, be sure to add a star to the libraries that make this possible: [**JDA**](https://github.com/DV8FromTheWorld/JDA) and [**lavaplayer**](https://github.com/sedmelluq/lavaplayer)
|
||||
|
||||
# Editing
|
||||
This bot (and the source code here) is not meant to be edited. The main purpose of having the source public is to show the capabilities of the libraries, and to allow others to understand how the bot works. There are many requirements and dependencies required to edit and compile it, and there will not be support provided for people looking to make changes on their own. Instead, consider making a feature request (see the above section). If you still choose to make edits, please do so in accordance with the Apache 2.0 License.
|
||||
|
||||
# Example
|
||||

|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.jagrosh</groupId>
|
||||
<artifactId>JMusicBot</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<version>0.0.7</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<repositories>
|
||||
@@ -23,17 +23,17 @@
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>3.0.0_168</version>
|
||||
<version>3.1.1_219</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.2.36</version>
|
||||
<version>1.2.42</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jagrosh</groupId>
|
||||
<artifactId>JDA-Utilities</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
|
||||
@@ -32,11 +32,13 @@ public class Playlist {
|
||||
private final List<String> items;
|
||||
private List<AudioTrack> tracks;
|
||||
private List<PlaylistLoadError> errors;
|
||||
private final boolean shuffle;
|
||||
|
||||
private Playlist(String name, List<String> items)
|
||||
private Playlist(String name, List<String> items, boolean shuffle)
|
||||
{
|
||||
this.name = name;
|
||||
this.items = items;
|
||||
this.shuffle = shuffle;
|
||||
}
|
||||
|
||||
public void loadTracks(AudioPlayerManager manager, Consumer<AudioTrack> consumer, Runnable callback)
|
||||
@@ -74,8 +76,17 @@ public class Playlist {
|
||||
}
|
||||
else
|
||||
{
|
||||
tracks.addAll(ap.getTracks());
|
||||
ap.getTracks().forEach(at -> consumer.accept(at));
|
||||
List<AudioTrack> loaded = new ArrayList<>(ap.getTracks());
|
||||
if(shuffle)
|
||||
for(int first =0; first<loaded.size(); first++)
|
||||
{
|
||||
int second = (int)(Math.random()*loaded.size());
|
||||
AudioTrack tmp = loaded.get(first);
|
||||
loaded.set(first, loaded.get(second));
|
||||
loaded.set(second, tmp);
|
||||
}
|
||||
tracks.addAll(loaded);
|
||||
loaded.forEach(at -> consumer.accept(at));
|
||||
}
|
||||
if(last)
|
||||
{
|
||||
@@ -202,7 +213,7 @@ public class Playlist {
|
||||
list.set(second, tmp);
|
||||
}
|
||||
}
|
||||
return new Playlist(name, list);
|
||||
return new Playlist(name, list, shuffle[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user