<commit_before>package com.bwfcwalshy.flarebot.commands.music;

import com.bwfcwalshy.flarebot.FlareBot;
import com.bwfcwalshy.flarebot.MessageUtils;
import com.bwfcwalshy.flarebot.commands.Command;
import com.bwfcwalshy.flarebot.commands.CommandType;
import com.bwfcwalshy.flarebot.music.MusicManager;
import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IMessage;
import sx.blah.discord.handle.obj.IUser;
import sx.blah.discord.util.audio.AudioPlayer;

public class SkipCommand implements Command {

    private MusicManager musicManager;
    public SkipCommand(FlareBot bot){
        this.musicManager = bot.getMusicManager();
    }

    @Override
    public void onCommand(IUser sender, IChannel channel, IMessage message, String[] args) {
        if(args.length == 1){
            String arg = args[0];
            if(arg.startsWith("#")){
                arg = arg.substring(1);
                try {
                    int num = Integer.parseInt(arg);
                    AudioPlayer pl = musicManager.getPlayers().get(channel.getGuild().getID());
                    if(pl != null){
                        pl.getPlaylist().remove(num);
                    }
                } catch (NumberFormatException e){
                    MessageUtils.sendMessage(channel, "Must be a number!");
                }
            }
            try {
                int num = Integer.parseInt(arg);
                musicManager.skip(channel.getGuild().getID(), num);
            } catch (NumberFormatException e){
                MessageUtils.sendMessage(channel, "Must be a number!");
            }
            return;
        }
        musicManager.skip(channel.getGuild().getID());
    }

    @Override
    public String getCommand() {
        return "skip";
    }

    @Override
    public String getDescription() {
        return "Skip the current song playing, or if specified #NUMBER for the song under NUMBER or just NUMBER for next NUMBER songs.";
    }

    @Override
    public CommandType getType() { return CommandType.MUSIC; }
}
<commit_msg>Make the _skip#NUMBER command 1-indexed and make it check for the list size so there is no errors<commit_after>package com.bwfcwalshy.flarebot.commands.music;

import com.bwfcwalshy.flarebot.FlareBot;
import com.bwfcwalshy.flarebot.MessageUtils;
import com.bwfcwalshy.flarebot.commands.Command;
import com.bwfcwalshy.flarebot.commands.CommandType;
import com.bwfcwalshy.flarebot.music.MusicManager;
import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IMessage;
import sx.blah.discord.handle.obj.IUser;
import sx.blah.discord.util.audio.AudioPlayer;

public class SkipCommand implements Command {

    private MusicManager musicManager;
    public SkipCommand(FlareBot bot){
        this.musicManager = bot.getMusicManager();
    }

    @Override
    public void onCommand(IUser sender, IChannel channel, IMessage message, String[] args) {
        if(args.length == 1){
            String arg = args[0];
            if(arg.startsWith("#")){
                arg = arg.substring(1);
                try {
                    int num = Integer.parseInt(arg) - 1;
                    AudioPlayer pl = musicManager.getPlayers().get(channel.getGuild().getID());
                    if(pl != null && pl.getPlaylistSize() < num){
                        pl.getPlaylist().remove(num);
                    }
                } catch (NumberFormatException e){
                    MessageUtils.sendMessage(channel, "Must be a number!");
                }
            }
            try {
                int num = Integer.parseInt(arg);
                musicManager.skip(channel.getGuild().getID(), num);
            } catch (NumberFormatException e){
                MessageUtils.sendMessage(channel, "Must be a number!");
            }
            return;
        }
        musicManager.skip(channel.getGuild().getID());
    }

    @Override
    public String getCommand() {
        return "skip";
    }

    @Override
    public String getDescription() {
        return "Skip the current song playing, or if specified #NUMBER for the song under NUMBER or just NUMBER for next NUMBER songs.";
    }

    @Override
    public CommandType getType() { return CommandType.MUSIC; }
}

{'fraction_non_alphanumeric': 0.10379568884723524, 'fraction_numerical': 0.0018744142455482662, 'mean_word_length': 2.2267573696145124, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5013225', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1178, 'n_words': 268}