package net.sourceforge.pain.logic.event.console.command.builder; import net.sourceforge.pain.*; import net.sourceforge.pain.network.console.*; import net.sourceforge.pain.data.*; import net.sourceforge.pain.data.prototype.*; import net.sourceforge.pain.data.type.*; import net.sourceforge.pain.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 = Core.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"); } }