Added getServer() and getClient() convenience methods.

experimental
Paul Speed 10 years ago
parent e000d83ae7
commit a77ed52777
  1. 10
      jme3-networking/src/main/java/com/jme3/network/service/AbstractClientService.java
  2. 9
      jme3-networking/src/main/java/com/jme3/network/service/AbstractHostedService.java

@ -32,6 +32,7 @@
package com.jme3.network.service;
import com.jme3.network.Client;
/**
* Convenient base class for ClientServices providing some default ClientService
@ -48,4 +49,13 @@ public abstract class AbstractClientService extends AbstractService<ClientServic
protected AbstractClientService() {
}
/**
* Returns the client for this client service or null if
* the service is not yet attached.
*/
protected Client getClient() {
ClientServiceManager csm = getServiceManager();
return csm == null ? null : csm.getClient();
}
}

@ -50,6 +50,15 @@ public abstract class AbstractHostedService extends AbstractService<HostedServic
protected AbstractHostedService() {
}
/**
* Returns the server for this hosted service or null if
* the service is not yet attached.
*/
protected Server getServer() {
HostedServiceManager hsm = getServiceManager();
return hsm == null ? null : hsm.getServer();
}
/**
* Default implementation does nothing. Implementations can

Loading…
Cancel
Save