package com.nincraft.ninbot.components.leaderboard;

import com.nincraft.ninbot.components.command.AbstractCommand;
import lombok.val;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Component
public class WinCommand extends AbstractCommand {

    private LeaderboardService leaderboardService;

    public WinCommand(LeaderboardService leaderboardService) {
        name = "win";
        length = 3;
        description = "Report a " + name + " against another user";
        helpText = name + " @Username";
        aliases = Arrays.asList("won", "beat", "smashed", "owned");
        this.leaderboardService = leaderboardService;
    }

    @Override
    protected void executeCommand(MessageReceivedEvent event) {
        val mentionedUsers = event.getMessage().getMentionedUsers();
        List<User> mentionList = mentionedUsers.stream().filter(user -> !user.isBot()).collect(Collectors.toList());
        if (!mentionList.isEmpty()) {
            val message = event.getMessage();
            messageUtils.reactSuccessfulResponse(message);
            messageUtils.reactUnsuccessfulResponse(message);
            for (val user : mentionList) {
                val jda = event.getJDA();
                val reactionResultListener = new ReactionResultListener(leaderboardService, name, message.getId(), event.getAuthor().getId(), user.getId());
                jda.addEventListener(reactionResultListener);
            }
        }
    }
}

@@ -1087,24 +1087,71 @@
 .toList());%0A
+        mentionList.remove(event.getAuthor());%0A
         if (
@@ -1656,24 +1656,108 @@
           %7D%0A
+        %7D else %7B%0A            messageUtils.reactUnknownResponse(event.getMessage());%0A
         %7D%0A  

Fix reporting win/loss against yourself