<commit_before>package com.gmail.fthielisch.chestkits;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Chest;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class ChestKitsPlugin extends JavaPlugin {

	public static final String LORE_KEY = "Contains a bunch of items!";

	private ChestKitsConfiguration config = null;

	@Override
	public void onEnable() {
		config = new ChestKitsConfiguration(this.getConfig(), this.getLogger());

		this.getServer().getPluginManager().registerEvents(new ChestKitsListener(this), this);
	}

	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
		Player toGive;
		boolean fromConsole = false;
		if (!(sender instanceof Player)) {
			if (args.length == 0) {
				sender.sendMessage("You must specify a target player.");
				sender.sendMessage("Usage: /ckit (PLAYER) (command)");
				return true;
			}
			toGive = sender.getServer().getPlayer(args[0]);
			if (toGive == null || !toGive.isOnline()) {
				sender.sendMessage("The player " + args[0] + " is not online!");
				return true;
			}
			String[] args2 = new String[args.length - 1];
			for (int i = 1; i < args.length; i++) {
				args2[i - 1] = args[i];
			}
			args = args2;
			fromConsole = true;
		} else {
			toGive = (Player) sender;
		}

		if (args.length < 1) {
			sender.sendMessage("Usage: /ckit {kitname}");
			if (sender.hasPermission("ckit.create")) {
				sender.sendMessage("Usage: /ckit create {kitName}");
			}
			if (sender.hasPermission("ckit.delete")) {
				sender.sendMessage("Usage: /ckit delete {kitName}");
			}
			if (sender.hasPermission("ckit.save")) {
				sender.sendMessage("Usage: /ckit save config");
			}
			if (sender.hasPermission("ckit.give")) {
				sender.sendMessage("Usage: /ckit give {playerName} {kitName}");
			}

			return true;
		}

		if (args.length == 1) {
			String kit = args[0];

			List<ItemStack> items = config.getKitContents(kit);
			if (items == null) {
				sender.sendMessage(ChatColor.RED + "The kit '" + kit + "' does not exist.");
				return true;
			}

			if (!sender.hasPermission("ckit.get." + kit) && !sender.hasPermission("ckit.get.*")) {
				sender.sendMessage(ChatColor.RED + "You do not have access to that kit.");
				return true;
			}

			ItemStack is = new ItemStack(Material.CHEST, 1);
			ItemMeta meta = is.getItemMeta();
			meta.setDisplayName("Kit " + kit);
			meta.setLore(Arrays.asList(LORE_KEY));
			is.setItemMeta(meta);

			if (!toGive.getInventory().addItem(is).isEmpty()) {
				sender.sendMessage(ChatColor.RED + "Your inventory is too full to hold the kit.");
			} else if (fromConsole) {
				toGive.sendMessage(ChatColor.GREEN + "You have been given a " + kit + " kit!");
			}<commit_msg>Fixed incorrect invalid message bug<commit_after>package com.gmail.fthielisch.chestkits;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Chest;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class ChestKitsPlugin extends JavaPlugin {

	public static final String LORE_KEY = "Contains a bunch of items!";

	private ChestKitsConfiguration config = null;

	@Override
	public void onEnable() {
		config = new ChestKitsConfiguration(this.getConfig(), this.getLogger());

		this.getServer().getPluginManager().registerEvents(new ChestKitsListener(this), this);
	}

	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
		Player toGive;
		boolean fromConsole = false;
		if (!(sender instanceof Player)) {
			if (args.length == 0) {
				sender.sendMessage("You must specify a target player.");
				sender.sendMessage("Usage: /ckit (PLAYER) (command)");
				return true;
			}
			toGive = sender.getServer().getPlayer(args[0]);
			if (toGive == null || !toGive.isOnline()) {
				sender.sendMessage("The player " + args[0] + " is not online!");
				return true;
			}
			String[] args2 = new String[args.length - 1];
			for (int i = 1; i < args.length; i++) {
				args2[i - 1] = args[i];
			}
			args = args2;
			fromConsole = true;
		} else {
			toGive = (Player) sender;
		}

		if (args.length < 1) {
			sender.sendMessage("Usage: /ckit {kitname}");
			if (sender.hasPermission("ckit.create")) {
				sender.sendMessage("Usage: /ckit create {kitName}");
			}
			if (sender.hasPermission("ckit.delete")) {
				sender.sendMessage("Usage: /ckit delete {kitName}");
			}
			if (sender.hasPermission("ckit.save")) {
				sender.sendMessage("Usage: /ckit save config");
			}
			if (sender.hasPermission("ckit.give")) {
				sender.sendMessage("Usage: /ckit give {playerName} {kitName}");
			}

			return true;
		}

		if (args.length == 1) {
			String kit = args[0];

			List<ItemStack> items = config.getKitContents(kit);
			if (items == null) {
				sender.sendMessage(ChatColor.RED + "The kit '" + kit + "' does not exist.");
				return true;
			}

			if (!sender.hasPermission("ckit.get." + kit) && !sender.hasPermission("ckit.get.*")) {
				sender.sendMessage(ChatColor.RED + "You do not have access to that kit.");
				return true;
			}

			ItemStack is = new ItemStack(Material.CHEST, 1);
			ItemMeta meta = is.getItemMeta();
			meta.setDisplayName("Kit " + kit);
			meta.setLore(Arrays.asList(LORE_KEY));
			is.setItemMeta(meta);

			if (!toGive.getInventory().addItem(is).isEmpty()) {
				sender.sendMessage(ChatColor.RED + "Your inventory is too full to hold the kit.");
			} else if (fromConsole) {
				toGive.sendMessage(ChatColor.GREEN + "You have been given a " + kit + " kit!");
			}
			return true;
{'fraction_non_alphanumeric': 0.1456295361312717, 'fraction_numerical': 0.0041022404544020195, 'mean_word_length': 3.921583850931677, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '3135705', 'n_tokens_mistral': 2400, 'n_tokens_neox': 2058, 'n_words': 486}