Class CloudPlayer
java.lang.Object
eu.cloudnetservice.modules.bridge.player.CloudOfflinePlayer
eu.cloudnetservice.modules.bridge.player.CloudPlayer
- All Implemented Interfaces:
eu.cloudnetservice.driver.base.Named,eu.cloudnetservice.driver.document.property.DefaultedDocPropertyHolder,eu.cloudnetservice.driver.document.property.DocPropertyHolder,Cloneable
The online player is a player who is currently connected to one of the proxies. The player is in the cache of each
node as long as he is online.
Obtain an online player using PlayerManager.onlinePlayer(UUID).
If you want to interact with a player use the
PlayerExecutor instead.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.cloudnetservice.driver.document.property.DefaultedDocPropertyHolder
eu.cloudnetservice.driver.document.property.DefaultedDocPropertyHolder.Mutable<S extends eu.cloudnetservice.driver.document.property.DocPropertyHolder.Mutable<S>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NetworkServiceInfoprotected NetworkServiceInfoprotected final NetworkPlayerProxyInfoprotected NetworkPlayerServerInfoprotected eu.cloudnetservice.driver.document.DocumentFields inherited from class eu.cloudnetservice.modules.bridge.player.CloudOfflinePlayer
firstLoginTimeMillis, lastLoginTimeMillis, lastNetworkPlayerProxyInfo, name, properties -
Constructor Summary
ConstructorsConstructorDescriptionCloudPlayer(@NonNull NetworkPlayerProxyInfo networkPlayerProxyInfo, @NonNull NetworkServiceInfo loginService, @NonNull NetworkServiceInfo connectedService, @Nullable NetworkPlayerServerInfo networkPlayerServerInfo, @NonNull eu.cloudnetservice.driver.document.Document onlineProperties, @NonNull String name, long firstLoginTimeMillis, long lastLoginTimeMillis, @NonNull NetworkPlayerProxyInfo lastNetworkPlayerProxyInfo, @NonNull eu.cloudnetservice.driver.document.Document properties) Constructs a new online cloud player. -
Method Summary
Modifier and TypeMethodDescriptionGets the downstream service the player is connected to.voidconnectedService(@Nullable NetworkServiceInfo connectedService) Sets the downstream service the player is currently connected to.Gets the service info of the proxy the player used to connect to the network.voidloginService(@NonNull NetworkServiceInfo loginService) Sets the login service info that indicates the proxy the player used to connect to the network.Gets the network player proxy info for the current connection between the player and the proxy.Gets the network player server info for the player and the downstream service the player is connected to.voidnetworkPlayerServerInfo(@NonNull NetworkPlayerServerInfo networkPlayerServerInfo) Sets the network player info to the given server info.@NonNull eu.cloudnetservice.driver.document.DocumentGets all properties of the player that are only present when online.voidonlineProperties(@NonNull eu.cloudnetservice.driver.document.Document onlineProperties) Sets the online properties of this cloud player.Methods inherited from class eu.cloudnetservice.modules.bridge.player.CloudOfflinePlayer
clone, firstLoginTimeMillis, lastLoginTimeMillis, lastNetworkPlayerProxyInfo, lastNetworkPlayerProxyInfo, name, offlineCopy, propertyHolder, uniqueId, xBoxIdMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.cloudnetservice.driver.document.property.DefaultedDocPropertyHolder
propertyAbsent, propertyPresent, readProperty, readPropertyOrDefault, readPropertyOrGet, readPropertyOrThrow, readPropertyOrThrow
-
Field Details
-
networkPlayerProxyInfo
-
loginService
-
connectedService
-
networkPlayerServerInfo
-
onlineProperties
protected eu.cloudnetservice.driver.document.Document onlineProperties
-
-
Constructor Details
-
CloudPlayer
public CloudPlayer(@NonNull @NonNull NetworkPlayerProxyInfo networkPlayerProxyInfo, @NonNull @NonNull NetworkServiceInfo loginService, @NonNull @NonNull NetworkServiceInfo connectedService, @Nullable @Nullable NetworkPlayerServerInfo networkPlayerServerInfo, @NonNull @NonNull eu.cloudnetservice.driver.document.Document onlineProperties, @NonNull @NonNull String name, long firstLoginTimeMillis, long lastLoginTimeMillis, @NonNull @NonNull NetworkPlayerProxyInfo lastNetworkPlayerProxyInfo, @NonNull @NonNull eu.cloudnetservice.driver.document.Document properties) Constructs a new online cloud player.- Parameters:
networkPlayerProxyInfo- the player proxy info for the player.loginService- the service that was used to connect to the network.connectedService- the downstream service the player is connected to.networkPlayerServerInfo- the player server info for the player - null if there is no downstream service.onlineProperties- all properties of the player that are only present when online.name- the name of the cloud player.firstLoginTimeMillis- the time-stamp the player connected the first time.lastLoginTimeMillis- the time-stamp the player connected the last time.properties- the properties of the offline player that are persisted in the database.- Throws:
NullPointerException- if the given login service, connected service, proxy info, online properties, name, last proxy info or properties is null.
-
-
Method Details
-
loginService
Gets the service info of the proxy the player used to connect to the network.- Returns:
- the service info of the proxy.
-
loginService
Sets the login service info that indicates the proxy the player used to connect to the network.- Parameters:
loginService- the login service info to set.- Throws:
NullPointerException- if the given login service is null.
-
connectedService
Gets the downstream service the player is connected to. Initially this is the proxy service until the player is connected to the fallback. Might be null if the player is not connected to a known downstream service.- Returns:
- the downstream service the player is connected to, null if the player is not connected to one.
-
connectedService
Sets the downstream service the player is currently connected to.- Parameters:
connectedService- the downstream service the player is connected to.
-
networkPlayerProxyInfo
Gets the network player proxy info for the current connection between the player and the proxy.- Returns:
- the network player proxy info.
-
networkPlayerServerInfo
Gets the network player server info for the player and the downstream service the player is connected to.- Returns:
- the network player server info of the downstream the player is connected to, null if the player is not connected to any downstream service.
-
networkPlayerServerInfo
public void networkPlayerServerInfo(@NonNull @NonNull NetworkPlayerServerInfo networkPlayerServerInfo) Sets the network player info to the given server info. Indicating a new downstream service the player is connected to.- Parameters:
networkPlayerServerInfo- the new player server info.- Throws:
NullPointerException- if the given server info is null.
-
onlineProperties
-
onlineProperties
public void onlineProperties(@NonNull @NonNull eu.cloudnetservice.driver.document.Document onlineProperties) Sets the online properties of this cloud player.- Parameters:
onlineProperties- the properties to set.- Throws:
NullPointerException- if the given properties are null.
-