From db70d06dc418ec2c5b5989fd65cf6bcf27994e0e Mon Sep 17 00:00:00 2001 From: sclement Date: Thu, 28 Dec 2023 16:53:22 +0100 Subject: [PATCH] Do everything in one command --- .../net/Broken/Tools/AutoVoiceChannel.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/Broken/Tools/AutoVoiceChannel.java b/src/main/java/net/Broken/Tools/AutoVoiceChannel.java index b5b90d4..90cfb80 100644 --- a/src/main/java/net/Broken/Tools/AutoVoiceChannel.java +++ b/src/main/java/net/Broken/Tools/AutoVoiceChannel.java @@ -41,20 +41,18 @@ public class AutoVoiceChannel { GuildPreferenceEntity pref = SettingsUtils.getInstance().getPreference(guild); if (pref.isAutoVoice() && voiceChannel.getId().equals(pref.getAutoVoiceChannelID())) { logger.info("Creating new voice channel for Guild : {}", guild.getName()); - voiceChannel.createCopy().queue(newChannel -> { - int next = getNextNumber(); - String title = pref.getAutoVoiceChannelTitle(); - if (title.isEmpty()) { - title = "Voice @count"; - } - - title = title.replace("@count", Integer.toString(next)); - newChannel.getManager().setName(title).queue(t -> { - // moveMembers(voiceChannel.getMembers(), (AudioChannel) newChannel); - createdChannels.put(next, newChannel.getId()); - }); + int next = getNextNumber(); + String title = pref.getAutoVoiceChannelTitle(); + if (title.isEmpty()) { + title = "Voice @count"; + } + title = title.replace("@count", Integer.toString(next)); + voiceChannel.createCopy().setName(title).setPosition(voiceChannel.getPosition()).queue(newChannel -> { + moveMembers(voiceChannel.getMembers(), (AudioChannel) newChannel); + createdChannels.put(next, newChannel.getId()); }); } + } public void leave(AudioChannel voiceChannel) {