/
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.*;
import net.sourceforge.pain.data.type.*;
import net.sourceforge.pain.logic.fn.*;

public final class Goto extends GrantedCommand {

	public void processCommand() {
		String target = commandParams == null ? "" : commandParams.trim();
		if (target.length() == 0) {
			MessageOutFn.outln(console, "Goto where?");
			return;
		}

		Player p = GlobalFindFn.findActivePlayerByName(target);
		Space targetSpace;
		if (p != null) {
			targetSpace = p.getLocation();
		} else {
			IndexedSpace indexedSpace = Core.getWorld().getIndexedSpacesRegistry().getSpace(target);
			if (indexedSpace == null) {
				MessageOutFn.outln(console, "No such location!");
				return;
			}
			targetSpace = indexedSpace.asSpace();
		}

		MessageOutFn.outSpace(player, "$n leaves room", player);
		//	Log.debug("setting location from:"+space.getVnum()+" to :"+targetSpace.getVnum());
		final Located located = player.asLocated();
		if (targetSpace != located.getLocation()) {
			RelocateFn.relocate(located, targetSpace);
		}
		ShowFn.showSpace(player.asReceptive(), targetSpace);
		MessageOutFn.outSpace(located, "$n arrives", player);
	}

	public void showHelp() {
		MessageOutFn.outln(console, command.name + ": moves you to the specified unique space or player");
	}
}