From fbd016c53dbf5bb01d85b0b78676eaccfebd8690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=BC=E3=82=AF=E3=83=AD?= Date: Mon, 11 Sep 2017 22:36:52 +0200 Subject: [PATCH] hotfixed moveall command --- broadcast_ignores.txt | 0 .../commands/guildAdministration/Moveall.java | 33 +++++++++++++++---- src/main/java/utils/STATICS.java | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 broadcast_ignores.txt diff --git a/broadcast_ignores.txt b/broadcast_ignores.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/commands/guildAdministration/Moveall.java b/src/main/java/commands/guildAdministration/Moveall.java index 8e752a3..e351d7e 100644 --- a/src/main/java/commands/guildAdministration/Moveall.java +++ b/src/main/java/commands/guildAdministration/Moveall.java @@ -2,19 +2,20 @@ import commands.Command; import net.dv8tion.jda.core.EmbedBuilder; +import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.core.entities.Member; import net.dv8tion.jda.core.entities.Message; import net.dv8tion.jda.core.entities.VoiceChannel; import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import net.dv8tion.jda.core.managers.GuildController; import utils.MSGS; import utils.STATICS; import java.awt.*; import java.io.IOException; import java.text.ParseException; -import java.util.Arrays; -import java.util.NoSuchElementException; -import java.util.Timer; -import java.util.TimerTask; +import java.util.*; +import java.util.List; /** * Created by zekro on 07.05.2017 / 10:55 @@ -50,8 +51,28 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept String VCfrom = event.getMember().getVoiceState().getChannel().getName(); String VCto = vc.getName(); - event.getMember().getVoiceState().getChannel().getMembers() - .forEach(member -> event.getGuild().getController().moveVoiceMember(member, vc).queue()); + HashMap autochans = commands.guildAdministration.Autochannel.getAutochans(); + + System.out.println(autochans.keySet()); + + if (autochans.containsKey(vc)) { + ArrayList membs = new ArrayList<>(event.getMember().getVoiceState().getChannel().getMembers()); + GuildController controller = event.getGuild().getController(); + + Member firstOne = membs.get(0); + controller.moveVoiceMember(firstOne, vc).queue(); + membs.remove(firstOne); + new Timer().schedule(new TimerTask() { + @Override + public void run() { + System.out.println(membs.get(0)); + membs.forEach(m -> controller.moveVoiceMember(m, firstOne.getVoiceState().getChannel()).queue()); + } + }, 1000); + } else { + event.getMember().getVoiceState().getChannel().getMembers() + .forEach(member -> event.getGuild().getController().moveVoiceMember(member, vc).queue()); + } event.getMessage().delete().queue(); Message msg = event.getTextChannel().sendMessage(new EmbedBuilder().setColor(new Color(0, 169, 255)) diff --git a/src/main/java/utils/STATICS.java b/src/main/java/utils/STATICS.java index ef663a9..d816371 100644 --- a/src/main/java/utils/STATICS.java +++ b/src/main/java/utils/STATICS.java @@ -17,7 +17,7 @@ public class STATICS { //######### GENERAL BOT SETTINGS #########// - public static String VERSION = "1.38.3.0"; + public static String VERSION = "1.38.3.1"; public static String THISBUILD = BUILDTYPE.STABLE; public static class BUILDTYPE {