Shout.java

src/net/sourceforge/pain/logic/event/console/command/Shout.java · 985 B

From the archive pain_0_41.zip

Download the archive   « Back to the archive contents

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

import java.util.*;

public final class Shout extends CommandHandler {

	public void processCommand() throws Exception {
		String text = commandParams;
		if (text == null) {
			MessageOutFn.outln(console, "You're silent");
		} else {
			MessageOutFn.outOne(player, "You shout '{Y$t{x'", text);
			Receptive plr = player.asReceptive();
			Interactive pli = player.asInteractive();
			for (Iterator it = Core.getAllObjects(Receptive.class); it.hasNext();) {
				Receptive r = (Receptive) it.next();
				if (r != plr) {
					MessageOutFn.outOne(r, "$n shouts '{Y$T{x'", pli, text);
				}
			}
		}
	}

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

Site Stats

Snippets: 1791
Codebases: 571