More style fixes.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5242 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-07-19 09:50:20 +00:00
parent 6b1d65553f
commit d01715a369
22 changed files with 90 additions and 102 deletions
@@ -96,7 +96,7 @@ public class BureauRegistry
*/ */
@Inject public BureauRegistry (InvocationManager invmgr) @Inject public BureauRegistry (InvocationManager invmgr)
{ {
invmgr.registerDispatcher(new BureauDispatcher(new BureauProvider () { invmgr.registerDispatcher(new BureauDispatcher(new BureauProvider() {
public void bureauInitialized (ClientObject client, String bureauId) { public void bureauInitialized (ClientObject client, String bureauId) {
BureauRegistry.this.bureauInitialized(client, bureauId); BureauRegistry.this.bureauInitialized(client, bureauId);
} }
@@ -186,7 +186,7 @@ public class BureauRegistry
String bureauType, String bureauType,
final CommandGenerator cmdGenerator) final CommandGenerator cmdGenerator)
{ {
setLauncher(bureauType, new Launcher () { setLauncher(bureauType, new Launcher() {
public void launchBureau (String bureauId, String token) public void launchBureau (String bureauId, String token)
throws IOException { throws IOException {
ProcessBuilder builder = new ProcessBuilder( ProcessBuilder builder = new ProcessBuilder(
@@ -291,7 +291,6 @@ public class BureauRegistry
// transition the agent to a new state and perform the effect of the transition // transition the agent to a new state and perform the effect of the transition
switch (found.state) { switch (found.state) {
case Bureau.PENDING: case Bureau.PENDING:
found.bureau.agentStates.remove(found.agent); found.bureau.agentStates.remove(found.agent);
// !TODO: is the the right place to destroy it? // !TODO: is the the right place to destroy it?
@@ -611,7 +610,7 @@ public class BureauRegistry
protected Process _result; protected Process _result;
} }
// Models the results of searching for an agent /** Models the results of searching for an agent. */
protected static class FoundAgent protected static class FoundAgent
{ {
FoundAgent ( FoundAgent (
@@ -634,7 +633,7 @@ public class BureauRegistry
int state; int state;
} }
// Models a bureau, including the process handle, all running agents and their states /** Models a bureau, including the process handle, all running agents and their states. */
protected static class Bureau protected static class Bureau
{ {
// Agent states { // Agent states {
@@ -687,8 +686,7 @@ public class BureauRegistry
builder.append("[Bureau id=").append(bureauId).append(", client="); builder.append("[Bureau id=").append(bureauId).append(", client=");
if (clientObj == null) { if (clientObj == null) {
builder.append("null"); builder.append("null");
} } else {
else {
builder.append(clientObj.getOid()); builder.append(clientObj.getOid());
} }
builder.append(", launcher=").append(launcher); builder.append(", launcher=").append(launcher);
@@ -705,7 +703,7 @@ public class BureauRegistry
StringBuilder agentSummary (StringBuilder str) StringBuilder agentSummary (StringBuilder str)
{ {
int counts[] = {0, 0, 0, 0, 0}; int[] counts = {0, 0, 0, 0, 0};
for (Map.Entry<AgentObject, Integer> me : agentStates.entrySet()) { for (Map.Entry<AgentObject, Integer> me : agentStates.entrySet()) {
counts[me.getValue()]++; counts[me.getValue()]++;
} }
@@ -25,7 +25,7 @@ import com.threerings.presents.util.PresentsContext;
import com.threerings.bureau.client.BureauDirector; import com.threerings.bureau.client.BureauDirector;
/** /**
* Defines the objects held on a bureau client. This includes usual set of objects found on a * Defines the objects held on a bureau client. This includes usual set of objects found on a
* standard presents client. * standard presents client.
*/ */
public interface BureauContext extends PresentsContext public interface BureauContext extends PresentsContext
@@ -80,7 +80,7 @@ public class ChatDirector extends BasicDirector
/** /**
* Called when the list of chatters has been changed. * Called when the list of chatters has been changed.
*/ */
public void chattersUpdated (Iterator chatternames); void chattersUpdated (Iterator chatternames);
} }
/** /**
@@ -92,13 +92,13 @@ public class ChatDirector extends BasicDirector
/** /**
* Returns whether the username may be added to the chatters list. * Returns whether the username may be added to the chatters list.
*/ */
public boolean isChatterValid (Name username); boolean isChatterValid (Name username);
} }
/** /**
* Used to implement a slash command (e.g. <code>/who</code>). * Used to implement a slash command (e.g. <code>/who</code>).
*/ */
public static abstract class CommandHandler public abstract static class CommandHandler
{ {
/** /**
* Handles the specified chat command. * Handles the specified chat command.
@@ -390,17 +390,17 @@ public class ChatDirector extends BasicDirector
int sidx = text.indexOf(" "); int sidx = text.indexOf(" ");
if (sidx != -1) { if (sidx != -1) {
command = text.substring(1, sidx).toLowerCase(); command = text.substring(1, sidx).toLowerCase();
args = text.substring(sidx+1).trim(); args = text.substring(sidx + 1).trim();
} }
HashMap<String,CommandHandler> possibleCommands = getCommandHandlers(command); HashMap<String, CommandHandler> possibleCommands = getCommandHandlers(command);
switch (possibleCommands.size()) { switch (possibleCommands.size()) {
case 0: case 0:
StringTokenizer tok = new StringTokenizer(text); StringTokenizer tok = new StringTokenizer(text);
return MessageBundle.tcompose("m.unknown_command", tok.nextToken()); return MessageBundle.tcompose("m.unknown_command", tok.nextToken());
case 1: case 1:
Map.Entry<String,CommandHandler> entry = Map.Entry<String, CommandHandler> entry =
possibleCommands.entrySet().iterator().next(); possibleCommands.entrySet().iterator().next();
String cmdName = entry.getKey(); String cmdName = entry.getKey();
CommandHandler cmd = entry.getValue(); CommandHandler cmd = entry.getValue();
@@ -535,7 +535,8 @@ public class ChatDirector extends BasicDirector
} }
protected void success () { protected void success () {
dispatchMessage(new TellFeedbackMessage(target, message, false), ChatCodes.PLACE_CHAT_TYPE); dispatchMessage(new TellFeedbackMessage(target, message, false),
ChatCodes.PLACE_CHAT_TYPE);
addChatter(target); addChatter(target);
if (rl != null) { if (rl != null) {
rl.requestCompleted(target); rl.requestCompleted(target);
@@ -647,7 +648,7 @@ public class ChatDirector extends BasicDirector
public void messageReceived (MessageEvent event) public void messageReceived (MessageEvent event)
{ {
if (CHAT_NOTIFICATION.equals(event.getName())) { if (CHAT_NOTIFICATION.equals(event.getName())) {
ChatMessage msg = (ChatMessage) event.getArgs()[0]; ChatMessage msg = (ChatMessage)event.getArgs()[0];
String localtype = getLocalType(event.getTargetOid()); String localtype = getLocalType(event.getTargetOid());
processReceivedMessage(msg, localtype); processReceivedMessage(msg, localtype);
} }
@@ -708,7 +709,7 @@ public class ChatDirector extends BasicDirector
String autoResponse = null; String autoResponse = null;
Name speaker = null; Name speaker = null;
Name speakerDisplay = null; Name speakerDisplay = null;
byte mode = (byte) -1; byte mode = (byte)-1;
// figure out if the message was triggered by another user // figure out if the message was triggered by another user
if (msg instanceof UserMessage) { if (msg instanceof UserMessage) {
@@ -728,7 +729,7 @@ public class ChatDirector extends BasicDirector
// And if we filter first, we could end up filtering keys. // And if we filter first, we could end up filtering keys.
msg.message = xlate(msg.bundle, msg.message); msg.message = xlate(msg.bundle, msg.message);
msg.bundle = null; msg.bundle = null;
if ((msg.message = filter(msg.message, speaker, false)) == null) { if ((msg.message = filter(msg.message, speaker, false)) == null) {
return; return;
} }
@@ -948,11 +949,11 @@ public class ChatDirector extends BasicDirector
* Returns a hashmap containing all command handlers that match the specified command (i.e. the * Returns a hashmap containing all command handlers that match the specified command (i.e. the
* specified command is a prefix of their registered command string). * specified command is a prefix of their registered command string).
*/ */
protected HashMap<String,CommandHandler> getCommandHandlers (String command) protected HashMap<String, CommandHandler> getCommandHandlers (String command)
{ {
HashMap<String,CommandHandler> matches = new HashMap<String,CommandHandler>(); HashMap<String, CommandHandler> matches = new HashMap<String, CommandHandler>();
BodyObject user = (BodyObject)_ctx.getClient().getClientObject(); BodyObject user = (BodyObject)_ctx.getClient().getClientObject();
for (Map.Entry<String,CommandHandler> entry : _handlers.entrySet()) { for (Map.Entry<String, CommandHandler> entry : _handlers.entrySet()) {
String cmd = entry.getKey(); String cmd = entry.getKey();
if (!cmd.startsWith(command)) { if (!cmd.startsWith(command)) {
continue; continue;
@@ -1131,7 +1132,7 @@ public class ChatDirector extends BasicDirector
} }
// handle "/help help" and "/help someboguscommand" // handle "/help help" and "/help someboguscommand"
HashMap<String,CommandHandler> possibleCommands = getCommandHandlers(hcmd); HashMap<String, CommandHandler> possibleCommands = getCommandHandlers(hcmd);
if (hcmd.equals("help") || possibleCommands.isEmpty()) { if (hcmd.equals("help") || possibleCommands.isEmpty()) {
possibleCommands = getCommandHandlers(""); possibleCommands = getCommandHandlers("");
possibleCommands.remove("help"); // remove help from the list possibleCommands.remove("help"); // remove help from the list
@@ -1260,7 +1261,7 @@ public class ChatDirector extends BasicDirector
// clear out from the history any tells that are mistypes // clear out from the history any tells that are mistypes
for (Iterator iter = _history.iterator(); iter.hasNext(); ) { for (Iterator iter = _history.iterator(); iter.hasNext(); ) {
String hist = (String) iter.next(); String hist = (String)iter.next();
if (hist.startsWith("/" + command)) { if (hist.startsWith("/" + command)) {
String harg = hist.substring(command.length() + 1).trim(); String harg = hist.substring(command.length() + 1).trim();
// we blow away any historic tells that have msg content // we blow away any historic tells that have msg content
@@ -1419,19 +1420,19 @@ public class ChatDirector extends BasicDirector
protected ObserverList<ChatterObserver> _chatterObservers = protected ObserverList<ChatterObserver> _chatterObservers =
new ObserverList<ChatterObserver>(ObserverList.SAFE_IN_ORDER_NOTIFY); new ObserverList<ChatterObserver>(ObserverList.SAFE_IN_ORDER_NOTIFY);
/** Registered chat command handlers. */
protected static HashMap<String,CommandHandler> _handlers =
new HashMap<String,CommandHandler>();
/** A history of chat commands. */
protected static ArrayList<String> _history = new ArrayList<String>();
/** Operation used to filter chat messages. */ /** Operation used to filter chat messages. */
protected FilterMessageOp _filterMessageOp = new FilterMessageOp(); protected FilterMessageOp _filterMessageOp = new FilterMessageOp();
/** Operation used to display chat messages. */ /** Operation used to display chat messages. */
protected DisplayMessageOp _displayMessageOp = new DisplayMessageOp(); protected DisplayMessageOp _displayMessageOp = new DisplayMessageOp();
/** Registered chat command handlers. */
protected static HashMap<String, CommandHandler> _handlers =
new HashMap<String, CommandHandler>();
/** A history of chat commands. */
protected static ArrayList<String> _history = new ArrayList<String>();
/** The maximum number of chatter usernames to track. */ /** The maximum number of chatter usernames to track. */
protected static final int MAX_CHATTERS = 6; protected static final int MAX_CHATTERS = 6;
@@ -33,7 +33,7 @@ public interface ChatDisplay
/** /**
* Called to clear the chat display. * Called to clear the chat display.
*/ */
public void clear (); void clear ();
/** /**
* Called to display a chat message. * Called to display a chat message.
@@ -42,6 +42,6 @@ public interface ChatDisplay
* already displayed this message, false otherwise. * already displayed this message, false otherwise.
* *
* @return true if the message was displayed, false if not. * @return true if the message was displayed, false if not.
*/ */
public boolean displayMessage (ChatMessage msg, boolean alreadyDisplayed); boolean displayMessage (ChatMessage msg, boolean alreadyDisplayed);
} }
@@ -38,5 +38,5 @@ public interface ChatFilter
* *
* @return the filtered message, or null to block it completely. * @return the filtered message, or null to block it completely.
*/ */
public String filter (String msg, Name otherUser, boolean outgoing); String filter (String msg, Name otherUser, boolean outgoing);
} }
@@ -48,7 +48,7 @@ public interface ChatService extends InvocationService
* @param awayMessage the away message configured by the told * @param awayMessage the away message configured by the told
* player or null if they have no away message. * player or null if they have no away message.
*/ */
public void tellSucceeded (long idleTime, String awayMessage); void tellSucceeded (long idleTime, String awayMessage);
} }
/** /**
@@ -61,8 +61,7 @@ public interface ChatService extends InvocationService
* @param message the contents of the message. * @param message the contents of the message.
* @param listener the reference that will receive the tell response. * @param listener the reference that will receive the tell response.
*/ */
public void tell (Client client, Name target, String message, void tell (Client client, Name target, String message, TellListener listener);
TellListener listener);
/** /**
* Requests that a message be broadcast to all users in the system. * Requests that a message be broadcast to all users in the system.
@@ -71,12 +70,11 @@ public interface ChatService extends InvocationService
* @param message the contents of the message. * @param message the contents of the message.
* @param listener the reference that will receive a failure response. * @param listener the reference that will receive a failure response.
*/ */
public void broadcast (Client client, String message, void broadcast (Client client, String message, InvocationListener listener);
InvocationListener listener);
/** /**
* Sets this client's away message. If the message is null or the * Sets this client's away message. If the message is null or the
* empty string, the away message will be cleared. * empty string, the away message will be cleared.
*/ */
public void away (Client client, String message); void away (Client client, String message);
} }
@@ -90,7 +90,7 @@ public abstract class CurseFilter implements ChatFilter
for (int ii=0, nn=_matchers.length; ii < nn; ii++) { for (int ii=0, nn=_matchers.length; ii < nn; ii++) {
Matcher m = _matchers[ii]; Matcher m = _matchers[ii];
m.reset(inbuf); m.reset(inbuf);
while (m.find()) { while (m.find()) {
switch (level) { switch (level) {
case DROP: case DROP:
return null; return null;
@@ -107,7 +107,7 @@ public abstract class CurseFilter implements ChatFilter
vernacular = vernacular.substring(0, firstCharLen).toUpperCase() + vernacular = vernacular.substring(0, firstCharLen).toUpperCase() +
vernacular.substring(firstCharLen); vernacular.substring(firstCharLen);
} }
m.appendReplacement(outbuf, m.appendReplacement(outbuf,
StringUtil.replace(_replacements[ii], " ", vernacular)); StringUtil.replace(_replacements[ii], " ", vernacular));
break; break;
} }
@@ -146,7 +146,7 @@ public abstract class CurseFilter implements ChatFilter
String mapping = st.nextToken(); String mapping = st.nextToken();
StringTokenizer st2 = new StringTokenizer(mapping, "="); StringTokenizer st2 = new StringTokenizer(mapping, "=");
if (st2.countTokens() != 2) { if (st2.countTokens() != 2) {
log.warning("Something looks wrong in the x.cursewords properties (" + log.warning("Something looks wrong in the x.cursewords properties (" +
mapping + "), skipping."); mapping + "), skipping.");
continue; continue;
} }
@@ -201,7 +201,7 @@ public abstract class CurseFilter implements ChatFilter
} }
/** /**
* Return a comicy replacement of the specified length; * Return a comicy replacement of the specified length.
*/ */
protected String comicChars (int length) protected String comicChars (int length)
{ {
@@ -229,5 +229,5 @@ public abstract class CurseFilter implements ChatFilter
protected String[] _vernacular; protected String[] _vernacular;
/** Comic replacement characters. */ /** Comic replacement characters. */
protected String[] COMIC_CHARS = { "!", "@", "#", "%", "&", "*" }; protected static final String[] COMIC_CHARS = { "!", "@", "#", "%", "&", "*" };
} }
@@ -50,7 +50,7 @@ public class MuteDirector extends BasicDirector
/** /**
* The specified player was added or removed from the mutelist. * The specified player was added or removed from the mutelist.
*/ */
public void muteChanged (Name playername, boolean nowMuted); void muteChanged (Name playername, boolean nowMuted);
} }
/** /**
@@ -122,8 +122,7 @@ public class MuteDirector extends BasicDirector
*/ */
public void setMuted (Name username, boolean mute) public void setMuted (Name username, boolean mute)
{ {
boolean changed = mute ? _mutelist.add(username) boolean changed = mute ? _mutelist.add(username) : _mutelist.remove(username);
: _mutelist.remove(username);
String feedback; String feedback;
if (mute) { if (mute) {
feedback = "m.muted"; feedback = "m.muted";
@@ -132,8 +131,7 @@ public class MuteDirector extends BasicDirector
} }
// always give some feedback to the user // always give some feedback to the user
_chatdir.displayFeedback(null, _chatdir.displayFeedback(null, MessageBundle.tcompose(feedback, username));
MessageBundle.tcompose(feedback, username));
// if the mutelist actually changed, notify observers // if the mutelist actually changed, notify observers
if (changed) { if (changed) {
@@ -144,8 +142,7 @@ public class MuteDirector extends BasicDirector
/** /**
* @return a list of the currently muted players. * @return a list of the currently muted players.
* *
* This list may be out of date immediately upon returning from this * This list may be out of date immediately upon returning from this method.
* method.
*/ */
public Name[] getMuted () public Name[] getMuted ()
{ {
@@ -41,5 +41,5 @@ public interface SpeakService extends InvocationService
* application specific manner. It's useful for differentiating * application specific manner. It's useful for differentiating
* between regular speech, emotes, etc. * between regular speech, emotes, etc.
*/ */
public void speak (Client client, String message, byte mode); void speak (Client client, String message, byte mode);
} }
@@ -66,10 +66,10 @@ public abstract class ChatMessage
* Once this message reaches the client, the information contained within is changed around a * Once this message reaches the client, the information contained within is changed around a
* bit. * bit.
*/ */
public void setClientInfo (String msg, String localtype) public void setClientInfo (String msg, String ltype)
{ {
message = msg; message = msg;
this.localtype = localtype; localtype = ltype;
bundle = null; bundle = null;
timestamp = System.currentTimeMillis(); timestamp = System.currentTimeMillis();
} }
@@ -24,9 +24,8 @@ package com.threerings.crowd.chat.data;
import com.threerings.util.Name; import com.threerings.util.Name;
/** /**
* Provides a mechanism by which the speak service can identify chat * Provides a mechanism by which the speak service can identify chat listeners so as to maintain a
* listeners so as to maintain a recent history of all chat traffic on the * recent history of all chat traffic on the server.
* server.
*/ */
public interface SpeakObject public interface SpeakObject
{ {
@@ -34,16 +33,15 @@ public interface SpeakObject
public static interface ListenerOp public static interface ListenerOp
{ {
/** Call this method if you only have access to body oids. */ /** Call this method if you only have access to body oids. */
public void apply (int bodyOid); void apply (int bodyOid);
/** Call this method if you can provide usernames directly. */ /** Call this method if you can provide usernames directly. */
public void apply (Name username); void apply (Name username);
} }
/** /**
* The speak service will call this every time a chat message is * The speak service will call this every time a chat message is delivered on this speak object
* delivered on this speak object to note the listeners that * to note the listeners that received the message.
* received the message.
*/ */
public void applyToListeners (ListenerOp op); void applyToListeners (ListenerOp op);
} }
@@ -79,6 +79,7 @@ public class UserMessage extends ChatMessage
case ChatCodes.EMOTE_MODE: return "m.emote_format"; case ChatCodes.EMOTE_MODE: return "m.emote_format";
case ChatCodes.SHOUT_MODE: return "m.shout_format"; case ChatCodes.SHOUT_MODE: return "m.shout_format";
case ChatCodes.BROADCAST_MODE: return "m.broadcast_format"; case ChatCodes.BROADCAST_MODE: return "m.broadcast_format";
default: // fall through
} }
if (ChatCodes.USER_CHAT_TYPE.equals(localtype)) { if (ChatCodes.USER_CHAT_TYPE.equals(localtype)) {
@@ -65,7 +65,7 @@ public class ChatProvider
* Called following the delivery of <code>message</code> from <code>teller</code> to * Called following the delivery of <code>message</code> from <code>teller</code> to
* <code>tellee</code>. * <code>tellee</code>.
*/ */
public void sentTell (BodyObject teller, BodyObject tellee, String message); void sentTell (BodyObject teller, BodyObject tellee, String message);
} }
/** Used to forward certain types of chat messages between servers in a multi-server setup. */ /** Used to forward certain types of chat messages between servers in a multi-server setup. */
@@ -76,12 +76,12 @@ public class ChatProvider
* *
* @return true if the tell was delivered, false otherwise. * @return true if the tell was delivered, false otherwise.
*/ */
public boolean forwardTell (UserMessage message, Name target, TellListener listener); boolean forwardTell (UserMessage message, Name target, TellListener listener);
/** /**
* Requests that the supplied broadcast message be delivered on other servers. * Requests that the supplied broadcast message be delivered on other servers.
*/ */
public void forwardBroadcast (Name from, String bundle, String msg, boolean attention); void forwardBroadcast (Name from, String bundle, String msg, boolean attention);
} }
/** /**
@@ -48,11 +48,10 @@ public class SpeakHandler
public static interface SpeakerValidator public static interface SpeakerValidator
{ {
/** /**
* Should return true if the supplied speaker is allowed to speak * Should return true if the supplied speaker is allowed to speak via the speak provider
* via the speak provider with which this validator was * with which this validator was registered.
* registered.
*/ */
public boolean isValidSpeaker (DObject speakObj, ClientObject speaker, byte mode); boolean isValidSpeaker (DObject speakObj, ClientObject speaker, byte mode);
} }
/** /**
@@ -57,7 +57,7 @@ public class SpeakUtil
/** /**
* Called for each player that hears a particular chat message. * Called for each player that hears a particular chat message.
*/ */
public void messageDelivered (Name hearer, UserMessage message); void messageDelivered (Name hearer, UserMessage message);
} }
/** /**
@@ -333,9 +333,9 @@ public class SpeakUtil
protected Name _hearer; protected Name _hearer;
protected UserMessage _message; protected UserMessage _message;
} }
/** Recent chat history for the server. */ /** Recent chat history for the server. */
protected static Map<Name,List<ChatMessage>> _histories = Maps.newHashMap(); protected static Map<Name, List<ChatMessage>> _histories = Maps.newHashMap();
/** Used to note the recipients of a chat message. */ /** Used to note the recipients of a chat message. */
protected static MessageMapper _messageMapper = new MessageMapper(); protected static MessageMapper _messageMapper = new MessageMapper();
@@ -33,5 +33,5 @@ public interface BodyService extends InvocationService
* Requests to set the idle state of the client to the specified * Requests to set the idle state of the client to the specified
* value. * value.
*/ */
public void setIdle (Client client, boolean idle); void setIdle (Client client, boolean idle);
} }
@@ -60,7 +60,7 @@ public class LocationDirector extends BasicDirector
* Should instruct the client to move to the last known working location (as well as clean * Should instruct the client to move to the last known working location (as well as clean
* up after the failed moveTo request). * up after the failed moveTo request).
*/ */
public void recoverFailedMove (int placeId); void recoverFailedMove (int placeId);
} }
/** /**
@@ -44,7 +44,7 @@ public interface LocationObserver
* @return true if it's OK for the location to change, false if the * @return true if it's OK for the location to change, false if the
* change request should be aborted. * change request should be aborted.
*/ */
public boolean locationMayChange (int placeId); boolean locationMayChange (int placeId);
/** /**
* Called when we have switched to a new location. * Called when we have switched to a new location.
@@ -52,7 +52,7 @@ public interface LocationObserver
* @param place the place object that represents the new location or * @param place the place object that represents the new location or
* null if we have switched to no location. * null if we have switched to no location.
*/ */
public void locationDidChange (PlaceObject place); void locationDidChange (PlaceObject place);
/** /**
* This is called on all location observers when a location change * This is called on all location observers when a location change
@@ -63,5 +63,5 @@ public interface LocationObserver
* @param reason the reason code that explains why the location change * @param reason the reason code that explains why the location change
* request was rejected or otherwise failed. * request was rejected or otherwise failed.
*/ */
public void locationChangeFailed (int placeId, String reason); void locationChangeFailed (int placeId, String reason);
} }
@@ -35,5 +35,5 @@ public interface LocationReceiver extends InvocationReceiver
* and the client is then responsible for generating a {@link * and the client is then responsible for generating a {@link
* LocationService#moveTo} request to move to the new location. * LocationService#moveTo} request to move to the new location.
*/ */
public void forcedMove (int placeId); void forcedMove (int placeId);
} }
@@ -27,10 +27,9 @@ import com.threerings.presents.client.InvocationService;
import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceConfig;
/** /**
* The location services provide a mechanism by which the client can * The location services provide a mechanism by which the client can request to move from place to
* request to move from place to place in the server. These services * place in the server. These services should not be used directly, but instead should be accessed
* should not be used directly, but instead should be accessed via the * via the {@link LocationDirector}.
* {@link LocationDirector}.
*/ */
public interface LocationService extends InvocationService public interface LocationService extends InvocationService
{ {
@@ -42,24 +41,21 @@ public interface LocationService extends InvocationService
/** /**
* Called in response to a successful {@link #moveTo} request. * Called in response to a successful {@link #moveTo} request.
*/ */
public void moveSucceeded (PlaceConfig config); void moveSucceeded (PlaceConfig config);
} }
/** /**
* Requests that this client's body be moved to the specified * Requests that this client's body be moved to the specified location.
* location.
* *
* @param client a reference to the client object that defines the * @param client a reference to the client object that defines the context in which this
* context in which this invocation service should be executed. * invocation service should be executed.
* @param placeId the object id of the place object to which the body * @param placeId the object id of the place object to which the body should be moved.
* should be moved. * @param listener the listener that will be informed of success or failure.
* @param listener the listener that will be informed of success or
* failure.
*/ */
public void moveTo (Client client, int placeId, MoveListener listener); void moveTo (Client client, int placeId, MoveListener listener);
/** /**
* Requests that we leave our current place and move to nowhere land. * Requests that we leave our current place and move to nowhere land.
*/ */
public void leavePlace (Client client); void leavePlace (Client client);
} }
@@ -176,8 +176,8 @@ public class OccupantDirector extends BasicDirector
} }
// now let the occupant observers know what's up // now let the occupant observers know what's up
final OccupantInfo info = (OccupantInfo) event.getEntry(); final OccupantInfo info = (OccupantInfo)event.getEntry();
final OccupantInfo oinfo = (OccupantInfo) event.getOldEntry(); final OccupantInfo oinfo = (OccupantInfo)event.getOldEntry();
_observers.apply(new ObserverList.ObserverOp<OccupantObserver>() { _observers.apply(new ObserverList.ObserverOp<OccupantObserver>() {
public boolean apply (OccupantObserver observer) { public boolean apply (OccupantObserver observer) {
observer.occupantUpdated(oinfo, info); observer.occupantUpdated(oinfo, info);
@@ -197,7 +197,7 @@ public class OccupantDirector extends BasicDirector
} }
// let the occupant observers know what's up // let the occupant observers know what's up
final OccupantInfo oinfo = (OccupantInfo) event.getOldEntry(); final OccupantInfo oinfo = (OccupantInfo)event.getOldEntry();
_observers.apply(new ObserverList.ObserverOp<OccupantObserver>() { _observers.apply(new ObserverList.ObserverOp<OccupantObserver>() {
public boolean apply (OccupantObserver observer) { public boolean apply (OccupantObserver observer) {
observer.occupantLeft(oinfo); observer.occupantLeft(oinfo);
@@ -33,12 +33,12 @@ public interface OccupantObserver
/** /**
* Called when a body enters the place. * Called when a body enters the place.
*/ */
public void occupantEntered (OccupantInfo info); void occupantEntered (OccupantInfo info);
/** /**
* Called when a body leaves the place. * Called when a body leaves the place.
*/ */
public void occupantLeft (OccupantInfo info); void occupantLeft (OccupantInfo info);
/** /**
* Called when an occupant is updated. * Called when an occupant is updated.
@@ -46,5 +46,5 @@ public interface OccupantObserver
* @param oldinfo the occupant info prior to the update. * @param oldinfo the occupant info prior to the update.
* @param newinfo the newly update info record. * @param newinfo the newly update info record.
*/ */
public void occupantUpdated (OccupantInfo oldinfo, OccupantInfo newinfo); void occupantUpdated (OccupantInfo oldinfo, OccupantInfo newinfo);
} }