<commit_before>package me.jacobcrofts.simplestructureloader.commands;

import java.io.IOException;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.json.simple.parser.ParseException;

import me.jacobcrofts.simplestructureloader.api.StructureAPI;
import me.jacobcrofts.simplestructureloader.util.Selection;

public class CmdPasteStructure implements CommandExecutor {

	@Override
	public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
		
		if (sender instanceof Player) {			
			Selection selection;
			try {
				selection = new Selection(StructureAPI.readFromFile("plugins/structures/" + args[0] + ".json"));
				StructureAPI.placeStructure(selection, ((Player) sender).getLocation());
			} catch (IOException | ParseException e) {
				e.printStackTrace();
			}
			return true;
		}
		
		return false;
	}

}<commit_msg>Add feature: error handling for paste command<commit_after>package me.jacobcrofts.simplestructureloader.commands;

import java.io.IOException;

import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.json.simple.parser.ParseException;

import me.jacobcrofts.simplestructureloader.api.StructureAPI;
import me.jacobcrofts.simplestructureloader.util.Selection;

public class CmdPasteStructure implements CommandExecutor {

	@Override
	public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
		
		if (sender instanceof Player) {
			Player player = (Player) sender;
			if (player.getGameMode() == GameMode.CREATIVE && player.isOp()) {				
				Selection selection;
				try {
					selection = new Selection(StructureAPI.readFromFile("plugins/structures/" + args[0] + ".json"));
					StructureAPI.placeStructure(selection, player.getLocation());
				} catch (IOException | ParseException e) {
					e.printStackTrace();
				}
			} else {
				player.sendMessage(ChatColor.RED + "You do not have permission to execute this command.");
			}
			return true;
		} else {
			sender.sendMessage("Only players may perform this command.");
		}
		
		return false;
	}

}
{'fraction_non_alphanumeric': 0.10494623655913979, 'fraction_numerical': 0.0008602150537634409, 'mean_word_length': 4.771712158808933, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6891063', 'n_tokens_mistral': 775, 'n_tokens_neox': 653, 'n_words': 151}