public static CallType getCallType( Method m ) { if( m.getReturnType() != Void.TYPE ) return CallType.Synchronous; if( m.getAnnotation(Oneway.class) != null ) return CallType.Asynchronous; if( m.getAnnotation(Asynchronous.class) == null ) return CallType.Synchronous; Asynchronous async = m.getAnnotation(Asynchronous.class); return async.reliable() ? CallType.Asynchronous : CallType.Unreliable; }
/** * Called when a new player has joined the chat. */ @Asynchronous public void playerJoined(int playerId, String playerName);
/** * Sends a new message to the chat. */ @Asynchronous public void sendMessage( String message );
/** * Set us ready, or unready * * @param ready whether we are ready or not */ @Asynchronous public void setReady(boolean ready);
public static CallType getCallType( Method m ) { if( m.getReturnType() != Void.TYPE ) return CallType.Synchronous; if( m.getAnnotation(Oneway.class) != null ) return CallType.Asynchronous; if( m.getAnnotation(Asynchronous.class) == null ) return CallType.Synchronous; Asynchronous async = m.getAnnotation(Asynchronous.class); return async.reliable() ? CallType.Asynchronous : CallType.Unreliable; }
/** * Called when the player list needs refreshing * * @param players the list of players */ @Asynchronous public void onPlayerListChanged(List<ClientInfo> players);
/** * Called when the server has changed the map * * @param mapName the currently selected map */ @Asynchronous public void onMapChanged(String mapName);
/** * Called when a player has sent a message to the chat. */ @Asynchronous public void newMessage(int playerId, Short keeperId, String playerName, String message);
/** * Called when an existing player has left the chat. */ @Asynchronous public void playerLeft(int playerId, String playerName);
/** * Called by the server to provide login status to the client after * a login attempt. */ @Asynchronous public void notifyLoginStatus( boolean loggedIn ); }
/** * Called by the client to provide the player name for this connection and * "login" to the game. The server will respond asynchronously with a * notifyLoginStatus() to the client's AccountSessionListener. Note: this * could have been done synchronously but synchronous calls should generally * be avoided when they can. a) it prevents odd logic deadlocks if one isn't * careful, and b) it makes user interfaces automatically more responsive * without having to write special background worker code. When possible, go * asynchronous. */ @Asynchronous public void login(String playerName, int systemMemory); }