Tell.java

mudlibs/tinylib/src/net/sourceforge/pain/tinylib/logic/event/console/command/Tell.java · 1.2 KB

From the archive pain_0_45.tgz

Download the archive   « Back to the archive contents

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

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

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;
        }
        TellFn.doTell(player.asInteractive(), target, text);
    }

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

Site Stats

Snippets: 1791
Codebases: 571