package com.greatmancode.legendarybot.plugin.music.commands;

import com.greatmancode.legendarybot.api.LegendaryBot;
import com.greatmancode.legendarybot.api.commands.AdminCommand;
import com.greatmancode.legendarybot.plugin.music.MusicPlugin;
import com.greatmancode.legendarybot.plugin.music.music.GuildMusicManager;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class SetVolumeCommand extends AdminCommand {

    private MusicPlugin plugin;


    public SetVolumeCommand(MusicPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public void execute(MessageReceivedEvent event, String[] args) {
        try {
            int volume = Integer.parseInt(args[0]);
            if (volume < 0 || volume > 100) {
                event.getChannel().sendMessage("The volume needs to be between 0 and 100!").queue();
                return;

            }

            GuildMusicManager manager = plugin.getMusicManager().getGuildsMusicManager().get(event.getGuild().getId());
            if (manager != null) {
                System.out.println("WE SET THE VOLUME");
                manager.player.setVolume(volume);
            }
            plugin.getBot().getGuildSettings(event.getGuild()).setSetting("MUSIC_VOLUME", volume + "");
            event.getChannel().sendMessage("Volume set to " + volume).queue();
        } catch (NumberFormatException e) {
            event.getChannel().sendMessage("The volume needs to be between 0 and 100!").queue();
        }
    }

    @Override
    public boolean canExecute(Member member) {
        return (super.canExecute(member) || plugin.getBot().getGuildSettings(member.getGuild()).getSetting(MusicPlugin.MEMBER_ALLOWED_SETTING) != null);
    }

    @Override
    public int minArgs() {
        return 1;
    }

    @Override
    public int maxArgs() {
        return 1;
    }
}

@@ -308,24 +308,68 @@
 sicManager;%0A
+import net.dv8tion.jda.core.entities.Guild;%0A
 import net.d
@@ -397,24 +397,24 @@
 ies.Member;%0A
-
 import net.d
@@ -1137,65 +1137,8 @@
 ) %7B%0A
-                System.out.println(%22WE SET THE VOLUME%22);%0A
     
@@ -1858,32 +1858,32 @@
 int maxArgs() %7B%0A
-
         return 1
@@ -1889,11 +1889,269 @@
 1;%0A    %7D
+%0A%0A    @Override%0A    public String help(Guild guild) %7B%0A        return %22Set the volume of the bot. Number between 1 and 100.%22;%0A    %7D%0A%0A    public String shortDescription(Guild guild) %7B%0A        return %22Set the volume of the bot. Number between 1 and 100.%22;%0A    %7D
 %0A%7D%0A

Add the help.