diff --git a/src/main/java/com/jagrosh/jmusicbot/JMusicBot.java b/src/main/java/com/jagrosh/jmusicbot/JMusicBot.java index f4dea7121..a32a51048 100644 --- a/src/main/java/com/jagrosh/jmusicbot/JMusicBot.java +++ b/src/main/java/com/jagrosh/jmusicbot/JMusicBot.java @@ -129,11 +129,12 @@ private static void startBot() new VolumeCmd(bot), new PrefixCmd(bot), + new QueueTypeCmd(bot), new SetdjCmd(bot), new SkipratioCmd(bot), new SettcCmd(bot), new SetvcCmd(bot), - + new AutoplaylistCmd(bot), new DebugCmd(bot), new PlaylistCmd(bot), diff --git a/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java b/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java index 8878b4166..310389dbe 100644 --- a/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java +++ b/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java @@ -16,6 +16,8 @@ package com.jagrosh.jmusicbot.audio; import com.jagrosh.jmusicbot.playlist.PlaylistLoader.Playlist; +import com.jagrosh.jmusicbot.queue.AbstractQueue; +import com.jagrosh.jmusicbot.settings.QueueType; import com.jagrosh.jmusicbot.settings.RepeatMode; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter; @@ -26,7 +28,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import com.jagrosh.jmusicbot.queue.FairQueue; import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.utils.FormatUtil; import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack; @@ -48,8 +49,7 @@ public class AudioHandler extends AudioEventAdapter implements AudioSendHandler public final static String PLAY_EMOJI = "\u25B6"; // ▶ public final static String PAUSE_EMOJI = "\u23F8"; // ⏸ public final static String STOP_EMOJI = "\u23F9"; // ⏹ - - private final FairQueue queue = new FairQueue<>(); + private final List defaultQueue = new LinkedList<>(); private final Set votes = new HashSet<>(); @@ -58,12 +58,20 @@ public class AudioHandler extends AudioEventAdapter implements AudioSendHandler private final long guildId; private AudioFrame lastFrame; + private AbstractQueue queue; protected AudioHandler(PlayerManager manager, Guild guild, AudioPlayer player) { this.manager = manager; this.audioPlayer = player; this.guildId = guild.getIdLong(); + + this.setQueueType(manager.getBot().getSettingsManager().getSettings(guildId).getQueueType()); + } + + public void setQueueType(QueueType type) + { + queue = type.createInstance(queue); } public int addTrackToFront(QueuedTrack qtrack) @@ -91,7 +99,7 @@ public int addTrack(QueuedTrack qtrack) return queue.add(qtrack); } - public FairQueue getQueue() + public AbstractQueue getQueue() { return queue; } diff --git a/src/main/java/com/jagrosh/jmusicbot/commands/admin/QueueTypeCmd.java b/src/main/java/com/jagrosh/jmusicbot/commands/admin/QueueTypeCmd.java new file mode 100644 index 000000000..798e620e6 --- /dev/null +++ b/src/main/java/com/jagrosh/jmusicbot/commands/admin/QueueTypeCmd.java @@ -0,0 +1,75 @@ +/* + * Copyright 2022 John Grosh . + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jmusicbot.commands.admin; + +import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jmusicbot.Bot; +import com.jagrosh.jmusicbot.audio.AudioHandler; +import com.jagrosh.jmusicbot.commands.AdminCommand; +import com.jagrosh.jmusicbot.settings.QueueType; +import com.jagrosh.jmusicbot.settings.Settings; + +/** + * + * @author Wolfgang Schwendtbauer + */ +public class QueueTypeCmd extends AdminCommand +{ + public QueueTypeCmd(Bot bot) + { + super(); + this.name = "queuetype"; + this.help = "changes the queue type"; + this.arguments = "[" + String.join("|", QueueType.getNames()) + "]"; + this.aliases = bot.getConfig().getAliases(this.name); + } + + @Override + protected void execute(CommandEvent event) + { + String args = event.getArgs(); + QueueType value; + Settings settings = event.getClient().getSettingsFor(event.getGuild()); + + if (args.isEmpty()) + { + QueueType currentType = settings.getQueueType(); + event.reply(currentType.getEmoji() + " Current queue type is: `" + currentType.getUserFriendlyName() + "`."); + return; + } + + try + { + value = QueueType.valueOf(args.toUpperCase()); + } + catch (IllegalArgumentException e) + { + event.replyError("Invalid queue type. Valid types are: [" + String.join("|", QueueType.getNames()) + "]"); + return; + } + + if (settings.getQueueType() != value) + { + settings.setQueueType(value); + + AudioHandler handler = (AudioHandler) event.getGuild().getAudioManager().getSendingHandler(); + if (handler != null) + handler.setQueueType(value); + } + + event.reply(value.getEmoji() + " Queue type was set to `" + value.getUserFriendlyName() + "`."); + } +} diff --git a/src/main/java/com/jagrosh/jmusicbot/commands/dj/MoveTrackCmd.java b/src/main/java/com/jagrosh/jmusicbot/commands/dj/MoveTrackCmd.java index 7c652f903..9199be01d 100644 --- a/src/main/java/com/jagrosh/jmusicbot/commands/dj/MoveTrackCmd.java +++ b/src/main/java/com/jagrosh/jmusicbot/commands/dj/MoveTrackCmd.java @@ -6,7 +6,7 @@ import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.QueuedTrack; import com.jagrosh.jmusicbot.commands.DJCommand; -import com.jagrosh.jmusicbot.queue.FairQueue; +import com.jagrosh.jmusicbot.queue.AbstractQueue; /** * Command that provides users the ability to move a track in the playlist. @@ -57,7 +57,7 @@ public void doCommand(CommandEvent event) // Validate that from and to are available AudioHandler handler = (AudioHandler) event.getGuild().getAudioManager().getSendingHandler(); - FairQueue queue = handler.getQueue(); + AbstractQueue queue = handler.getQueue(); if (isUnavailablePosition(queue, from)) { String reply = String.format("`%d` is not a valid position in the queue!", from); @@ -78,7 +78,7 @@ public void doCommand(CommandEvent event) event.replySuccess(reply); } - private static boolean isUnavailablePosition(FairQueue queue, int position) + private static boolean isUnavailablePosition(AbstractQueue queue, int position) { return (position < 1 || position > queue.size()); } diff --git a/src/main/java/com/jagrosh/jmusicbot/commands/general/SettingsCmd.java b/src/main/java/com/jagrosh/jmusicbot/commands/general/SettingsCmd.java index 94c411d88..a01398308 100644 --- a/src/main/java/com/jagrosh/jmusicbot/commands/general/SettingsCmd.java +++ b/src/main/java/com/jagrosh/jmusicbot/commands/general/SettingsCmd.java @@ -18,6 +18,7 @@ import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jmusicbot.Bot; +import com.jagrosh.jmusicbot.settings.QueueType; import com.jagrosh.jmusicbot.settings.RepeatMode; import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.utils.FormatUtil; @@ -63,6 +64,9 @@ protected void execute(CommandEvent event) + "\nRepeat Mode: " + (s.getRepeatMode() == RepeatMode.OFF ? s.getRepeatMode().getUserFriendlyName() : "**"+s.getRepeatMode().getUserFriendlyName()+"**") + + "\nQueue Type: " + (s.getQueueType() == QueueType.FAIR + ? s.getQueueType().getUserFriendlyName() + : "**"+s.getQueueType().getUserFriendlyName()+"**") + "\nDefault Playlist: " + (s.getDefaultPlaylist() == null ? "None" : "**" + s.getDefaultPlaylist() + "**") ) .setFooter(event.getJDA().getGuilds().size() + " servers | " diff --git a/src/main/java/com/jagrosh/jmusicbot/commands/music/QueueCmd.java b/src/main/java/com/jagrosh/jmusicbot/commands/music/QueueCmd.java index 475d27410..2b18aaf4f 100644 --- a/src/main/java/com/jagrosh/jmusicbot/commands/music/QueueCmd.java +++ b/src/main/java/com/jagrosh/jmusicbot/commands/music/QueueCmd.java @@ -20,10 +20,10 @@ import com.jagrosh.jdautilities.command.CommandEvent; import com.jagrosh.jdautilities.menu.Paginator; import com.jagrosh.jmusicbot.Bot; -import com.jagrosh.jmusicbot.JMusicBot; import com.jagrosh.jmusicbot.audio.AudioHandler; import com.jagrosh.jmusicbot.audio.QueuedTrack; import com.jagrosh.jmusicbot.commands.MusicCommand; +import com.jagrosh.jmusicbot.settings.QueueType; import com.jagrosh.jmusicbot.settings.RepeatMode; import com.jagrosh.jmusicbot.settings.Settings; import com.jagrosh.jmusicbot.utils.FormatUtil; @@ -95,7 +95,7 @@ public void doCommand(CommandEvent event) } Settings settings = event.getClient().getSettingsFor(event.getGuild()); long fintotal = total; - builder.setText((i1,i2) -> getQueueTitle(ah, event.getClient().getSuccess(), songs.length, fintotal, settings.getRepeatMode())) + builder.setText((i1,i2) -> getQueueTitle(ah, event.getClient().getSuccess(), songs.length, fintotal, settings.getRepeatMode(), settings.getQueueType())) .setItems(songs) .setUsers(event.getAuthor()) .setColor(event.getSelfMember().getColor()) @@ -103,7 +103,7 @@ public void doCommand(CommandEvent event) builder.build().paginate(event.getChannel(), pagenum); } - private String getQueueTitle(AudioHandler ah, String success, int songslength, long total, RepeatMode repeatmode) + private String getQueueTitle(AudioHandler ah, String success, int songslength, long total, RepeatMode repeatmode, QueueType queueType) { StringBuilder sb = new StringBuilder(); if(ah.getPlayer().getPlayingTrack()!=null) @@ -113,6 +113,7 @@ private String getQueueTitle(AudioHandler ah, String success, int songslength, l } return FormatUtil.filter(sb.append(success).append(" Current Queue | ").append(songslength) .append(" entries | `").append(FormatUtil.formatTime(total)).append("` ") - .append(repeatmode.getEmoji() != null ? "| "+repeatmode.getEmoji() : "").toString()); + .append("| ").append(queueType.getEmoji()).append(" `").append(queueType.getUserFriendlyName()).append('`') + .append(repeatmode.getEmoji() != null ? " | "+repeatmode.getEmoji() : "").toString()); } } diff --git a/src/main/java/com/jagrosh/jmusicbot/queue/AbstractQueue.java b/src/main/java/com/jagrosh/jmusicbot/queue/AbstractQueue.java new file mode 100644 index 000000000..0d3b06705 --- /dev/null +++ b/src/main/java/com/jagrosh/jmusicbot/queue/AbstractQueue.java @@ -0,0 +1,130 @@ +/* + * Copyright 2022 John Grosh (jagrosh). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jmusicbot.queue; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * + * @author Wolfgang Schwendtbauer + * @param + */ +public abstract class AbstractQueue +{ + protected AbstractQueue(AbstractQueue queue) + { + this.list = queue != null ? queue.getList() : new LinkedList<>(); + } + + protected final List list; + + public abstract int add(T item); + + public void addAt(int index, T item) + { + if(index >= list.size()) + list.add(item); + else + list.add(index, item); + } + + public int size() { + return list.size(); + } + + public T pull() { + return list.remove(0); + } + + public boolean isEmpty() + { + return list.isEmpty(); + } + + public List getList() + { + return list; + } + + public T get(int index) { + return list.get(index); + } + + public T remove(int index) + { + return list.remove(index); + } + + public int removeAll(long identifier) + { + int count = 0; + for(int i=list.size()-1; i>=0; i--) + { + if(list.get(i).getIdentifier()==identifier) + { + list.remove(i); + count++; + } + } + return count; + } + + public void clear() + { + list.clear(); + } + + public int shuffle(long identifier) + { + List iset = new ArrayList<>(); + for(int i=0; i 0) { + list.subList(0, number).clear(); + } + } + + /** + * Move an item to a different position in the list + * @param from The position of the item + * @param to The new position of the item + * @return the moved item + */ + public T moveItem(int from, int to) + { + T item = list.remove(from); + list.add(to, item); + return item; + } +} diff --git a/src/main/java/com/jagrosh/jmusicbot/queue/FairQueue.java b/src/main/java/com/jagrosh/jmusicbot/queue/FairQueue.java index b19eb44c2..2c79d1095 100644 --- a/src/main/java/com/jagrosh/jmusicbot/queue/FairQueue.java +++ b/src/main/java/com/jagrosh/jmusicbot/queue/FairQueue.java @@ -15,9 +15,7 @@ */ package com.jagrosh.jmusicbot.queue; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import java.util.Set; /** @@ -25,11 +23,16 @@ * @author John Grosh (jagrosh) * @param */ -public class FairQueue +public class FairQueue extends AbstractQueue { - private final List list = new ArrayList<>(); - private final Set set = new HashSet<>(); - + public FairQueue(AbstractQueue queue) + { + super(queue); + } + + protected final Set set = new HashSet<>(); + + @Override public int add(T item) { int lastIndex; @@ -47,99 +50,5 @@ public int add(T item) list.add(lastIndex, item); return lastIndex; } - - public void addAt(int index, T item) - { - if(index >= list.size()) - list.add(item); - else - list.add(index, item); - } - - public int size() - { - return list.size(); - } - - public T pull() - { - return list.remove(0); - } - - public boolean isEmpty() - { - return list.isEmpty(); - } - - public List getList() - { - return list; - } - - public T get(int index) - { - return list.get(index); - } - - public T remove(int index) - { - return list.remove(index); - } - - public int removeAll(long identifier) - { - int count = 0; - for(int i=list.size()-1; i>=0; i--) - { - if(list.get(i).getIdentifier()==identifier) - { - list.remove(i); - count++; - } - } - return count; - } - - public void clear() - { - list.clear(); - } - - public int shuffle(long identifier) - { - List iset = new ArrayList<>(); - for(int i=0; i + */ +public class LinearQueue extends AbstractQueue +{ + public LinearQueue(AbstractQueue queue) + { + super(queue); + } + + @Override + public int add(T item) + { + list.add(item); + return list.size() - 1; + } + +} diff --git a/src/main/java/com/jagrosh/jmusicbot/queue/QueueSupplier.java b/src/main/java/com/jagrosh/jmusicbot/queue/QueueSupplier.java new file mode 100644 index 000000000..06ac52b46 --- /dev/null +++ b/src/main/java/com/jagrosh/jmusicbot/queue/QueueSupplier.java @@ -0,0 +1,26 @@ +/* + * Copyright 2022 John Grosh . + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jmusicbot.queue; + +/** + * + * @author Wolfgang Schwendtbauer + */ +@FunctionalInterface +public interface QueueSupplier +{ + AbstractQueue apply(AbstractQueue queue); +} diff --git a/src/main/java/com/jagrosh/jmusicbot/settings/QueueType.java b/src/main/java/com/jagrosh/jmusicbot/settings/QueueType.java new file mode 100644 index 000000000..1f1404fdd --- /dev/null +++ b/src/main/java/com/jagrosh/jmusicbot/settings/QueueType.java @@ -0,0 +1,69 @@ +/* + * Copyright 2022 John Grosh . + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jmusicbot.settings; + +import com.jagrosh.jmusicbot.queue.AbstractQueue; +import com.jagrosh.jmusicbot.queue.FairQueue; +import com.jagrosh.jmusicbot.queue.LinearQueue; +import com.jagrosh.jmusicbot.queue.Queueable; +import com.jagrosh.jmusicbot.queue.QueueSupplier; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * + * @author Wolfgang Schwendtbauer + */ +public enum QueueType +{ + LINEAR("\u23E9", "Linear", LinearQueue::new), // ⏩ + FAIR("\uD83D\uDD22", "Fair", FairQueue::new); // 🔢 + + private final String userFriendlyName; + private final String emoji; + private final QueueSupplier supplier; + + QueueType(final String emoji, final String userFriendlyName, QueueSupplier supplier) + { + this.userFriendlyName = userFriendlyName; + this.emoji = emoji; + this.supplier = supplier; + } + + public static List getNames() + { + return Arrays.stream(QueueType.values()) + .map(type -> type.name().toLowerCase()) + .collect(Collectors.toList()); + } + + public AbstractQueue createInstance(AbstractQueue previous) + { + return supplier.apply(previous); + } + + public String getUserFriendlyName() + { + return userFriendlyName; + } + + public String getEmoji() + { + return emoji; + } +} diff --git a/src/main/java/com/jagrosh/jmusicbot/settings/Settings.java b/src/main/java/com/jagrosh/jmusicbot/settings/Settings.java index 6f1ea6879..d9fb84545 100644 --- a/src/main/java/com/jagrosh/jmusicbot/settings/Settings.java +++ b/src/main/java/com/jagrosh/jmusicbot/settings/Settings.java @@ -36,10 +36,11 @@ public class Settings implements GuildSettingsProvider private int volume; private String defaultPlaylist; private RepeatMode repeatMode; + private QueueType queueType; private String prefix; private double skipRatio; - public Settings(SettingsManager manager, String textId, String voiceId, String roleId, int volume, String defaultPlaylist, RepeatMode repeatMode, String prefix, double skipRatio) + public Settings(SettingsManager manager, String textId, String voiceId, String roleId, int volume, String defaultPlaylist, RepeatMode repeatMode, String prefix, double skipRatio, QueueType queueType) { this.manager = manager; try @@ -71,9 +72,10 @@ public Settings(SettingsManager manager, String textId, String voiceId, String r this.repeatMode = repeatMode; this.prefix = prefix; this.skipRatio = skipRatio; + this.queueType = queueType; } - public Settings(SettingsManager manager, long textId, long voiceId, long roleId, int volume, String defaultPlaylist, RepeatMode repeatMode, String prefix, double skipRatio) + public Settings(SettingsManager manager, long textId, long voiceId, long roleId, int volume, String defaultPlaylist, RepeatMode repeatMode, String prefix, double skipRatio, QueueType queueType) { this.manager = manager; this.textId = textId; @@ -84,6 +86,7 @@ public Settings(SettingsManager manager, long textId, long voiceId, long roleId, this.repeatMode = repeatMode; this.prefix = prefix; this.skipRatio = skipRatio; + this.queueType = queueType; } // Getters @@ -127,6 +130,11 @@ public double getSkipRatio() return skipRatio; } + public QueueType getQueueType() + { + return queueType; + } + @Override public Collection getPrefixes() { @@ -181,4 +189,10 @@ public void setSkipRatio(double skipRatio) this.skipRatio = skipRatio; this.manager.writeSettings(); } + + public void setQueueType(QueueType queueType) + { + this.queueType = queueType; + this.manager.writeSettings(); + } } diff --git a/src/main/java/com/jagrosh/jmusicbot/settings/SettingsManager.java b/src/main/java/com/jagrosh/jmusicbot/settings/SettingsManager.java index 27a198b46..72f744c0e 100644 --- a/src/main/java/com/jagrosh/jmusicbot/settings/SettingsManager.java +++ b/src/main/java/com/jagrosh/jmusicbot/settings/SettingsManager.java @@ -32,14 +32,15 @@ */ public class SettingsManager implements GuildSettingsManager { + private final static String SETTINGS_FILE = "serversettings.json"; private final HashMap settings; public SettingsManager() { this.settings = new HashMap<>(); - + try { - JSONObject loadedSettings = new JSONObject(new String(Files.readAllBytes(OtherUtil.getPath("serversettings.json")))); + JSONObject loadedSettings = new JSONObject(new String(Files.readAllBytes(OtherUtil.getPath(SETTINGS_FILE)))); loadedSettings.keySet().forEach((id) -> { JSONObject o = loadedSettings.getJSONObject(id); @@ -56,7 +57,8 @@ public SettingsManager() o.has("default_playlist")? o.getString("default_playlist") : null, o.has("repeat_mode") ? o.getEnum(RepeatMode.class, "repeat_mode"): RepeatMode.OFF, o.has("prefix") ? o.getString("prefix") : null, - o.has("skip_ratio") ? o.getDouble("skip_ratio") : -1)); + o.has("skip_ratio") ? o.getDouble("skip_ratio") : -1, + o.has("queue_type") ? o.getEnum(QueueType.class, "queue_type") : QueueType.FAIR)); }); } catch (NoSuchFileException e) { // create an empty json file @@ -73,10 +75,10 @@ public SettingsManager() LoggerFactory.getLogger("Settings").info("serversettings.json loaded from " + OtherUtil.getPath("serversettings.json").toAbsolutePath()); } - + /** * Gets non-null settings for a Guild - * + * * @param guild the guild to get settings for * @return the existing settings, or new settings for that guild */ @@ -85,17 +87,17 @@ public Settings getSettings(Guild guild) { return getSettings(guild.getIdLong()); } - + public Settings getSettings(long guildId) { return settings.computeIfAbsent(guildId, id -> createDefaultSettings()); } - + private Settings createDefaultSettings() { - return new Settings(this, 0, 0, 0, 100, null, RepeatMode.OFF, null, -1); + return new Settings(this, 0, 0, 0, 100, null, RepeatMode.OFF, null, -1, QueueType.FAIR); } - + protected void writeSettings() { JSONObject obj = new JSONObject(); @@ -118,10 +120,12 @@ protected void writeSettings() o.put("prefix", s.getPrefix()); if(s.getSkipRatio() != -1) o.put("skip_ratio", s.getSkipRatio()); + if(s.getQueueType() != QueueType.FAIR) + o.put("queue_type", s.getQueueType().name()); obj.put(Long.toString(key), o); }); try { - Files.write(OtherUtil.getPath("serversettings.json"), obj.toString(4).getBytes()); + Files.write(OtherUtil.getPath(SETTINGS_FILE), obj.toString(4).getBytes()); } catch(IOException ex){ LoggerFactory.getLogger("Settings").warn("Failed to write to file: "+ex); } diff --git a/src/main/resources/reference.conf b/src/main/resources/reference.conf index e48403f54..5e6e4ac27 100644 --- a/src/main/resources/reference.conf +++ b/src/main/resources/reference.conf @@ -174,6 +174,7 @@ aliases { movetrack = [ move ] pause = [] playnext = [] + queuetype = [] repeat = [] skipto = [ jumpto ] stop = [ leave ] diff --git a/src/test/java/com/jagrosh/jmusicbot/FairQueueTest.java b/src/test/java/com/jagrosh/jmusicbot/FairQueueTest.java index 0cfda2272..3dbe6869b 100644 --- a/src/test/java/com/jagrosh/jmusicbot/FairQueueTest.java +++ b/src/test/java/com/jagrosh/jmusicbot/FairQueueTest.java @@ -29,7 +29,7 @@ public class FairQueueTest @Test public void differentIdentifierSize() { - FairQueue queue = new FairQueue<>(); + FairQueue queue = new FairQueue<>(null); int size = 100; for(int i=0; i queue = new FairQueue<>(); + FairQueue queue = new FairQueue<>(null); int size = 100; for(int i=0; i