|
23 | 23 | import net.clementraynaud.skoice.menus.ConfigurationMenus;
|
24 | 24 | import net.clementraynaud.skoice.menus.EmbeddedMenu;
|
25 | 25 | import net.clementraynaud.skoice.storage.config.ConfigField;
|
26 |
| -import net.clementraynaud.skoice.tasks.InterruptSystemTask; |
27 | 26 | import net.dv8tion.jda.api.entities.Guild;
|
28 |
| -import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel; |
29 | 27 | import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
|
30 | 28 | import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
31 | 29 | import net.dv8tion.jda.api.interactions.modals.ModalMapping;
|
@@ -59,16 +57,7 @@ public void onModalInteraction(ModalInteractionEvent event) {
|
59 | 57 | String voiceChannelName = voiceChannelValue.getAsString();
|
60 | 58 | guild.createCategory(categoryName).queue(category ->
|
61 | 59 | guild.createVoiceChannel(voiceChannelName, category).queue(channel -> {
|
62 |
| - VoiceChannel oldVoiceChannel = this.plugin.getConfigYamlFile().getVoiceChannel(); |
63 |
| - if (oldVoiceChannel != null) { |
64 |
| - oldVoiceChannel.modifyStatus("").queue(); |
65 |
| - } |
66 |
| - this.plugin.getConfigYamlFile().set(ConfigField.VOICE_CHANNEL_ID.toString(), channel.getId()); |
67 |
| - new InterruptSystemTask(this.plugin).run(); |
68 |
| - this.plugin.getListenerManager().update(event.getUser()); |
69 |
| - this.plugin.getBot().getVoiceChannel().updatePermissions(); |
70 |
| - this.plugin.getBot().getVoiceChannel().setStatus(); |
71 |
| - this.plugin.getLinksYamlFile().refreshOnlineLinkedPlayers(); |
| 60 | + this.plugin.getBot().getVoiceChannel().setup(channel, event.getUser()); |
72 | 61 | ConfigurationMenus.getFromMessageId(event.getMessage().getId()).ifPresent(menu -> menu.refreshId().edit(event));
|
73 | 62 | }));
|
74 | 63 |
|
|
0 commit comments