@pspeed : What would be the place in sim-eth-es to intercept client chat message and try parsing them (for commands that are not chat-messages). Say the client can send commands like /exitgame or /exittomainmenu etc.
I guess the server side hosted chat session that sends the message could parse and then decide to relay message to other chatters or not (based on being a chat or a command):
@Override
public void sendMessage(String message) {
//Something like here
postMessage(this, message);
}
Also: I tried finding the reference to the getPlayerNames chat session interface, but I can’t seem to find where its called. I wondered if its a chat command of some sorts, that I could mimic in my case.
Okay. I guess the intercept should start on the client, in case the command is client-centric (if not, then call rmi on hostedchatservice). Adding a sendCommand rmi interface method.
I wouldn’t even bother with that. In Mythruna, if the client doesn’t handle it then I send it on through as a chat message. Start a change message with / and it will try the client first… then the server will get a crack. Start a command with ~ and the server always gets it.
…which was the advantage to not having a special sendCommand() since the client doesn’t even look for ~… and the server just looks for any change message starting with / or ~.
public class ChatClientService
...
@Override
public void sendMessage( String message ) {
//Test for command here <----
getDelegate().sendMessage(message);
}
...
}
On the client you’d only need to check for commands if there were client-side only commands. Else you send everything through to the server and let it sort things out.
In Mythruna, I do have both… with / indicating either a client or server command (if defined on client it will run on client else pass on) and ~ indicating always a server command (useful for disambiguating in cases like /mem or /gc where as an admin I can potentially run them on both).