Package net.md_5.bungee.api.connection
Interface ProxiedPlayer
- All Superinterfaces:
CommandSender
,Connection
- All Known Subinterfaces:
ConnectedPlayer
Represents a player whose connection is being connected to somewhere else,
whether it be a remote or embedded server.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Represents the player's chat state.static enum
Nested classes/interfaces inherited from interface net.md_5.bungee.api.connection.Connection
Connection.Unsafe
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Make this player chat (say something), to the server he is currently on.void
connect
(ServerInfo target) Connects / transfers this user to the specified connection, gracefully closing the current one.void
connect
(ServerInfo target, Callback<Boolean> callback) Connects / transfers this user to the specified connection, gracefully closing the current one.void
connect
(ServerInfo target, Callback<Boolean> callback, ServerConnectEvent.Reason reason) Connects / transfers this user to the specified connection, gracefully closing the current one.void
connect
(ServerInfo target, ServerConnectEvent.Reason reason) Connects / transfers this user to the specified connection, gracefully closing the current one.void
connect
(ServerConnectRequest request) Connects / transfers this user to the specified connection, gracefully closing the current one.Gets this player's chat mode.Gets this player's display name.Gets this player's locale.Gets this player's main hand setting.Gets this player's Forge Mod List, if the player has sent this information during the lifetime of their connection to Bungee.Get the pending connection that belongs to this player.int
getPing()
Gets the ping time between the proxy and this connection.Get the server which this player will be sent to next time the log in.Deprecated.for internal use only, setters will not have the expected effect, will not update client state, and may corrupt proxy stateGets the server this player is connected to.Gets this player's skin settings.Get this connection's UUID, if set.getUUID()
Deprecated.In favour ofgetUniqueId()
byte
Gets this player's view distance.boolean
Gets if this player has chat colors enabled or disabled.boolean
Gets whether this player is using a FML client.void
Clears the header and footer displayed in the tab player list.CompletableFuture<byte[]>
retrieveCookie
(String cookie) Retrieves a cookie from this player.void
Send a plugin message to this player.void
sendMessage
(UUID sender, BaseComponent message) Send a message to this player.void
sendMessage
(UUID sender, BaseComponent... message) Send a message to this player.void
sendMessage
(ChatMessageType position, BaseComponent message) Send a message to the specified screen position of this player.void
sendMessage
(ChatMessageType position, BaseComponent... message) Send a message to the specified screen position of this player.void
Sends aTitle
to this player.void
setDisplayName
(String name) Sets this player's display name to be used by proxy commands and plugins.void
setReconnectServer
(ServerInfo server) Set the server which this player will be sent to next time the log in.void
setTabHeader
(BaseComponent[] header, BaseComponent[] footer) Set the header and footer displayed in the tab player list.void
setTabHeader
(BaseComponent header, BaseComponent footer) Set the header and footer displayed in the tab player list.void
storeCookie
(String cookie, byte[] data) Stores a cookie in this player's client.void
Requests this player to connect to a different server specified by host and port.Methods inherited from interface net.md_5.bungee.api.CommandSender
addGroups, getGroups, getName, getPermissions, hasPermission, removeGroups, sendMessage, sendMessage, sendMessage, sendMessages, setPermission
Methods inherited from interface net.md_5.bungee.api.connection.Connection
disconnect, disconnect, disconnect, getAddress, getSocketAddress, isConnected, unsafe
-
Method Details
-
getDisplayName
String getDisplayName()Gets this player's display name.- Returns:
- the players current display name
-
setDisplayName
Sets this player's display name to be used by proxy commands and plugins.- Parameters:
name
- the name to set
-
sendMessage
Send a message to the specified screen position of this player.- Parameters:
position
- the screen positionmessage
- the message to send
-
sendMessage
Send a message to the specified screen position of this player.- Parameters:
position
- the screen positionmessage
- the message to send
-
sendMessage
Send a message to this player.- Parameters:
sender
- the sender of the messagemessage
- the message to send
-
sendMessage
Send a message to this player.- Parameters:
sender
- the sender of the messagemessage
- the message to send
-
connect
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
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 toreason
- the reason for connecting to the new server
-
connect
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 tocallback
- the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).
-
connect
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 tocallback
- 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
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
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 viadata
- 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
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
Set the server which this player will be sent to next time the log in.- Parameters:
server
- the server to set
-
getUUID
Deprecated.In favour ofgetUniqueId()
Get this connection's UUID, if set.- Returns:
- the UUID
-
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
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
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. -
sendTitle
Sends aTitle
to this player. This is the same as callingTitle.send(ProxiedPlayer)
.- Parameters:
title
- The title to send to the player.- See Also:
-
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
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 thisProxiedPlayer
yet.
-
getScoreboard
Deprecated.for internal use only, setters will not have the expected effect, will not update client state, and may corrupt proxy stateGet theScoreboard
that belongs to this player.- Returns:
- this player's
Scoreboard
-
retrieveCookie
Retrieves a cookie from this player.- Parameters:
cookie
- the resource location of the cookie, for example "bungeecord:my_cookie"- Returns:
- a
CompletableFuture
that will be completed when the Cookie response is received. If the cookie is not set in the client, theCompletableFuture
will complete with a null value - Throws:
IllegalStateException
- if the player's version is not at least 1.20.5
-
storeCookie
Stores a cookie in this player's client.- Parameters:
cookie
- the resource location of the cookie, for example "bungeecord:my_cookie"data
- the data to store in the cookie- Throws:
IllegalStateException
- if the player's version is not at least 1.20.5
-
transfer
Requests this player to connect to a different server specified by host and port. This is a client-side transfer - host and port should not specify a BungeeCord backend server.- Parameters:
host
- the host of the server to transfer toport
- the port of the server to transfer to- Throws:
IllegalStateException
- if the players version is not at least 1.20.5
-