From 0eaefc8a6fd556fbef725c810c6da38363f78599 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Sun, 2 Dec 2018 02:44:53 +0200 Subject: [PATCH] Remove auto create voice chanel --- .../java/net/Broken/RestApi/MusicWebAPIController.java | 2 +- src/main/java/net/Broken/audio/FindGeneral.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/Broken/RestApi/MusicWebAPIController.java b/src/main/java/net/Broken/RestApi/MusicWebAPIController.java index 1a11f43..7fac26e 100644 --- a/src/main/java/net/Broken/RestApi/MusicWebAPIController.java +++ b/src/main/java/net/Broken/RestApi/MusicWebAPIController.java @@ -193,7 +193,7 @@ public class MusicWebAPIController { logger.trace("getPlaylist for " + guild.getName()); } List temp = new ArrayList<>(); - for(VoiceChannel aChanel : FindGeneral.find(guild).getVoiceChannels()){ + for(VoiceChannel aChanel : FindGeneral.find(guild)){ temp.add(new ChanelData(aChanel.getName(),aChanel.getId(),aChanel.getPosition())); } return new ResponseEntity<>(temp, HttpStatus.OK); diff --git a/src/main/java/net/Broken/audio/FindGeneral.java b/src/main/java/net/Broken/audio/FindGeneral.java index 1525609..26813e0 100644 --- a/src/main/java/net/Broken/audio/FindGeneral.java +++ b/src/main/java/net/Broken/audio/FindGeneral.java @@ -3,6 +3,7 @@ package net.Broken.audio; import net.dv8tion.jda.core.entities.Category; import net.dv8tion.jda.core.entities.Channel; import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.core.entities.VoiceChannel; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,7 +20,7 @@ public class FindGeneral { * @param guild Current guild * @return General Category */ - public static Category find(Guild guild){ + public static List find(Guild guild){ List categories = guild.getCategories(); Category finded = null; for(Category cat : categories){ @@ -29,9 +30,9 @@ public class FindGeneral { } } if(finded == null) - finded = create(guild); + return guild.getVoiceChannels(); - return finded; + return finded.getVoiceChannels(); }