Interface Player
-
- All Superinterfaces:
net.kyori.adventure.audience.Audience
,ChannelMessageSink
,ChannelMessageSource
,CommandSource
,net.kyori.adventure.identity.Identified
,InboundConnection
,PermissionSubject
public interface Player extends CommandSource, net.kyori.adventure.identity.Identified, InboundConnection, ChannelMessageSource, ChannelMessageSink
Represents a player who is connected to the proxy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConnectionRequestBuilder
createConnectionRequest(RegisteredServer server)
Creates a new connection request so that the player can connect to another server.void
disconnect(net.kyori.adventure.text.Component reason)
Disconnects the player with the specified reason.java.util.Optional<ServerConnection>
getCurrentServer()
Returns the server that the player is currently connected to.GameProfile
getGameProfile()
Returns the player's game profile.java.util.Optional<ModInfo>
getModInfo()
Returns the player's mod info if they have a modded client.long
getPing()
Returns the current player's ping.PlayerSettings
getPlayerSettings()
Returns the player's client settings.TabList
getTabList()
Returns the player's tab list.java.util.UUID
getUniqueId()
Returns the player's UUID.java.lang.String
getUsername()
Returns the player's current username.boolean
isOnlineMode()
Returns the player's connection status.void
sendResourcePack(java.lang.String url)
Sends the specified resource pack fromurl
to the user.void
sendResourcePack(java.lang.String url, byte[] hash)
Sends the specified resource pack fromurl
to the user, using the specified 20-byte SHA-1 hash.void
setGameProfileProperties(java.util.List<GameProfile.Property> properties)
Sets the player's profile properties.void
spoofChatInput(java.lang.String input)
Sends chat input onto the players current server as if they typed it into the client chat box.-
Methods inherited from interface net.kyori.adventure.audience.Audience
clearTitle, hideBossBar, openBook, openBook, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound
-
Methods inherited from interface com.velocitypowered.api.proxy.messages.ChannelMessageSink
sendPluginMessage
-
Methods inherited from interface com.velocitypowered.api.proxy.connection.InboundConnection
getProtocolVersion, getRemoteAddress, getVirtualHost, isActive
-
Methods inherited from interface com.velocitypowered.api.permission.PermissionSubject
getPermissionValue, hasPermission
-
-
-
-
Method Detail
-
getUsername
java.lang.String getUsername()
Returns the player's current username.- Returns:
- the username
-
getUniqueId
java.util.UUID getUniqueId()
Returns the player's UUID.- Returns:
- the UUID
-
getCurrentServer
java.util.Optional<ServerConnection> getCurrentServer()
Returns the server that the player is currently connected to.- Returns:
- an
Optional
the server that the player is connected to, which may be empty
-
getPlayerSettings
PlayerSettings getPlayerSettings()
Returns the player's client settings.- Returns:
- the settings
-
getModInfo
java.util.Optional<ModInfo> getModInfo()
Returns the player's mod info if they have a modded client.- Returns:
- an
Optional
the mod info. which may be empty
-
getPing
long getPing()
Returns the current player's ping.- Returns:
- the player's ping or -1 if ping information is currently unknown
-
isOnlineMode
boolean isOnlineMode()
Returns the player's connection status.- Returns:
- 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.- Parameters:
server
- the server to connect to- Returns:
- a new connection request
-
setGameProfileProperties
void setGameProfileProperties(java.util.List<GameProfile.Property> properties)
Sets the player's profile properties.- Parameters:
properties
- the properties
-
getGameProfile
GameProfile getGameProfile()
Returns the player's game profile.
-
getTabList
TabList getTabList()
Returns the player's tab list.- Returns:
- this player's tab list
-
disconnect
void disconnect(net.kyori.adventure.text.Component reason)
Disconnects the player with the specified reason. Once this method is called, further calls to otherPlayer
methods will become undefined.- Parameters:
reason
- component with the reason
-
spoofChatInput
void spoofChatInput(java.lang.String input)
Sends chat input onto the players current server as if they typed it into the client chat box.- Parameters:
input
- the chat input to send
-
sendResourcePack
void sendResourcePack(java.lang.String url)
Sends the specified resource pack fromurl
to the user. If at all possible, send the resource pack usingsendResourcePack(String, byte[])
. To monitor the status of the sent resource pack, subscribe toPlayerResourcePackStatusEvent
.- Parameters:
url
- the URL for the resource pack
-
sendResourcePack
void sendResourcePack(java.lang.String url, byte[] hash)
Sends the specified resource pack fromurl
to the user, using the specified 20-byte SHA-1 hash. To monitor the status of the sent resource pack, subscribe toPlayerResourcePackStatusEvent
.- Parameters:
url
- the URL for the resource packhash
- the SHA-1 hash value for the resource pack
-
-