Interface Player

    • Method Detail

      • getUsername

        String getUsername()
        Returns the player's current username.
        the username
      • getEffectiveLocale

        @Nullable Locale getEffectiveLocale()
        Returns the locale the proxy will use to send messages translated via the Adventure global translator. By default, the value of PlayerSettings.getLocale() is used.

        This can be null when the client has not yet connected to any server.

        the locale.
      • setEffectiveLocale

        void setEffectiveLocale​(Locale locale)
        Change the locale the proxy will be translating its messages to.
        locale - the locale to translate to
      • getUniqueId

        UUID getUniqueId()
        Returns the player's UUID.
        the UUID
      • getCurrentServer

        Optional<ServerConnection> getCurrentServer()
        Returns the server that the player is currently connected to.
        an Optional the server that the player is connected to, which may be empty
      • getPlayerSettings

        PlayerSettings getPlayerSettings()
        Returns the player's client settings.
        the settings
      • getModInfo

        Optional<ModInfo> getModInfo()
        Returns the player's mod info if they have a modded client.
        an Optional the mod info. which may be empty
      • getPing

        long getPing()
        Returns the current player's ping.
        the player's ping or -1 if ping information is currently unknown
      • isOnlineMode

        boolean isOnlineMode()
        Returns the player's connection status.
        true if the player is authenticated with Mojang servers
      • createConnectionRequest

        ConnectionRequestBuilder createConnectionRequest​(RegisteredServer server)
        Creates a new connection request so that the player can connect to another server.
        server - the server to connect to
        a new connection request
      • getGameProfileProperties

        List<GameProfile.Property> getGameProfileProperties()
        Gets the player's profile properties.

        The returned list may be unmodifiable.

        the player's profile properties
      • setGameProfileProperties

        void setGameProfileProperties​(List<GameProfile.Property> properties)
        Sets the player's profile properties.
        properties - the properties
      • getGameProfile

        GameProfile getGameProfile()
        Returns the player's game profile.
      • getPlayerListHeader

        Component getPlayerListHeader()
        Returns the player's player list header.
        this player's player list header
      • getPlayerListFooter

        Component getPlayerListFooter()
        Returns the player's player list footer.
        this player's tab list
      • getTabList

        TabList getTabList()
        Returns the player's tab list.
        this player's tab list
      • disconnect

        void disconnect​(Component reason)
        Disconnects the player with the specified reason. Once this method is called, further calls to other Player methods will become undefined.
        reason - component with the reason
      • spoofChatInput

        void spoofChatInput​(String input)
        Sends chat input onto the players current server as if they typed it into the client chat box.
        input - the chat input to send
      • sendResourcePack

        void sendResourcePack​(String url,
                              byte[] hash)
        Sends the specified resource pack from url to the user, using the specified 20-byte SHA-1 hash. To monitor the status of the sent resource pack, subscribe to PlayerResourcePackStatusEvent.
        url - the URL for the resource pack
        hash - the SHA-1 hash value for the resource pack
      • getAppliedResourcePack

        @Nullable ResourcePackInfo getAppliedResourcePack()
        Gets the ResourcePackInfo of the currently applied resource-pack or null if none.
        the applied resource pack or null if none.
      • getPendingResourcePack

        @Nullable ResourcePackInfo getPendingResourcePack()
        Gets the ResourcePackInfo of the resource pack the user is currently downloading or is currently prompted to install or null if none.
        the pending resource pack or null if none
      • sendPluginMessage

        boolean sendPluginMessage​(ChannelIdentifier identifier,
                                  byte[] data)
        Note that this method does not send a plugin message to the server the player is connected to. You should only use this method if you are trying to communicate with a mod that is installed on the player's client. To send a plugin message to the server from the player, you should use the equivalent method on the instance returned by getCurrentServer().
        Specified by:
        sendPluginMessage in interface ChannelMessageSink
        identifier - the channel identifier to send the message on
        data - the data to send
        whether or not the message could be sent
      • key

        default @NotNull net.kyori.adventure.key.Key key()
        Specified by:
        key in interface net.kyori.adventure.key.Keyed
      • getClientBrand

        @Nullable String getClientBrand()
        Gets the player's client brand.
        the player's client brand