Get.java

codebase/src/net/sourceforge/pain/logic/event/console/command/Get.java · 1.1 KB

From the archive pain_0_44.tgz

Download the archive   « Back to the archive contents

package net.sourceforge.pain.logic.event.console.command;

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

public final class Get extends CommandHandler {

	public boolean isAccessible() {
		return super.isAccessible() && player.is(Creature.class);
	}


	public void processCommand() throws Exception {
		String targetName = commandParams;
		if (targetName == null) {
			MessageOutFn.outln(console, "Get what?");
			return;
		}
		Interactive iTarget = SpaceFindFn.findByPrefix(player.asLocated(), targetName);
		Physical physTarget = iTarget != null ? (Physical) iTarget.getRole(Physical.class) : null;
		if (physTarget == null) {
			if (iTarget != null) {
				MessageOutFn.outln(console, "You failed.");
			} else {
				MessageOutFn.outln(console, "I see no " + targetName + " here.");
			}
			return;
		}
        GetFn.get((Creature) player.getRole(Creature.class), physTarget);
	}

	public void showHelp() {
		MessageOutFn.outln(console, command.name + ": use this command to get items");
	}

}

Site Stats

Snippets: 1791
Codebases: 571