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

public class CloudPlayer extends CloudOfflinePlayer
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
  • Field Details

  • 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

      @NonNull public @NonNull NetworkServiceInfo loginService()
      Gets the service info of the proxy the player used to connect to the network.
      Returns:
      the service info of the proxy.
    • loginService

      public void loginService(@NonNull @NonNull NetworkServiceInfo 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

      @Nullable public @Nullable NetworkServiceInfo 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

      public void connectedService(@Nullable @Nullable NetworkServiceInfo connectedService)
      Sets the downstream service the player is currently connected to.
      Parameters:
      connectedService - the downstream service the player is connected to.
    • networkPlayerProxyInfo

      @NonNull public @NonNull NetworkPlayerProxyInfo networkPlayerProxyInfo()
      Gets the network player proxy info for the current connection between the player and the proxy.
      Returns:
      the network player proxy info.
    • networkPlayerServerInfo

      @Nullable public @Nullable NetworkPlayerServerInfo 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

      @NonNull public @NonNull eu.cloudnetservice.driver.document.Document onlineProperties()
      Gets all properties of the player that are only present when online. These properties are not persisted in the database and are lost after the player disconnects.
      Returns:
      the online properties of the player.
    • 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.