<commit_before>package org.frustra.feather.mod.commands;

import org.frustra.feather.mod.Bootstrap;
import org.frustra.feather.mod.server.Entity;
import org.frustra.feather.mod.server.Player;

public class KarmaCommand extends Command {
	public String getName() {
		return "karma";
	}

	public boolean hasPermission(Entity source) {
		return true;
	}

	public void execute(Entity source, String[] arguments) {
		String targetName = source.getName(), amountString = "0";
		if (arguments.length == 2) {
			amountString = arguments[1];
		} else if (arguments.length == 3) {
			targetName = arguments[1];
			amountString = arguments[2];
		} else {
			source.sendMessage("Invalid usage: wrong number of arguments");
			return; // TODO throw a ch
		}

		Player target = Bootstrap.server.getPlayer(targetName);
		if (target != null) {
			int amount = Integer.parseInt(amountString);
			if (arguments[0].equals("set")) {
				target.setKarma(amount);
			} else if (arguments[0].equals("add")) {
				target.setKarma(target.getKarma() + amount);
			} else {
				source.sendMessage("Invalid usage: missing action");
				return; // TODO throw a ch
			}
			source.sendMessage("%s's karma set to %s", new Object[] { target, target.karma });
		} else {
			source.sendMessage("Target player not found");
		}
	}
}<commit_msg>Add usage to karma command<commit_after>package org.frustra.feather.mod.commands;

import org.frustra.feather.mod.Bootstrap;
import org.frustra.feather.mod.server.Entity;
import org.frustra.feather.mod.server.Player;

public class KarmaCommand extends Command {
	public String getName() {
		return "karma";
	}

	public boolean hasPermission(Entity source) {
		return true;
	}

	public void execute(Entity source, String[] arguments) {
		String targetName = source.getName(), amountString = "0";
		if (arguments.length == 2) {
			amountString = arguments[1];
		} else if (arguments.length == 3) {
			targetName = arguments[1];
			amountString = arguments[2];
		} else {
			source.sendMessage("Invalid usage: wrong number of arguments");
			return; // TODO throw a ch
		}

		Player target = Bootstrap.server.getPlayer(targetName);
		if (target != null) {
			int amount = Integer.parseInt(amountString);
			if (arguments[0].equals("set")) {
				target.setKarma(amount);
			} else if (arguments[0].equals("add")) {
				target.setKarma(target.getKarma() + amount);
			} else {
				source.sendMessage("Invalid usage: missing action");
				return; // TODO throw a ch
			}
			source.sendMessage("%s's karma set to %s", new Object[] { target, target.karma });
		} else {
			source.sendMessage("Target player not found");
		}
	}

	public String getUsage(Entity source) {
		return "/karma <set|add> <amount>";
	}
}
{'fraction_non_alphanumeric': 0.13763837638376383, 'fraction_numerical': 0.005904059040590406, 'mean_word_length': 3.9743119266055045, 'pattern_counts': {'":': 0, '<': 5, '<?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': '823344', 'n_tokens_mistral': 962, 'n_tokens_neox': 846, 'n_words': 214}