<commit_before>package org.royaldev.royalcommands.rcommands;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.royaldev.royalcommands.PConfManager;
import org.royaldev.royalcommands.RUtils;
import org.royaldev.royalcommands.RoyalCommands;

public class CmdIgnore implements CommandExecutor {

    RoyalCommands plugin;

    public CmdIgnore(RoyalCommands instance) {
        plugin = instance;
    }

    public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("ignore")) {
            if (!plugin.isAuthorized(cs, "rcmds.ignore")) {
                RUtils.dispNoPerms(cs);
                return true;
            }
            if (!(cs instanceof Player)) {
                cs.sendMessage(ChatColor.RED + "This command is only available to players!");
                return true;
            }
            if (args.length < 1) {
                cs.sendMessage(cmd.getDescription());
                return false;
            }
            String name = args[0].trim().toLowerCase();

            Player t = plugin.getServer().getPlayer(name);
            if (t == null || plugin.isVanished(t, cs)) {
                cs.sendMessage(ChatColor.RED + "That player does not exist!");
                return true;
            }
            if (plugin.isAuthorized(t, "rcmds.exempt.ignore")) {
                cs.sendMessage(ChatColor.RED + "You cannot ignore that player!");
                return true;
            }
            PConfManager pcm = new PConfManager(t);
            java.util.List<String> players = pcm.getStringList("ignoredby");
            for (String ignored : players) {
                if (ignored.toLowerCase().equals(cs.getName().toLowerCase())) {
                    players.remove(ignored);
                    pcm.setStringList(players, "ignoredby");
                    cs.sendMessage(ChatColor.BLUE + "You have stopped ignoring " + ChatColor.GRAY + t.getName() + ChatColor.BLUE + ".");
                    return true;
                }
            }
            players.add(cs.getName());
            pcm.setStringList(players, "ignoredby");
            cs.sendMessage(ChatColor.BLUE + "You are now ignoring " + ChatColor.GRAY + t.getName() + ChatColor.BLUE + ".");
            return true;
        }
        return false;
    }

}<commit_msg>Fixed: NPE in /ignore<commit_after>package org.royaldev.royalcommands.rcommands;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.royaldev.royalcommands.PConfManager;
import org.royaldev.royalcommands.RUtils;
import org.royaldev.royalcommands.RoyalCommands;

import java.util.ArrayList;
import java.util.List;

public class CmdIgnore implements CommandExecutor {

    RoyalCommands plugin;

    public CmdIgnore(RoyalCommands instance) {
        plugin = instance;
    }

    public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("ignore")) {
            if (!plugin.isAuthorized(cs, "rcmds.ignore")) {
                RUtils.dispNoPerms(cs);
                return true;
            }
            if (!(cs instanceof Player)) {
                cs.sendMessage(ChatColor.RED + "This command is only available to players!");
                return true;
            }
            if (args.length < 1) {
                cs.sendMessage(cmd.getDescription());
                return false;
            }
            String name = args[0].trim().toLowerCase();

            Player t = plugin.getServer().getPlayer(name);
            if (t == null || plugin.isVanished(t, cs)) {
                cs.sendMessage(ChatColor.RED + "That player does not exist!");
                return true;
            }
            if (plugin.isAuthorized(t, "rcmds.exempt.ignore")) {
                cs.sendMessage(ChatColor.RED + "You cannot ignore that player!");
                return true;
            }
            PConfManager pcm = new PConfManager(t);
            List<String> players = pcm.getStringList("ignoredby");
            if (players == null) players = new ArrayList<String>();
            for (String ignored : players) {
                if (ignored.toLowerCase().equals(cs.getName().toLowerCase())) {
                    players.remove(ignored);
                    pcm.setStringList(players, "ignoredby");
                    cs.sendMessage(ChatColor.BLUE + "You have stopped ignoring " + ChatColor.GRAY + t.getName() + ChatColor.BLUE + ".");
                    return true;
                }
            }
            players.add(cs.getName());
            pcm.setStringList(players, "ignoredby");
            cs.sendMessage(ChatColor.BLUE + "You are now ignoring " + ChatColor.GRAY + t.getName() + ChatColor.BLUE + ".");
            return true;
        }
        return false;
    }

}
{'fraction_non_alphanumeric': 0.11390416339355852, 'fraction_numerical': 0.0007855459544383347, 'mean_word_length': 2.013609467455621, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, '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': '3015629', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1370, 'n_words': 293}