package net.sourceforge.pain.logic.event.console.command;
import net.sourceforge.pain.data.type.*;
import net.sourceforge.pain.logic.fn.*;
import net.sourceforge.pain.logic.fn.util.*;
import net.sourceforge.pain.logic.event.console.*;
import net.sourceforge.pain.*;
import net.sourceforge.pain.console.*;
public final class Force extends GrantedCommand {
public void processCommand() throws Exception {
if (commandParams == null) {
showHelp();
return;
}
String[] params = new String[2];
ConsoleInputEvent.parseCommand(commandParams, params);
if (params[1] == null) {
showHelp();
return;
}
Player p = GlobalFindFn.findActivePlayerByName(params[0]);
if (p == null) {
MessageOutFn.outln(console, "No player found with name {c" + Utils.formatName(params[0]) + "{x");
return;
}
Console c = (Console) Core.consoleByOwner.get(p);
c.pushInputLine(params[1]);
MessageOutFn.outln(console, "Done.");
}
public void showHelp() {
MessageOutFn.outln(console, command.name + ": forces player to execute console command");
MessageOutFn.outln(console, "Usage:" + command.name + " <player_name> <command>");
}
}