Interface Client


public interface Client
A player session represents the state of an online player and its corresponding web client connection. It's used to interact with the webclient, determine and change state and hook back into the platform specific user object.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the actor of the underlying User (usually a player)
    int
    Get the volume of the client (media volume, 0-100, -1 if unknown or not applicable)
    boolean
    If this session has an active voice chat instance
    boolean
    If this client currently has the web session open
    boolean
    If this the actor's microphone is muted, false if the actor is not in a voice chat
    boolean
    If the actor is currently in moderation mode
    void
    kickProximityPeer(@NotNull Client otherClient)
    Forcefully remove a player from my proximity chat peers.
    void
    onConnect(Runnable runnable)
    Add a on connect handler, which fires when the client gets opened for the player
    void
    Add a on connect handler, which fires when the client gets closed for by player
    void
    playMedia(@NotNull Media media)
    Play a media for this client
  • Method Details

    • getActor

      Actor getActor()
      Get the actor of the underlying User (usually a player)
      Returns:
      the actor
    • onConnect

      void onConnect(Runnable runnable)
      Add a on connect handler, which fires when the client gets opened for the player
      Parameters:
      runnable - Handler
    • onDisconnect

      void onDisconnect(Runnable runnable)
      Add a on connect handler, which fires when the client gets closed for by player
      Parameters:
      runnable - Handler
    • isConnected

      boolean isConnected()
      If this client currently has the web session open
      Returns:
      if the client is connected
    • hasVoicechatEnabled

      boolean hasVoicechatEnabled()
      If this session has an active voice chat instance
      Returns:
      if the client is in a voice chat
    • isMicrophoneMuted

      boolean isMicrophoneMuted()
      If this the actor's microphone is muted, false if the actor is not in a voice chat
      Returns:
      if the microphone is muted
    • getVolume

      int getVolume()
      Get the volume of the client (media volume, 0-100, -1 if unknown or not applicable)
      Returns:
      the volume
    • isModerating

      boolean isModerating()
      If the actor is currently in moderation mode
      Returns:
      if the actor is moderating
    • playMedia

      void playMedia(@NotNull @NotNull Media media)
      Play a media for this client
      Parameters:
      media - the media to play
    • kickProximityPeer

      void kickProximityPeer(@NotNull @NotNull Client otherClient)
      Forcefully remove a player from my proximity chat peers. This will cause the otherClient to trigger a new ClientPeerAddEvent Useful for refreshing peers when someone changes game modes, for example. This method will not do anything if this user isn't in voice chat, if they aren't a peer, or if the other client isn't in voice chat. This action is **one-sided**. The other client will still be listening to this client.
      Parameters:
      otherClient - the client to remove