BC_Resets.java

mudlibs/tinylib/src/net/sourceforge/pain/tinylib/logic/event/console/command/builder/BC_Resets.java · 1.9 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.builder;

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

import java.util.*;

/**
 * PAiN  Date: 05.06.2003  Time: 1:40:02
 */
public final class BC_Resets extends BuilderCommand {

    public void processBuilderCommand(BuilderShell p, String args) throws Exception {
        Prototype r = p.builder.getEditedRole();
        PrototypeInfo pi;
        if (r == null) {
            MessageOutFn.outln(p.console, "No active prototype found!");
            return;
        }

        pi = (PrototypeInfo) r.getRole(PrototypeInfo.class);

        ResetGroupRegistry rgr = Mudlib.getWorld().getResetGroupRegistry();
        int total = 0;
        for (Iterator it = rgr.getResetGroups().iterator(); it.hasNext();) {
            ResetGroup rg = (ResetGroup) it.next();
            final Set resets = rg.getResets();
            for (Iterator it2 = resets.iterator(); it2.hasNext();) {
                Reset reset = (Reset) it2.next();
                if (reset.getResettedPrototype() == pi) {
                    total++;
                    SpaceReset sr = (SpaceReset) reset.getRole(SpaceReset.class);
                    if (sr != null) {
                        MessageOutFn.outln(p.console, "Group:" + rg.getGroupId() + " space:" + sr.getLocation().getName());
                    } else {
                        MessageOutFn.outln(p.console, "Group:" + rg.getGroupId());
                    }
                }
            }
        }
        MessageOutFn.outln(p.console, "Found resets:" + total);
    }


    public void showHelp(Console console) {
        MessageOutFn.outln(console, "Builder command RESETS shows all reset of active prototype.");
        MessageOutFn.outln(console, "Usage: resets");
    }

}



Site Stats

Snippets: 1791
Codebases: 571