Interface ProxiedPlayer

    • Method Detail

      • getDisplayName

        String getDisplayName()
        Gets this player's display name.
        Returns:
        the players current display name
      • setDisplayName

        void setDisplayName​(String name)
        Sets this players display name to be used by bungeecord commands and plugins.
        Parameters:
        name - the name to set
      • sendMessage

        void sendMessage​(ChatMessageType position,
                         BaseComponent... message)
        Send a message to the specified screen position of this player.
        Parameters:
        position - the screen position
        message - the message to send
      • sendMessage

        void sendMessage​(ChatMessageType position,
                         BaseComponent message)
        Send a message to the specified screen position of this player.
        Parameters:
        position - the screen position
        message - the message to send
      • sendMessage

        void sendMessage​(UUID sender,
                         BaseComponent... message)
        Send a message to this player.
        Parameters:
        sender - the sender of the message
        message - the message to send
      • sendMessage

        void sendMessage​(UUID sender,
                         BaseComponent message)
        Send a message to this player.
        Parameters:
        sender - the sender of the message
        message - the message to send
      • connect

        void connect​(ServerInfo target)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
      • connect

        void connect​(ServerInfo target,
                     ServerConnectEvent.Reason reason)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
        reason - the reason for connecting to the new server
      • connect

        void connect​(ServerInfo target,
                     Callback<Boolean> callback)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
        callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).
      • connect

        void connect​(ServerInfo target,
                     Callback<Boolean> callback,
                     boolean retry)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
        callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success or failure.
        retry - whether to retry the connection if the initial connection fails.
      • connect

        void connect​(ServerInfo target,
                     Callback<Boolean> callback,
                     boolean retry,
                     int timeout)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
        callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success or failure.
        retry - whether to retry the connection if the initial connection fails.
        timeout - timeout in milliseconds of the connection created to the target server
      • connect

        void connect​(ServerInfo target,
                     Callback<Boolean> callback,
                     ServerConnectEvent.Reason reason)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
        callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).
        reason - the reason for connecting to the new server
      • connect

        void connect​(ServerInfo target,
                     Callback<Boolean> callback,
                     boolean retry,
                     ServerConnectEvent.Reason reason,
                     int timeout)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        target - the new server to connect to
        callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success or failure.
        retry - whether to retry the connection if the initial connection fails.
        reason - the reason for connecting to the new server
        timeout - timeout in milliseconds of the connection created to the target server
      • connect

        void connect​(ServerConnectRequest request)
        Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
        Parameters:
        request - request to connect with
      • getServer

        Server getServer()
        Gets the server this player is connected to.
        Returns:
        the server this player is connected to
      • getPing

        int getPing()
        Gets the ping time between the proxy and this connection.
        Returns:
        the current ping time
      • sendData

        void sendData​(String channel,
                      byte[] data)
        Send a plugin message to this player. In recent Minecraft versions channel names must contain a colon separator and consist of [a-z0-9/._-]. This will be enforced in a future version. The "BungeeCord" channel is an exception and may only take this form.
        Parameters:
        channel - the channel to send this data via
        data - the data to send
      • getPendingConnection

        PendingConnection getPendingConnection()
        Get the pending connection that belongs to this player.
        Returns:
        the pending connection that this player used
      • chat

        void chat​(String message)
        Make this player chat (say something), to the server he is currently on.
        Parameters:
        message - the message to say
      • getReconnectServer

        ServerInfo getReconnectServer()
        Get the server which this player will be sent to next time the log in.
        Returns:
        the server, or null if default
      • setReconnectServer

        void setReconnectServer​(ServerInfo server)
        Set the server which this player will be sent to next time the log in.
        Parameters:
        server - the server to set
      • getUniqueId

        UUID getUniqueId()
        Get this connection's UUID, if set.
        Returns:
        the UUID
      • getLocale

        Locale getLocale()
        Gets this player's locale.
        Returns:
        the locale
      • getViewDistance

        byte getViewDistance()
        Gets this player's view distance.
        Returns:
        the view distance, or a reasonable default
      • getChatMode

        ProxiedPlayer.ChatMode getChatMode()
        Gets this player's chat mode.
        Returns:
        the chat flags set, or a reasonable default
      • hasChatColors

        boolean hasChatColors()
        Gets if this player has chat colors enabled or disabled.
        Returns:
        if chat colors are enabled
      • getSkinParts

        SkinConfiguration getSkinParts()
        Gets this player's skin settings.
        Returns:
        the players skin setting
      • getMainHand

        ProxiedPlayer.MainHand getMainHand()
        Gets this player's main hand setting.
        Returns:
        main hand setting
      • setTabHeader

        void setTabHeader​(BaseComponent header,
                          BaseComponent footer)
        Set the header and footer displayed in the tab player list.
        Parameters:
        header - The header for the tab player list, null to clear it.
        footer - The footer for the tab player list, null to clear it.
      • setTabHeader

        void setTabHeader​(BaseComponent[] header,
                          BaseComponent[] footer)
        Set the header and footer displayed in the tab player list.
        Parameters:
        header - The header for the tab player list, null to clear it.
        footer - The footer for the tab player list, null to clear it.
      • resetTabHeader

        void resetTabHeader()
        Clears the header and footer displayed in the tab player list.
      • isForgeUser

        boolean isForgeUser()
        Gets whether this player is using a FML client.

        This method is only reliable if BungeeCord links Minecraft 1.8 servers together, as Bungee can pick up whether a user is a Forge user with the initial handshake. If this is used for a 1.7 network, this might return false even if the user is a FML user, as Bungee can only determine this information if a handshake successfully completes.

        Returns:
        true if it is known that the user is using a FML client, false otherwise.
      • getModList

        Map<String,​String> getModList()
        Gets this player's Forge Mod List, if the player has sent this information during the lifetime of their connection to Bungee. There is no guarantee that information is available at any time, as it is only sent during a FML handshake. Therefore, this will only contain information for a user that has attempted joined a Forge server.

        Consumers of this API should be aware that an empty mod list does not indicate that a user is not a Forge user, and so should not use this API to check for this. See the isForgeUser method instead.

        Calling this when handling a ServerConnectedEvent may be the best place to do so as this event occurs after a FML handshake has completed, if any has occurred.

        Returns:
        A Map of mods, where the key is the name of the mod, and the value is the version. Returns an empty list if the FML handshake has not occurred for this ProxiedPlayer yet.