public interface Player extends CommandSource, InboundConnection, ChannelMessageSource, ChannelMessageSink
| Modifier and Type | Method and Description |
|---|---|
void |
clearHeaderAndFooter()
Deprecated.
|
ConnectionRequestBuilder |
createConnectionRequest(RegisteredServer server)
Creates a new connection request so that the player can connect to another server.
|
void |
disconnect(Component reason)
Disconnects the player with the specified reason.
|
Optional<ServerConnection> |
getCurrentServer()
Returns the server that the player is currently connected to.
|
GameProfile |
getGameProfile()
Returns the player's game profile.
|
List<GameProfile.Property> |
getGameProfileProperties()
Gets the player's profile properties.
|
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.
|
UUID |
getUniqueId()
Returns the player's UUID.
|
String |
getUsername()
Returns the player's current username.
|
default void |
sendMessage(Component component)
Sends a chat message to the player's client.
|
void |
sendMessage(Component component,
MessagePosition position)
Sends a chat message to the player's client in the specified position.
|
void |
sendResourcePack(String url)
Sends the specified resource pack from
url to the user. |
void |
sendResourcePack(String url,
byte[] hash)
Sends the specified resource pack from
url to the user, using the specified 20-byte
SHA-1 hash. |
void |
sendTitle(Title title)
Sends the specified title to the client.
|
void |
setGameProfileProperties(List<GameProfile.Property> properties)
Sets the player's profile properties.
|
void |
setHeaderAndFooter(Component header,
Component footer)
Deprecated.
|
void |
spoofChatInput(String input)
Sends chat input onto the players current server as if they typed it into the client chat box.
|
getPermissionValue, hasPermissiongetProtocolVersion, getRemoteAddress, getVirtualHost, isActivesendPluginMessageString getUsername()
UUID getUniqueId()
Optional<ServerConnection> getCurrentServer()
Optional the server that the player is connected to, which may be emptyPlayerSettings getPlayerSettings()
Optional<ModInfo> getModInfo()
Optional the mod info. which may be emptylong getPing()
default void sendMessage(Component component)
sendMessage in interface CommandSourcecomponent - the chat message to sendvoid sendMessage(Component component, MessagePosition position)
component - the chat message to sendposition - the position for the messageConnectionRequestBuilder createConnectionRequest(RegisteredServer server)
server - the server to connect toList<GameProfile.Property> getGameProfileProperties()
The returned list may be unmodifiable.
void setGameProfileProperties(List<GameProfile.Property> properties)
properties - the propertiesGameProfile getGameProfile()
@Deprecated void setHeaderAndFooter(Component header, Component footer)
TabList.setHeaderAndFooter(Component, Component).header - the header componentfooter - the footer component@Deprecated void clearHeaderAndFooter()
TabList.clearHeaderAndFooter().TabList getTabList()
void disconnect(Component reason)
Player methods will become undefined.reason - component with the reasonvoid sendTitle(Title title)
title - the title to sendvoid spoofChatInput(String input)
input - the chat input to sendvoid sendResourcePack(String url)
url to the user. If at all possible, send the
resource pack using sendResourcePack(String, byte[]). To monitor the status of the
sent resource pack, subscribe to PlayerResourcePackStatusEvent.url - the URL for the resource packvoid sendResourcePack(String url, byte[] hash)
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 packhash - the SHA-1 hash value for the resource pack