Made it easier to update occupant info the correct way in hopes of discouraging

people from updating it the wrong way.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5572 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-12-04 23:28:50 +00:00
parent 46a5bbd0cc
commit 420333df51
2 changed files with 48 additions and 0 deletions
@@ -36,6 +36,8 @@ import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationManager;
import com.threerings.presents.server.ShutdownManager;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.crowd.data.PlaceObject;
@@ -165,6 +167,21 @@ public class PlaceRegistry
return _pmgrs.values().iterator();
}
/**
* Locates the {@link PlaceManager} that manages the place occupied by the supplied body,
* obtains the canonical {@link OccupantInfo} record for that body, runs your updater to effect
* any desired modifications to the occupant info record and then broadcasts the updates by
* calling {@link PlaceManager#updateOccupantInfo}.
*
* @return true if the update was sent, false if the supplied body is not currently in a place.
*/
public <T extends OccupantInfo> boolean updateOccupantInfo (
BodyObject body, PlaceManager.OccInfoUpdater<T> updater)
{
PlaceManager pmgr = getPlaceManager(body.getPlaceOid());
return (pmgr == null) ? false : pmgr.updateOccupantInfo(body.getOid(), updater);
}
// from interface ShutdownManager.Shutdowner
public void shutdown ()
{