@ -39,6 +39,8 @@ import com.jme3.network.message.SerializerRegistrationsMessage;
import com.jme3.network.serializing.Serializer ;
import com.jme3.network.service.AbstractClientService ;
import com.jme3.network.service.ClientServiceManager ;
import java.util.logging.Level ;
import java.util.logging.Logger ;
/ * *
@ -49,13 +51,20 @@ import com.jme3.network.service.ClientServiceManager;
public class ClientSerializerRegistrationsService extends AbstractClientService
implements MessageListener < Client > {
static final Logger log = Logger . getLogger ( SerializerRegistrationsMessage . class . getName ( ) ) ;
@Override
protected void onInitialize ( ClientServiceManager serviceManager ) {
// Make sure our message type is registered
// This is the minimum we'd need just to be able to register
// the rest... otherwise we can't even receive this message.
Serializer . registerClass ( SerializerRegistrationsMessage . class ) ;
Serializer . registerClass ( SerializerRegistrationsMessage . Registration . class ) ;
// Make sure our message type is registered if it isn't already
if ( Serializer . getSerializer ( SerializerRegistrationsMessage . class , false ) = = null ) {
// This is the minimum we'd need just to be able to register
// the rest... otherwise we can't even receive this message.
Serializer . registerClass ( SerializerRegistrationsMessage . class ) ;
Serializer . registerClass ( SerializerRegistrationsMessage . Registration . class ) ;
} else {
log . log ( Level . INFO , "Skipping registration of SerializerRegistrationsMessage." ) ;
}
// Add our listener for that message type
serviceManager . getClient ( ) . addMessageListener ( this , SerializerRegistrationsMessage . class ) ;