/
area/
classes/net/sourceforge/pain/logic/
classes/net/sourceforge/pain/logic/event/
classes/net/sourceforge/pain/logic/fn/util/
classes/net/sourceforge/pain/network/console/
classes/net/sourceforge/pain/plugin/
classes/net/sourceforge/pain/plugin/reset/
classes/net/sourceforge/pain/plugin/shutdown/
classes/net/sourceforge/pain/plugin/social/
classest/net/sourceforge/pain/db/data/
doc/
doc/paindb/resources/
src/net/sourceforge/pain/logic/
src/net/sourceforge/pain/logic/event/
src/net/sourceforge/pain/logic/fn/util/
src/net/sourceforge/pain/network/console/
src/net/sourceforge/pain/network/console/telnet/
src/net/sourceforge/pain/plugin/
src/net/sourceforge/pain/plugin/command/
src/net/sourceforge/pain/plugin/reset/
src/net/sourceforge/pain/plugin/shutdown/
src/net/sourceforge/pain/plugin/social/
src/net/sourceforge/pain/util/
tests/
tests/net/sourceforge/pain/db/data/
package net.sourceforge.pain.logic.event.console.command;

import net.sourceforge.pain.logic.event.console.*;
import net.sourceforge.pain.logic.fn.*;
import net.sourceforge.pain.data.type.*;

public final class Tell extends CommandHandler {

	public void processCommand() throws Exception {
		String text = commandParams == null ? "" : commandParams.trim();
		int spaceIndex = text.indexOf(' ');
		if (spaceIndex < 1) {
			MessageOutFn.outln(console, "Tell whom what?");
			return;
		}
		String namePrefix = text.substring(0, spaceIndex);
		text = text.substring(spaceIndex).trim();
		if (text.length() == 0) {
			MessageOutFn.out(console, "Tell what?");
			return;
		}
		Interactive target = GlobalFindFn.findInteractiveByPrefix(player, namePrefix);
		if (target == null) {
			MessageOutFn.outln(console, "They aren't here.");
			return;
		}
		Interactive pli = player.asInteractive();
		if (target == pli) {
			MessageOutFn.outln(console, "Talking to yourself, eh?");
			return;
		}
		MessageOutFn.outOne(pli, "You tell $N '{w$t{x'", text, target);
		MessageOutFn.outOne(target, "$n tells you '{w$T{x'", pli, text);
	}

	public void showHelp() {
		MessageOutFn.outln(console, command.name+":sends a message to one awake player anywhere in the world.");
	}
}