Reject Public Message in event handler?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

brendan7
Posts: 43
Joined: 10 Feb 2014, 17:40

Reject Public Message in event handler?

Postby brendan7 » 15 Dec 2015, 23:29

Does anybody know of a way to let a public message "bounce/ghost" from within the event handler? I would like to apply a filter to messages (not just regex) and make some not appear.

Code: Select all

public class PublicMessageHandler extends BaseServerEventHandler {
   
   @Override
   public void handleServerEvent(ISFSEvent event) throws SFSException
   {
         String message = (String) event.getParameter(SFSEventParam.MESSAGE);

                   if(isMessageBad(message)){
                        foo..................
                   }
    }

}
brendan7
Posts: 43
Joined: 10 Feb 2014, 17:40

Re: Reject Public Message in event handler?

Postby brendan7 » 15 Dec 2015, 23:37

Nevermind, just found the SysControllerFilter classes, those seem like the way to go.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Reject Public Message in event handler?

Postby Lapo » 16 Dec 2015, 18:24

Yes, that's a good way :)
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 86 guests