Class ChatPluginServerPlayer
- All Implemented Interfaces:
ChatPluginPlayer
ChatPluginPlayer
loaded on a server (Bukkit/Sponge) environment.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Closes the player's open inventory.abstract void
executeCommand
(String command) Makes this player execute a command.short
Gets this player's anticheat bans fromDataContainer.BANS
.short
Gets this player's anticheat kicks fromDataContainer.KICKS
.short
Gets this player's anticheat mutes fromDataContainer.MUTES
.short
Gets this player's anticheat warnings fromDataContainer.WARNINGS
.int
Gets this player'sPlayersDataType.ANTISPAM_INFRACTIONS
fromDataContainer.PLAYERS
.int
getBans()
Gets this player'sPlayersDataType.BANS
fromDataContainer.PLAYERS
.Gets this player's active bossbar.List
<ChatChannel<? extends ChatChannelData>> Gets the channels this player is listening to.Gets this player's chat's default color.abstract String
Gets this player's display name.abstract double
getDistance
(double x, double y, double z) Gets this player's distance from the specified location.Gets this player's emojis' tone.int
getID()
Gets this player'sPlayersDataType.ID
fromDataContainer.PLAYERS
.Cached version ofPlayerIgnoreManager.getIgnoredPlayers(OfflinePlayer)
.getIPLookup
(boolean generateIfNull) Gets an IP lookup for this player's IP address.int
getKicks()
Gets this player'sPlayersDataType.KICKS
fromDataContainer.PLAYERS
.Gets this player's language.Gets this player's last correspondent.abstract Locale
Gets this player's locale set in their game's settings.long
Gets this player's login time, in milliseconds.int
Gets this player'sPlayersDataType.MESSAGES_SENT
fromDataContainer.PLAYERS
.int
getMutes()
Gets this player'sPlayersDataType.MUTES
fromDataContainer.PLAYERS
.Gets this player's objective.int
getPing()
Gets this player's ping, in milliseconds.Gets this player's connection's instance.getRank()
Gets this player's rank.Gets this player's active scoreboard.Gets this player's version.int
Gets this player'sPlayersDataType.WARNINGS
fromDataContainer.PLAYERS
.abstract String
getWorld()
Gets this player's world's name.ChatChannel
<? extends ChatChannelData> Gets the channel this player is writing in.abstract double
getX()
Gets this player's location's X coordinate.abstract double
getY()
Gets this player's location's Y coordinate.abstract double
getZ()
Gets this player's location's Z coordinate.boolean
Checks if actionbars should be displayed to this player.boolean
Checks if this player has the chat channel spy enabled.boolean
Checks if this player has socialspy enabled.boolean
Checks if this player is connected through aMultiPlatformIntegration
.boolean
Checks if this player is vanished.boolean
joinChannel
(ChatChannel<? extends ChatChannelData> channel) Makes this player join the specified channel.boolean
leaveChannel
(ChatChannel<? extends ChatChannelData> channel) Makes this player leave the specified channel.abstract void
openInventory
(InventoryAdapter inventory) Opens an inventory to this player.abstract void
playSound
(SoundAdapter sound) Plays a sound to this player.abstract void
sendActionbar
(String actionbar) Sends an actionbar to this player.abstract void
sendPacket
(Object packet) Deprecated.Internal use only.void
CallssendTitle(String, String, int, int, int)
specifying default values of 500, 3500 and 1000 milliseconds (or 10, 70 and 20 ticks).abstract void
Sends a title and a subtitle to this player.void
sendTranslatedMessage
(String path, Object... args) Sends a translated message (with numeric placeholders) to this player.void
sendTranslatedMessage
(String path, String[] placeholders, Object... args) Sends a translated message (with custom placeholders) to this player.void
setActionbarEnabled
(boolean actionbarEnabled) Sets whether actionbars should be displayed to this player.void
setChatChannelSpyEnabled
(boolean chatChannelSpyEnabled) Sets whether this player should have the chat channel spy enabled.abstract void
setChatColor
(ChatColor chatColor) Sets this player's chat's default color.abstract void
setEmojisTone
(ChatColor emojisTone) Sets this player's emojis' tone.void
setSocialspyEnabled
(boolean socialspyEnabled) Sets whether this player should have socialspy enabled.boolean
switchChannel
(ChatChannel<? extends ChatChannelData> channel) Makes this player switch channels for writing.abstract void
teleport
(ChatPluginServerPlayer player) Teleports this player to another player.Methods inherited from class me.remigio07.chatplugin.api.common.player.OfflinePlayer
equals, get, get, getIPAddress, getName, getUUID, hashCode, hasPermission, hasPlayedBefore, isLoaded, isOnline, isPaidAccount, toAdapter, toProxyPlayer, toServerPlayer
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.remigio07.chatplugin.api.common.player.ChatPluginPlayer
connect, disconnect, getIPAddress, getName, getUUID, sendMessage
-
Method Details
-
getVersion
Description copied from interface:ChatPluginPlayer
Gets this player's version.- Specified by:
getVersion
in interfaceChatPluginPlayer
- Returns:
- Player's version
-
isBedrockPlayer
public boolean isBedrockPlayer()Description copied from interface:ChatPluginPlayer
Checks if this player is connected through aMultiPlatformIntegration
.- Specified by:
isBedrockPlayer
in interfaceChatPluginPlayer
- Returns:
- Whether this player is using the Bedrock Edition
-
hasSocialspyEnabled
public boolean hasSocialspyEnabled()Checks if this player has socialspy enabled.- Returns:
- Whether socialspy is enabled
-
setSocialspyEnabled
public void setSocialspyEnabled(boolean socialspyEnabled) Sets whether this player should have socialspy enabled.- Parameters:
socialspyEnabled
- Whether socialspy is enabled
-
hasChatChannelSpyEnabled
public boolean hasChatChannelSpyEnabled()Checks if this player has the chat channel spy enabled.- Returns:
- Whether the chat channel spy is enabled
-
setChatChannelSpyEnabled
public void setChatChannelSpyEnabled(boolean chatChannelSpyEnabled) Sets whether this player should have the chat channel spy enabled.- Parameters:
chatChannelSpyEnabled
- Whether the chat channel spy is enabled
-
hasActionbarEnabled
public boolean hasActionbarEnabled()Checks if actionbars should be displayed to this player.- Returns:
- Whether their actionbar is enabled
-
setActionbarEnabled
public void setActionbarEnabled(boolean actionbarEnabled) Sets whether actionbars should be displayed to this player.- Parameters:
actionbarEnabled
- Whether their actionbar is enabled
-
getRank
Gets this player's rank.- Returns:
- Player's rank
-
getLanguage
Gets this player's language.- Returns:
- Player's language
-
getScoreboard
Gets this player's active scoreboard.Will return
null
if this player does not have an active scoreboard.- Returns:
- Player's scoreboard
-
getBossbar
Gets this player's active bossbar.Will return
null
if this player does not have an active bossbar.- Returns:
- Player's bossbar
-
getIPLookup
Gets an IP lookup for this player's IP address.Will return
IPLookupManager.getDisabledFeatureConstructor()
if!
IPLookupManager.isEnabled()
or!generateIfNull
and there are no cached IP lookups for this player or an error occurrs.Note: this method might take some time to be executed: async calls are recommended.
- Parameters:
generateIfNull
- Whether to generate the lookup if it is not cached- Returns:
- Lookup for this player
-
getObjective
Gets this player's objective.- Returns:
- Player's objective
-
getPlayerConnection
Gets this player's connection's instance.- Returns:
- Player's connection
-
getPing
public int getPing()Gets this player's ping, in milliseconds.- Returns:
- Player's ping
-
getID
public int getID()Gets this player'sPlayersDataType.ID
fromDataContainer.PLAYERS
.- Returns:
- Player's ID in the storage
-
getBans
public int getBans()Gets this player'sPlayersDataType.BANS
fromDataContainer.PLAYERS
.- Returns:
- Player's bans in the storage
-
getAnticheatBans
public short getAnticheatBans()Gets this player's anticheat bans fromDataContainer.BANS
.- Returns:
- Player's anticheat bans in the storage
-
getWarnings
public int getWarnings()Gets this player'sPlayersDataType.WARNINGS
fromDataContainer.PLAYERS
.- Returns:
- Player's warnings in the storage
-
getAnticheatWarnings
public short getAnticheatWarnings()Gets this player's anticheat warnings fromDataContainer.WARNINGS
.- Returns:
- Player's anticheat warnings in the storage
-
getKicks
public int getKicks()Gets this player'sPlayersDataType.KICKS
fromDataContainer.PLAYERS
.- Returns:
- Player's kicks in the storage
-
getAnticheatKicks
public short getAnticheatKicks()Gets this player's anticheat kicks fromDataContainer.KICKS
.- Returns:
- Player's anticheat kicks in the storage
-
getMutes
public int getMutes()Gets this player'sPlayersDataType.MUTES
fromDataContainer.PLAYERS
.- Returns:
- Player's mutes in the storage
-
getAnticheatMutes
public short getAnticheatMutes()Gets this player's anticheat mutes fromDataContainer.MUTES
.- Returns:
- Player's anticheat mutes in the storage
-
getMessagesSent
public int getMessagesSent()Gets this player'sPlayersDataType.MESSAGES_SENT
fromDataContainer.PLAYERS
.- Returns:
- Player's messages sent in the storage
-
getAntispamInfractions
public int getAntispamInfractions()Gets this player'sPlayersDataType.ANTISPAM_INFRACTIONS
fromDataContainer.PLAYERS
.- Returns:
- Player's antispam infractions in the storage
-
getLoginTime
public long getLoginTime()Gets this player's login time, in milliseconds.- Returns:
- Player's login time
-
isVanished
public boolean isVanished()Checks if this player is vanished.- Returns:
- Whether this player is vanished
-
getLastCorrespondent
Gets this player's last correspondent.Will return
null
if this player does not have a correspondent. Returned value is the last player that has sent a private message to this player ifPrivateMessagesManager.isReplyToLastSender()
, otherwise it is the player to whom this player has last sent a private message.Note: the returned player may be vanished or in another server under the proxy and
null
does not represent the console - it is not possible to reply to it directly.- Returns:
- Player's last correspondent
-
getChatColor
Gets this player's chat's default color.Will return
ChatColor.RESET
if no chat color is set for this player.- Returns:
- Player's chat's color
-
getEmojisTone
Gets this player's emojis' tone.Will return
ChatColor.RESET
if no emojis' tone is set for this player.If that is the case, you may want to use the default tone instead.
- Returns:
- Player's emojis' tone
-
getWritingChannel
Gets the channel this player is writing in.Will return
null
if!
ChatChannelsManager.isEnabled()
.- Returns:
- Player's writing channel
-
getChannels
Gets the channels this player is listening to.- Returns:
- Player's channels
-
joinChannel
Makes this player join the specified channel.Will do nothing and return
false
if they are already listening to it.- Parameters:
channel
- Channel to join- Returns:
- Whether the event has completed
- See Also:
-
leaveChannel
Makes this player leave the specified channel.Will do nothing and return
false
if they are not listening to it.- Parameters:
channel
- Channel to leave- Returns:
- Whether the event has completed
- Throws:
IllegalArgumentException
- IfgetWritingChannel()
.equals(channel)
- See Also:
-
switchChannel
Makes this player switch channels for writing.Will call
joinChannel(ChatChannel)
if they are not listening to it and returnfalse
before executingChatChannelSwitchEvent
if that method returnsfalse
.- Parameters:
channel
- Channel to switch to- Returns:
- Whether the event has completed
- See Also:
-
getIgnoredPlayers
Cached version ofPlayerIgnoreManager.getIgnoredPlayers(OfflinePlayer)
.- Returns:
- Ignored players' list
-
sendTranslatedMessage
Sends a translated message (with numeric placeholders) to this player.- Parameters:
path
- Message's pathargs
- Optional arguments (Utils.replaceNumericPlaceholders(String, Object...)
)
-
sendTranslatedMessage
Sends a translated message (with custom placeholders) to this player.- Parameters:
path
- Message's pathplaceholders
- Message's placeholdersargs
- Optional arguments (Utils.replaceCustomPlaceholders(String, String[], Object...)
)
-
sendTitle
CallssendTitle(String, String, int, int, int)
specifying default values of 500, 3500 and 1000 milliseconds (or 10, 70 and 20 ticks).- Parameters:
title
- Title to sendsubtitle
- Subtitle to send
-
sendTitle
Sends a title and a subtitle to this player.- Parameters:
title
- Title to sendsubtitle
- Subtitle to sendfadeIn
- Fading in effect's duration, in millisecondsstay
- Stay effect's duration, in millisecondsfadeOut
- Fading out effect's duration, in milliseconds
-
sendActionbar
Sends an actionbar to this player.- Parameters:
actionbar
- Actionbar to send
-
sendPacket
Deprecated.Internal use only.Sends a packet to this player.- Parameters:
packet
- Packet to send
-
openInventory
Opens an inventory to this player.- Parameters:
inventory
- Inventory to open
-
closeInventory
public abstract void closeInventory()Closes the player's open inventory. -
playSound
Plays a sound to this player.- Parameters:
sound
- Sound to play
-
executeCommand
Makes this player execute a command.- Parameters:
command
- Command to execute without '/'
-
teleport
Teleports this player to another player.- Parameters:
player
- Destination player
-
getDisplayName
Gets this player's display name.It can be changed by other plugins and may include formatting codes.
- Returns:
- Player's display name
-
getWorld
Gets this player's world's name.- Returns:
- Player's world's name
-
getX
public abstract double getX()Gets this player's location's X coordinate.- Returns:
- Player's X coord
-
getY
public abstract double getY()Gets this player's location's Y coordinate.- Returns:
- Player's Y coord
-
getZ
public abstract double getZ()Gets this player's location's Z coordinate.- Returns:
- Player's Z coord
-
getDistance
public abstract double getDistance(double x, double y, double z) Gets this player's distance from the specified location.- Parameters:
x
- X coordy
- Y coordz
- Z coord- Returns:
- Player's distance
-
getLocale
Gets this player's locale set in their game's settings.- Returns:
- Player's locale
-
setChatColor
Sets this player's chat's default color.Specify
ChatColor.RESET
to reset it and make it appear as their rank'sRank.getChatColor()
when they type in chat.- Parameters:
chatColor
- Player's chat's color- Throws:
IllegalArgumentException
- IfChatColor.isFormatCode()
-
setEmojisTone
Sets this player's emojis' tone.Specify
ChatColor.RESET
to reset it and make it appear as the default tone.- Parameters:
emojisTone
- Player's emojis' tone- Throws:
IllegalArgumentException
- IfChatColor.isFormatCode()
-