<commit_before>package org.tyrannyofheaven.bukkit.util.command.reader;

import static org.tyrannyofheaven.bukkit.util.ToHUtils.colorize;
import static org.tyrannyofheaven.bukkit.util.ToHUtils.delimitedString;
import static org.tyrannyofheaven.bukkit.util.ToHUtils.hasText;
import static org.tyrannyofheaven.bukkit.util.ToHUtils.sendMessage;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.bukkit.Server;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

/**
 * Utility class to read a file containing commands and execute them.
 * 
 * @author zerothangel
 */
public class CommandReader {

    /**
     * Execute commands from a file. Commands will be echoed back to the sender.
     * 
     * @param server the Server instance
     * @param sender who to execute the commands as
     * @param file the file to read commands from
     * @param echo true if commands should be echoed back to sender
     * @throws IOException upon I/O error
     */
    public static boolean read(Server server, CommandSender sender, File file) throws IOException {
        return read(server, sender, file, true);
    }
    
    /**
     * Execute commands from a stream. Commands will be echoed back to the sender.
     * 
     * @param server the Server instance
     * @param sender who to execute the commands as
     * @param input InputStream for commands
     * @param echo true if commands should be echoed back to sender
     * @throws IOException upon I/O error
     */
    public static boolean read(Server server, CommandSender sender, InputStream input) throws IOException {
        return read(server, sender, input, true);
    }

    /**
     * Execute commands from a file.
     * 
     * @param server the Server instance
     * @param sender who to execute the commands as
     * @param file the file to read commands from<commit_msg>Fix misleading javadocs.<commit_after>package org.tyrannyofheaven.bukkit.util.command.reader;

import static org.tyrannyofheaven.bukkit.util.ToHUtils.colorize;
import static org.tyrannyofheaven.bukkit.util.ToHUtils.delimitedString;
import static org.tyrannyofheaven.bukkit.util.ToHUtils.hasText;
import static org.tyrannyofheaven.bukkit.util.ToHUtils.sendMessage;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.bukkit.Server;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

/**
 * Utility class to read a file containing commands and execute them.
 * 
 * @author zerothangel
 */
public class CommandReader {

    /**
     * Execute commands from a file. Commands will be echoed back to the sender.
     * 
     * @param server the Server instance
     * @param sender who to execute the commands as
     * @param file the file to read commands from
     * @throws IOException upon I/O error
     */
    public static boolean read(Server server, CommandSender sender, File file) throws IOException {
        return read(server, sender, file, true);
    }
    
    /**
     * Execute commands from a stream. Commands will be echoed back to the sender.
     * 
     * @param server the Server instance
     * @param sender who to execute the commands as
     * @param input InputStream for commands
     * @throws IOException upon I/O error
     */
    public static boolean read(Server server, CommandSender sender, InputStream input) throws IOException {
        return read(server, sender, input, true);
    }

    /**
     * Execute commands from a file.
     * 
     * @param server the Server instance
     * @param sender who to execute the commands as
     * @param file the file to read commands from
{'fraction_non_alphanumeric': 0.07842658196921573, 'fraction_numerical': 0.0, 'mean_word_length': 3.392703862660944, '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': '422104', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1134, 'n_words': 401}