<commit_before>package com.comandante.creeper.command;

import com.comandante.creeper.CreeperEntry;
import com.comandante.creeper.managers.GameManager;
import com.comandante.creeper.merchant.Merchant;
import com.comandante.creeper.merchant.lockers.LockerCommand;
import com.comandante.creeper.player.PlayerRole;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Sets;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;
import org.pircbotx.UserChannelDao;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

public class OpCommand extends Command {

    final static List<String> validTriggers = Arrays.asList("op");
    final static String description = "Give a user in the IRC channel ops.";
    final static String correctUsage = "op fibs";
    final static Set<PlayerRole> roles = Sets.newHashSet(PlayerRole.ADMIN);

    public OpCommand(GameManager gameManager) {
        super(gameManager, validTriggers, description, correctUsage, roles);
    }

    public OpCommand(GameManager gameManager, List<String> validTriggers, String description, String correctUsage) {
        super(gameManager, validTriggers, description, correctUsage);
    }

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        configure(e);
        try {
            //ghetto and will only work for one channel bots.
            originalMessageParts.remove(0);
            String desiredNickNameToOp = Joiner.on(" ").join(originalMessageParts);
            UserChannelDao<User, Channel> userChannelDao = gameManager.getIrcBotService().getBot().getUserChannelDao();
            User user = userChannelDao.getUser(desiredNickNameToOp);
            if (user == null) {
                write("No such nick name exists in " + gameManager.getCreeperConfiguration().ircChannel);
                return;
            }
            ImmutableSortedSet<Channel> channels = user.getChannels();
            for (Channel channel : channels) {
                    channel.send().op(user);
                    write("Ops given in channel " + channel.getName());
                }
        } finally {
            super.messageReceived(ctx, e);
        }
    }
}<commit_msg>fixing a bug<commit_after>package com.comandante.creeper.command;

import com.comandante.creeper.CreeperEntry;
import com.comandante.creeper.managers.GameManager;
import com.comandante.creeper.merchant.Merchant;
import com.comandante.creeper.merchant.lockers.LockerCommand;
import com.comandante.creeper.player.PlayerRole;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Sets;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;
import org.pircbotx.UserChannelDao;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

public class OpCommand extends Command {

    final static List<String> validTriggers = Arrays.asList("op");
    final static String description = "Give a user in the IRC channel ops.";
    final static String correctUsage = "op fibs";
    final static Set<PlayerRole> roles = Sets.newHashSet(PlayerRole.ADMIN);

    public OpCommand(GameManager gameManager) {
        super(gameManager, validTriggers, description, correctUsage, roles);
    }

    public OpCommand(GameManager gameManager, List<String> validTriggers, String description, String correctUsage) {
        super(gameManager, validTriggers, description, correctUsage);
    }

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        configure(e);
        try {
            //ghetto and will only work for one channel bots.
            if (originalMessageParts.size() <= 1) {
                return;
            }
            originalMessageParts.remove(0);
            String desiredNickNameToOp = Joiner.on(" ").join(originalMessageParts);
            UserChannelDao<User, Channel> userChannelDao = gameManager.getIrcBotService().getBot().getUserChannelDao();
            User user = userChannelDao.getUser(desiredNickNameToOp);
            if (user == null) {
                write("No such nick name exists in " + gameManager.getCreeperConfiguration().ircChannel);
                return;
            }
            ImmutableSortedSet<Channel> channels = user.getChannels();
            for (Channel channel : channels) {
                    channel.send().op(user);
                    write("Ops given in channel " + channel.getName());
                }
        } finally {
            super.messageReceived(ctx, e);
        }
    }
}
{'fraction_non_alphanumeric': 0.096, 'fraction_numerical': 0.0005853658536585366, 'mean_word_length': 3.2681099084096585, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, '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': '4890662', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1443, 'n_words': 312}