Package net.md_5.bungee.api.connection
Interface ProxiedPlayer
-
- All Superinterfaces:
CommandSender
,Connection
- All Known Subinterfaces:
ConnectedPlayer
public interface ProxiedPlayer extends Connection, CommandSender
Represents a player who's connection is being connected to somewhere else, whether it be a remote or embedded server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ProxiedPlayer.ChatMode
Represents the player's chat state.static class
ProxiedPlayer.MainHand
-
Nested classes/interfaces inherited from interface net.md_5.bungee.api.connection.Connection
Connection.Unsafe
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
chat(String message)
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, boolean retry)
Connects / transfers this user to the specified connection, gracefully closing the current one.void
connect(ServerInfo target, Callback<Boolean> callback, boolean retry, int timeout)
Connects / transfers this user to the specified connection, gracefully closing the current one.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.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.ProxiedPlayer.ChatMode
getChatMode()
Gets this player's chat mode.String
getDisplayName()
Gets this player's display name.Locale
getLocale()
Gets this player's locale.ProxiedPlayer.MainHand
getMainHand()
Gets this player's main hand setting.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.PendingConnection
getPendingConnection()
Get the pending connection that belongs to this player.int
getPing()
Gets the ping time between the proxy and this connection.ServerInfo
getReconnectServer()
Get the server which this player will be sent to next time the log in.Scoreboard
getScoreboard()
Get theScoreboard
that belongs to this player.Server
getServer()
Gets the server this player is connected to.SkinConfiguration
getSkinParts()
Gets this player's skin settings.UUID
getUniqueId()
Get this connection's UUID, if set.String
getUUID()
Deprecated.In favour ofgetUniqueId()
byte
getViewDistance()
Gets this player's view distance.boolean
hasChatColors()
Gets if this player has chat colors enabled or disabled.boolean
isForgeUser()
Gets whether this player is using a FML client.void
resetTabHeader()
Clears the header and footer displayed in the tab player list.void
sendData(String channel, byte[] data)
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
sendTitle(Title title)
Sends aTitle
to this player.void
setDisplayName(String name)
Sets this players display name to be used by bungeecord 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.-
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 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 positionmessage
- 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 positionmessage
- the message to send
-
sendMessage
void sendMessage(UUID sender, BaseComponent... message)
Send a message to this player.- Parameters:
sender
- the sender of the messagemessage
- the message to send
-
sendMessage
void sendMessage(UUID sender, BaseComponent message)
Send a message to this player.- Parameters:
sender
- the sender of the messagemessage
- 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 toreason
- 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 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
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 tocallback
- 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 tocallback
- 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 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
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 tocallback
- 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 servertimeout
- 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 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
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
-
getUUID
@Deprecated String 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
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.
-
sendTitle
void sendTitle(Title title)
Sends aTitle
to this player. This is the same as callingTitle.send(ProxiedPlayer)
.- Parameters:
title
- The title to send to the player.- See Also:
Title
-
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 thisProxiedPlayer
yet.
-
getScoreboard
Scoreboard getScoreboard()
Get theScoreboard
that belongs to this player.- Returns:
- this player's
Scoreboard
-
-