Package me.neznamy.tab.api
Interface TabPlayer
public interface TabPlayer
An interface representing a player
-
Method Summary
Modifier and TypeMethodDescriptionvoidRefreshes all visuals on the playerio.netty.channel.ChannelReturns player's netty channel.intReturns GameMode of the player (0 for survival, 1 creative, 2 adventure, 3 spectator)getGroup()Returns player's primary permission group.getName()Returns player's nameReturns player's game profile name as seen by other players.intgetPing()Returns player's ping calculated by serverReturns platform-specific entitygetProperty(String name) Returns player's property by nameReturns player's current server name on BungeeCord (on bukkit this returns "N/A")getSkin()Returns player's skin dataReturns player's uuid used in TabList.Returns name of player's scoreboard team ornullif NameTag feature is disabledReturns user-friendly explanation of team nameReturns player's UUIDReturns player's protocol versiongetWorld()Returns player's current world name (on BungeeCord this requires bridge installed)booleanReturnstrueif player has invisibility potion,falseif not.booleanhasPermission(String permission) Performs platform-specific API call to check for permission and returns the resultbooleanReturns temporary group applied to the player usingsetTemporaryGroup(String).booleanReturnstrueif this is a bedrock player,falseif notbooleanReturnstrueif player is disguised using LibsDisguises,falseif notbooleanisLoaded()Returns true once the player is successfully loaded (onJoin method ran through all methods)booleanisOnline()Calls platform-specific method and returns the resultbooleanChecks if player is vanished using any supported vanish plugin and returns the result.booleanloadPropertyFromConfig(TabFeature feature, String property) Loads property from config using standard property loading algorithmbooleanloadPropertyFromConfig(TabFeature feature, String property, String ifNotSet) Loads property from config using standard property loading algorithm.voidResets temporary group assigned usingsetTemporaryGroup(String).voidsendCustomPacket(TabPacket packet) Sends the player a custom universal packetvoidsendCustomPacket(TabPacket packet, String feature) Sends the player a custom universal packet and adds that packet into counter that is displayed in /tab cpuvoidsendCustomPacket(TabPacket packet, TabFeature feature) Sends the player a custom universal packet and adds that packet into counter that is displayed in /tab cpuvoidsendMessage(String message, boolean translateColors) Sends a message to the playervoidsendMessage(IChatBaseComponent message) Sends specified component as a chat messagevoidsendPacket(Object packet) Sends the player a platform-specific packetbooleansetProperty(TabFeature feature, String identifier, String rawValue) Sets property with specified name to new value.voidsetTemporaryGroup(String group) Temporarily overrides player's group and applies all changes coming from new group.
-
Method Details
-
forceRefresh
void forceRefresh()Refreshes all visuals on the player -
getName
String getName()Returns player's name- Returns:
- Player's name
-
getUniqueId
UUID getUniqueId()Returns player's UUID- Returns:
- Player's UUID
-
getTablistUUID
UUID getTablistUUID()Returns player's uuid used in TabList. This may only be different from real uuid if TAB is installed on velocity with some specific velocity setup- Returns:
- player's uuid in TabList
-
getVersion
ProtocolVersion getVersion()Returns player's protocol version- Returns:
- player's protocol version
-
getPlayer
Object getPlayer()Returns platform-specific entity- Returns:
- an instance of bukkit/bungee player depending on platform
-
getWorld
String getWorld()Returns player's current world name (on BungeeCord this requires bridge installed)- Returns:
- name of world where player is currently in, "N/A" on BungeeCord if bridge is not installed
-
getServer
String getServer()Returns player's current server name on BungeeCord (on bukkit this returns "N/A")- Returns:
- name of server where player is currently in, "N/A" on bukkit
-
hasPermission
Performs platform-specific API call to check for permission and returns the result- Parameters:
permission- the permission to check for- Returns:
- true if player has permission, false if not
-
sendCustomPacket
Sends the player a custom universal packet- Parameters:
packet- packet to send
-
sendCustomPacket
Sends the player a custom universal packet and adds that packet into counter that is displayed in /tab cpu- Parameters:
packet- packet to sendfeature- feature to increment sent packet counter of
-
sendCustomPacket
Sends the player a custom universal packet and adds that packet into counter that is displayed in /tab cpu- Parameters:
packet- packet to sendfeature- feature to increment sent packet counter of
-
sendPacket
Sends the player a platform-specific packet- Parameters:
packet- an instance of packet depending on platform
-
getProperty
Returns player's property by name- Parameters:
name- name of property- Returns:
- the property or
nullif not found
-
sendMessage
Sends a message to the player- Parameters:
message- message to be senttranslateColors- whether colors should be translated or not
-
sendMessage
Sends specified component as a chat message- Parameters:
message- message to send
-
getChannel
io.netty.channel.Channel getChannel()Returns player's netty channel. On servers running version 1.7 or older returnsnull.- Returns:
- player's channel
-
getPing
int getPing()Returns player's ping calculated by server- Returns:
- player's ping
-
getSkin
Skin getSkin()Returns player's skin data- Returns:
- player's skin
-
isLoaded
boolean isLoaded()Returns true once the player is successfully loaded (onJoin method ran through all methods)- Returns:
trueif player is fully loaded,falseotherwise
-
setProperty
Sets property with specified name to new value. If property did not exist before, it is created andtrueis returned. If it existed, it is overridden andtrueis returned.falseis returned otherwise.- Parameters:
feature- feature using this property to get placeholders registeredidentifier- property namerawValue- new raw value- Returns:
trueif value changed / did not exist,falseif value did not change
-
loadPropertyFromConfig
Loads property from config using standard property loading algorithm- Parameters:
property- property name to load- Returns:
trueif value did not exist or changed,falseotherwise
-
loadPropertyFromConfig
Loads property from config using standard property loading algorithm. If the property is not set in config,ifNotSetvalue is used.- Parameters:
property- property name to loadifNotSet- value to use if property is not defined in config- Returns:
trueif value did not exist or changed,falseotherwise
-
getTeamName
String getTeamName()Returns name of player's scoreboard team ornullif NameTag feature is disabled- Returns:
- name of player's team
-
getTeamNameNote
String getTeamNameNote()Returns user-friendly explanation of team name- Returns:
- explanation behind team name
-
isDisguised
boolean isDisguised()Returnstrueif player is disguised using LibsDisguises,falseif not- Returns:
trueif player is disguised,falseif not
-
hasInvisibilityPotion
boolean hasInvisibilityPotion()Returnstrueif player has invisibility potion,falseif not. For bukkit, API is used, for BungeeCord, bridge is used.- Returns:
trueif player has invisibility potion,falseif not
-
isVanished
boolean isVanished()Checks if player is vanished using any supported vanish plugin and returns the result.- Returns:
trueif player is vanished,falseif not
-
isOnline
boolean isOnline()Calls platform-specific method and returns the result- Returns:
trueif player is online,falseif not
-
getGamemode
int getGamemode()Returns GameMode of the player (0 for survival, 1 creative, 2 adventure, 3 spectator)- Returns:
- GameMode of the player
-
isBedrockPlayer
boolean isBedrockPlayer()Returnstrueif this is a bedrock player,falseif not- Returns:
trueif player is a bedrock player,falseif not
-
getGroup
String getGroup()Returns player's primary permission group. If group has been changed usingsetTemporaryGroup(String), returns that value. Otherwise, returns group detected by standard group assign logic- Returns:
- player's primary permission group
-
setTemporaryGroup
Temporarily overrides player's group and applies all changes coming from new group. This includes all properties and sorting, if used.- Parameters:
group- New group to use- See Also:
-
hasTemporaryGroup
boolean hasTemporaryGroup()Returns temporary group applied to the player usingsetTemporaryGroup(String). If no group was set, returnsnull- Returns:
- Temporary group assigned to player or
nullif not set - See Also:
-
resetTemporaryGroup
void resetTemporaryGroup()Resets temporary group assigned usingsetTemporaryGroup(String). If no temporary group is set, doesn't do anything.- See Also:
-
getNickname
String getNickname()Returns player's game profile name as seen by other players. By default, this returns player's name. If using a nickname / disguise plugin that changes game profile name for other players and change was successfully detected, returns that value.- Returns:
- player's game profile name as seen by other players
-