com.threerings.crowd.server
Class LocationManager

java.lang.Object
  extended by com.threerings.crowd.server.LocationManager
All Implemented Interfaces:
LocationCodes, LocationProvider, InvocationCodes, InvocationProvider

public class LocationManager
extends Object
implements LocationProvider, LocationCodes

Handles location-related services.


Field Summary
protected  ClientManager _clmgr
           
protected  BodyLocator _locator
           
protected  RootDObjectManager _omgr
           
protected  PlaceRegistry _plreg
           
 
Fields inherited from interface com.threerings.crowd.data.LocationCodes
ALREADY_THERE, MOVE_IN_PROGRESS, NO_SUCH_PLACE
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Constructor Summary
LocationManager(InvocationManager invmgr)
           
 
Method Summary
 void leaveOccupiedPlace(BodyObject source)
          Removes the specified body from the place object they currently occupy.
 void leavePlace(ClientObject caller)
          Handles a LocationService.leavePlace() request.
 void moveBody(BodyObject source, Place place)
          Forcibly moves the specified body object to the new place.
 PlaceConfig moveTo(BodyObject source, int placeOid)
          Moves the specified body from whatever location they currently occupy to the location identified by the supplied place oid.
 void moveTo(ClientObject caller, int placeOid, LocationService.MoveListener listener)
          Handles a LocationService.moveTo(int, com.threerings.crowd.client.LocationService.MoveListener) request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_omgr

@Inject
protected RootDObjectManager _omgr

_locator

@Inject
protected BodyLocator _locator

_clmgr

@Inject
protected ClientManager _clmgr

_plreg

@Inject
protected PlaceRegistry _plreg
Constructor Detail

LocationManager

@Inject
public LocationManager(InvocationManager invmgr)
Method Detail

moveTo

public void moveTo(ClientObject caller,
                   int placeOid,
                   LocationService.MoveListener listener)
            throws InvocationException
Description copied from interface: LocationProvider
Handles a LocationService.moveTo(int, com.threerings.crowd.client.LocationService.MoveListener) request.

Specified by:
moveTo in interface LocationProvider
Throws:
InvocationException

leavePlace

public void leavePlace(ClientObject caller)
Description copied from interface: LocationProvider
Handles a LocationService.leavePlace() request.

Specified by:
leavePlace in interface LocationProvider

moveTo

public PlaceConfig moveTo(BodyObject source,
                          int placeOid)
                   throws InvocationException
Moves the specified body from whatever location they currently occupy to the location identified by the supplied place oid.

Returns:
the config object for the new location.
Throws:
InvocationException - thrown if the move was not successful for some reason (which will be communicated as an error code in the exception's message data).

leaveOccupiedPlace

public void leaveOccupiedPlace(BodyObject source)
Removes the specified body from the place object they currently occupy. Does nothing if the body is not currently in a place.


moveBody

public void moveBody(BodyObject source,
                     Place place)
Forcibly moves the specified body object to the new place. This is accomplished by first removing the body from their old location and then sending the client a notification, instructing it to move to the new location (which it does using the normal moveTo service). This has the benefit that the client is removed from their old place regardless of whether or not they are cooperating. If they choose to ignore the forced move request, they will remain in limbo, unable to do much of anything.